public function run($parameters)
 {
     $action = $this->getOption(array('action', 1));
     $directory = $this->getOption(array('directory'));
     if (!$directory) {
         $directory = __DIR__ . '/../../../../';
     }
     if ($action == 'enable') {
         \Phalcon\Web\Tools::install($directory);
     } else {
         if ($action == 'disable') {
             \Phalcon\Web\Tools::install($directory);
         } else {
             throw new Exception("Invalid action");
         }
     }
     //
 }
 /**
  * {@inheritdoc}
  *
  * @param array $parameters
  * @return mixed
  * @throws CommandsException
  */
 public function run(array $parameters)
 {
     $action = $this->getOption(array('action', 1));
     $directory = './';
     if ($action == 'enable') {
         if (file_exists($directory . 'public/webtools.php')) {
             throw new CommandsException('Webtools are already enabled!');
         }
         Tools::install($directory);
         echo Color::success('Webtools successfully enabled!');
     } elseif ($action == 'disable') {
         if (!file_exists($directory . 'public/webtools.php')) {
             throw new CommandsException('Webtools are already disabled!');
         }
         Tools::uninstall($directory);
         echo Color::success('Webtools successfully disabled!');
     } else {
         throw new CommandsException('Invalid action!');
     }
 }
Exemple #3
0
 public function run($parameters)
 {
     $action = $this->getOption(array('action', 1));
     $directory = $this->getOption(array('directory'));
     if (!$directory) {
         $directory = __DIR__ . '/../../../../';
     }
     if ($action == 'enable') {
         Tools::install($directory);
     } else {
         if ($action == 'disable') {
             Tools::install($directory);
         } else {
             throw new \Exception("Invalid action");
         }
     }
     if ($action == 'enable') {
         print Color::success('Webtools successfully enabled') . PHP_EOL;
     } else {
         if ($action == 'disable') {
             print Color::success('Webtools successfully disabled') . PHP_EOL;
         }
     }
 }
 /**
  * Build project
  *
  * @return bool
  */
 public function build()
 {
     $this->buildDirectories()->getVariableValues()->createConfig()->createBootstrapFile()->createHtaccessFiles()->createControllerBase()->createModule()->createIndexViewFiles()->createControllerFile()->createHtrouterFile();
     $this->options->contains('enableWebTools') && Tools::install($this->options->get('projectPath'));
     return true;
 }
Exemple #5
0
 public function build($name, $path, $templatePath, $options)
 {
     $this->buildDirectories($this->_dirs, $path);
     if (isset($options['useConfigIni'])) {
         $useIniConfig = $options['useConfigIni'];
     } else {
         $useIniConfig = false;
     }
     if ($useIniConfig) {
         $this->createConfig($path, $templatePath, $name, 'ini');
     } else {
         $this->createConfig($path, $templatePath, $name, 'php');
     }
     $this->createBootstrapFile($name, $path, $templatePath, $useIniConfig);
     $this->createHtaccessFiles($path, $templatePath);
     $this->createControllerBase($path, $templatePath, $name);
     $this->createModule($path, $templatePath, $name);
     $this->createIndexViewFiles($path, $templatePath);
     $this->createControllerFile($path, $name);
     if ($options['enableWebTools']) {
         \Phalcon\Web\Tools::install($path);
     }
     return true;
 }