From 396d5e99e0c7ddefd6333b1232b3a0dd43da6d97 Mon Sep 17 00:00:00 2001 From: Mahmut Bayri Date: Mon, 23 Nov 2015 08:12:41 +0200 Subject: [PATCH 1/2] Fix caching problem. --- Repository.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Repository.php b/Repository.php index c3f69de..0302287 100644 --- a/Repository.php +++ b/Repository.php @@ -160,7 +160,9 @@ protected function formatCached($cached) foreach ($cached as $name => $module) { $path = $this->config('paths.modules').'/'.$name; - $modules[] = new Module($this->app, $name, $path); + $lowerName = strtolower($name); + + $modules[$name] = new Module($this->app, $lowerName, $path); } return $modules; From 22d1bc629630c0fa75343e72e2f957dfa5f32dae Mon Sep 17 00:00:00 2001 From: Mahmut Bayri Date: Mon, 30 Nov 2015 14:42:14 +0200 Subject: [PATCH 2/2] Fix getting dependencies from composer.json file with module:update command. Otherwise module:update looks at module.json for its own dependencies. --- Module.php | 21 +++++++++++++++++++-- Process/Updater.php | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Module.php b/Module.php index 476ec9b..cb9d88a 100644 --- a/Module.php +++ b/Module.php @@ -169,9 +169,13 @@ protected function registerTranslation() * * @return Json */ - public function json() + public function json($file = null) { - return new Json($this->getPath().'/module.json', $this->app['files']); + if (is_null($file)) { + $file = 'module.json'; + } + + return new Json($this->getPath() . '/' . $file, $this->app['files']); } /** @@ -187,6 +191,19 @@ public function get($key, $default = null) return $this->json()->get($key, $default); } + /** + * Get a specific data from composer.json file by given the key. + * + * @param $key + * @param null $default + * + * @return mixed + */ + public function getComposerAttr($key, $default = null) + { + return $this->json('composer.json')->get($key, $default); + } + /** * Register the module. */ diff --git a/Process/Updater.php b/Process/Updater.php index 5ba314d..1e8f290 100644 --- a/Process/Updater.php +++ b/Process/Updater.php @@ -13,7 +13,7 @@ public function update($module) { $module = $this->module->findOrFail($module); - $packages = $module->get('require', []); + $packages = $module->getComposerAttr('require', []); chdir(base_path());