Ejemplo n.º 1
0
 protected function handleModuleBowerInstall(Module $module)
 {
     $path = $module->getPath();
     if (!$this->bowerFileExists($path)) {
         return $this->info("Skipping bower install for module '{$module->getName()}': bower.json file not found. ");
     }
     $this->info("Installing bower components for module '{$module->getName()}'");
     $result = null;
     passthru($this->getExecCommand($path), $result);
     if ($result !== self::EXIT_SUCCESS) {
         $this->error('Bower install ended with error!');
     }
 }
Ejemplo n.º 2
0
 public function publishAssets(Module $module)
 {
     try {
         Artisan::call('module:publish', ['module' => $module->getName()]);
     } catch (InvalidArgumentException $e) {
     }
 }
Ejemplo n.º 3
0
 /**
  * Return a modules.
  *
  * @return \Illuminate\Support\Collection
  */
 public function get(Module $module)
 {
     $moduleName = $module->getName();
     if (Lang::has("{$moduleName}::module.title")) {
         $module->localname = Lang::get("{$moduleName}::module.title");
     } else {
         $module->localname = $module->getStudlyName();
     }
     if (Lang::has("{$moduleName}::module.description")) {
         $module->description = Lang::get("{$moduleName}::module.description");
     }
     $package = $this->packageVersion->getPackageInfo("societycms/module-{$moduleName}");
     if (isset($package->name) && strpos($package->name, '/')) {
         $module->vendor = explode('/', $package->name)[0];
     }
     $module->version = isset($package->version) ? $package->version : 'N/A';
     $module->versionUrl = '#';
     $module->isCore = $this->isCoreModule($module);
     if (isset($package->source->url)) {
         $packageUrl = str_replace('.git', '', $package->source->url);
         $module->versionUrl = $packageUrl . '/tree/' . $package->dist->reference;
     }
     $module->license = $package->license;
     return $module;
 }
Ejemplo n.º 4
0
 /**
  * @param Module $module
  */
 protected function bootModuleBlocks(Module $module)
 {
     foreach ($module->get('blocks') as $block) {
         $moduleName = studly_case($module->getName());
         $block = studly_case($block);
         $class = "Modules\\{$moduleName}\\Components\\{$block}Block";
         if (class_exists($class)) {
             /* @var BaseBlock $moduleBlock */
             $moduleBlock = app()->make($class)->setModuleName($moduleName)->setComponentName($block);
             $moduleBlock->boot($moduleName, $block);
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * Get the absolute path to the Centralised Translations for a Module (via the Translations module)
  * @param Module $module
  * @return string
  */
 private function getCentralisedTranslationPath(Module $module)
 {
     return $this->app['modules']->find('Translation')->getPath() . "/Resources/lang/{$module->getName()}";
 }
Ejemplo n.º 6
0
 /**
  * Register the config namespace
  * @param Module $module
  */
 private function registerConfigNamespace(Module $module)
 {
     $files = $this->app['files']->files($module->getPath() . '/Config');
     $package = $module->getName();
     foreach ($files as $file) {
         $filename = $this->getConfigFilename($file, $package);
         $this->mergeConfigFrom($file, $filename);
         $this->publishes([$file => config_path($filename . '.php')], 'config');
     }
 }