Skip to content

Commit

Permalink
Merge pull request #227 from mahmutbayri/2.1
Browse files Browse the repository at this point in the history
Fix caching problem.
  • Loading branch information
gravitano committed Dec 7, 2015
2 parents 02672d7 + 22d1bc6 commit 2661e74
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 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
4 changes: 3 additions & 1 deletion Repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 2661e74

Please sign in to comment.