Esempio n. 1
0
 public function actionComposer()
 {
     $file = new File(['path' => 'composer.json']);
     $data = array_filter(['name' => $this->name, 'type' => $this->getType(), 'description' => $this->getTitle(), 'keywords' => preg_split('/\\s*,\\s*/', $this->getKeywords()), 'require-dev' => $this->getPlugins(), 'license' => $this->getItem('license')]);
     $file->save($data);
     $this->setItem('norequire', true);
 }
Esempio n. 2
0
 /**
  * Include config file, unique only.
  * @param string|array $path
  * @return bool true if the path was unique and loaded
  */
 public function includeConfig($path, $force = false)
 {
     $file = File::create($path);
     $path = $file->getPath();
     if (!isset($this->_included[$path]) || $force) {
         $this->_included[$path] = $path;
         $this->mergeItems($file->load());
         return true;
     }
     return false;
 }
Esempio n. 3
0
 public function actionDoDeploy()
 {
     $etcDir = $this->getEtcDir();
     if (!is_dir($etcDir)) {
         throw new InvalidParamException("Non existing Nginx etcDir: {$etcDir}");
     }
     $enabledDir = $etcDir . DIRECTORY_SEPARATOR . 'sites-enabled';
     $availableDir = $etcDir . DIRECTORY_SEPARATOR . 'sites-available';
     static::mkdir($enabledDir);
     static::mkdir($availableDir);
     foreach ($this->getItems() as $vhost) {
         $conf = $vhost->renderConf();
         $name = $vhost->getDomain() . '.conf';
         $file = File::plain($availableDir . DIRECTORY_SEPARATOR . $name);
         $file->save($conf);
         $file->symlink($enabledDir . DIRECTORY_SEPARATOR . $name);
     }
     $this->actionRestart();
 }
Esempio n. 4
0
 public function needsComposerInstall()
 {
     if (file_exists('vendor')) {
         return false;
     }
     if (!file_exists('composer.json')) {
         return false;
     }
     $data = File::create('composer.json')->load();
     foreach (['require', 'require-dev'] as $key) {
         if (isset($data[$key])) {
             foreach ($data[$key] as $package => $version) {
                 list(, $name) = explode('/', $package);
                 if (strncmp($name, 'hidev-', 6) === 0) {
                     return true;
                 }
             }
         }
     }
     return false;
 }