예제 #1
0
파일: Module.php 프로젝트: arcanedev/moduly
 /**
  * Update module enable attribute
  *
  * @param  bool  $enabled
  *
  * @return bool
  */
 private function updateEnabled($enabled)
 {
     if ($this->enabled === $enabled) {
         return true;
     }
     $this->enabled = $enabled;
     return $this->json->update(['enabled' => $enabled]);
 }
예제 #2
0
 /**
  * Install modules from modules.json file.
  */
 private function installFromFile()
 {
     if (!file_exists($path = base_path('modules.json'))) {
         $this->error("File 'modules.json' does not exist in your project root.");
         return;
     }
     $modules = Json::make($path);
     $dependencies = $modules->get('require', []);
     foreach ($dependencies as $module) {
         $module = collect($module);
         $this->install($module->get('name'), $module->get('version'), $module->get('type'));
     }
 }
예제 #3
0
 /**
  * Add merge modules.
  *
  * @return self
  */
 public function addMergeModules()
 {
     $extra = array_merge($this->getExtra(), ['merge-plugin' => ["include" => ["modules/*/composer.json"]]]);
     $this->json->set('extra', $extra)->save();
     return $this;
 }
예제 #4
0
 /**
  * Get & scan all modules.
  *
  * @return array
  */
 public function scan()
 {
     $paths = $this->getScanPaths();
     $modules = [];
     foreach ($paths as $key => $path) {
         $manifests = $this->app['files']->glob("{$path}/module.json");
         is_array($manifests) || ($manifests = []);
         foreach ($manifests as $manifest) {
             $name = Json::make($manifest)->get('name');
             $lowerName = strtolower($name);
             $modules[$name] = new Module($this->app, $lowerName, dirname($manifest));
         }
     }
     return $modules;
 }