Esempio n. 1
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'));
     }
 }
Esempio n. 2
0
 /**
  * Load module
  *
  * @return self
  */
 public function load()
 {
     $this->json = Json::make($this->path . '/module.json');
     $this->slug = str_slug($this->json->name);
     $this->name = $this->json->name;
     $this->description = $this->json->description;
     $this->version = $this->json->version;
     $this->provider = $this->json->provider;
     $this->enabled = $this->json->enabled;
     $this->order = $this->json->order;
     return $this;
 }
Esempio n. 3
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;
 }