/** * Get module path. If $name not null, we will use that. * * @param string $name * @return string */ protected function getModulePath($name = null) { if ($name) { return $this->module->getModulePath($name); } return $this->module->getPath(); }
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!'); } }
/** * 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'); } }
/** * Register the config namespace. * * @param Module $module */ private function registerVendorConfig(Module $module) { $files = $this->app['files']->files($module->getPath() . '/Config/Vendor'); foreach ($files as $file) { $filename = preg_replace('/\\.[^.\\s]{3,4}$/', '', basename($file)); $this->mergeConfigFrom($file, $filename); } }
/** * Get assets path for the specified module. * * @param string $name * @return string */ protected function getAssetsPath($name) { return realpath($this->module->getPath() . "/{$name}/assets/"); }
/** * Get the changelog for the given module. * * @param Module $module * * @return array */ public function changelogFor(Module $module) { $path = $module->getPath() . '/CHANGELOG.md'; if (!$this->finder->isFile($path)) { return []; } $parser = new \Changelog\Parser(file_get_contents($path)); return $parser->getReleases(); }
/** * Setup the modules folder. */ protected function setupModulesFolder() { $this->createFolder($this->module->getPath(), 'The modules folder has been created successful.', 'The modules already exist.'); }
/** * Get the changelog for the given module * @param Module $module * @return array */ public function changelogFor(Module $module) { $path = $module->getPath() . '/changelog.yml'; if (!$this->finder->isFile($path)) { return []; } $yamlParser = new Parser(); $changelog = $yamlParser->parse(file_get_contents($path)); $changelog['versions'] = $this->limitLastVersionsAmount(array_get($changelog, 'versions', [])); return $changelog; }