Skip to content

Commit

Permalink
Fix getting dependencies from composer.json file with module:update c…
Browse files Browse the repository at this point in the history
…ommand. Otherwise module:update looks at module.json for its own dependencies.
  • Loading branch information
Mahmut Bayri committed Nov 30, 2015
1 parent 396d5e9 commit 22d1bc6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
21 changes: 19 additions & 2 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
}

/**
Expand All @@ -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.
*/
Expand Down
2 changes: 1 addition & 1 deletion Process/Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function update($module)
{
$module = $this->module->findOrFail($module);

$packages = $module->get('require', []);
$packages = $module->getComposerAttr('require', []);

chdir(base_path());

Expand Down

0 comments on commit 22d1bc6

Please sign in to comment.