Exemple #1
0
 /**
  * {@inheritdoc}
  *
  * @return void
  */
 public function getHelp()
 {
     print Color::head('Help:') . PHP_EOL;
     print Color::colorize('  Creates a module') . PHP_EOL . PHP_EOL;
     print Color::head('Example') . PHP_EOL;
     print Color::colorize('  phalcon module backend', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
     $this->printParameters($this->getPossibleParams());
 }
 /**
  * Prints the help for current command.
  *
  * @return void
  */
 public function getHelp()
 {
     print Color::head('Help:') . PHP_EOL;
     print Color::colorize('  Creates a controller') . PHP_EOL . PHP_EOL;
     print Color::head('Usage:') . PHP_EOL;
     print Color::colorize('  controller [name] [directory]', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
     print Color::head('Arguments:') . PHP_EOL;
     print Color::colorize('  ?', Color::FG_GREEN);
     print Color::colorize("\tShows this help text") . PHP_EOL . PHP_EOL;
     $this->printParameters($this->_possibleParameters);
 }
Exemple #3
0
 /**
  * Prints the help for current command.
  *
  * @return void
  */
 public function getHelp()
 {
     print Color::head('Help:') . PHP_EOL;
     print Color::colorize('  Creates a model') . PHP_EOL . PHP_EOL;
     print Color::head('Usage:') . PHP_EOL;
     print Color::colorize('  model [table-name] [options]', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
     print Color::head('Arguments:') . PHP_EOL;
     print Color::colorize('  ?', Color::FG_GREEN);
     print Color::colorize("\tShows this help text") . PHP_EOL . PHP_EOL;
     $this->printParameters($this->_possibleParameters);
 }
 /**
  * {@inheritdoc}
  *
  * @return void
  */
 public function getHelp()
 {
     print Color::head('Help:') . PHP_EOL;
     print Color::colorize('  Creates a scaffold from a database table') . PHP_EOL . PHP_EOL;
     print Color::head('Usage:') . PHP_EOL;
     print Color::colorize('  scaffold [tableName] [options]', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
     print Color::head('Arguments:') . PHP_EOL;
     print Color::colorize('  help', Color::FG_GREEN);
     print Color::colorize("\tShows this help text") . PHP_EOL . PHP_EOL;
     $this->printParameters($this->getPossibleParams());
 }
 /**
  * Prints help on the usage of the command
  *
  */
 public function getHelp()
 {
     print Color::head('Help:') . PHP_EOL;
     print Color::colorize('  Enables/disables webtools in a project') . PHP_EOL . PHP_EOL;
     print Color::head('Usage:') . PHP_EOL;
     print Color::colorize('  webtools [action]', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
     print Color::head('Arguments:') . PHP_EOL;
     print Color::colorize('  ?', Color::FG_GREEN);
     print Color::colorize("\tShows this help text") . PHP_EOL . PHP_EOL;
     $this->printParameters($this->_possibleParameters);
 }
Exemple #6
0
 /**
  * Prints the help for current command.
  *
  * @return void
  */
 public function getHelp()
 {
     print Color::head('Help:') . PHP_EOL;
     print Color::colorize('  Creates a project') . PHP_EOL . PHP_EOL;
     print Color::head('Usage:') . PHP_EOL;
     print Color::colorize('  project [name] [type] [directory] [enable-webtools]', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
     print Color::head('Arguments:') . PHP_EOL;
     print Color::colorize('  help', Color::FG_GREEN);
     print Color::colorize("\tShows this help text") . PHP_EOL . PHP_EOL;
     print Color::head('Example') . PHP_EOL;
     print Color::colorize('  phalcon project store simple', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
     $this->printParameters($this->_possibleParameters);
 }
 /**
  * {@inheritdoc}
  *
  * @return void
  */
 public function getHelp()
 {
     print Color::head('Help:') . PHP_EOL;
     print Color::colorize('  Lists the commands available in Phalcon devtools') . PHP_EOL . PHP_EOL;
     $this->run([]);
 }
Exemple #8
0
    $extensionLoaded = true;
    if (!extension_loaded('phalcon')) {
        $extensionLoaded = false;
        include dirname(__FILE__) . '/scripts/Phalcon/Script.php';
        throw new Exception(sprintf("Phalcon extension isn't installed, follow these instructions to install it: %s", Script::DOC_INSTALL_URL));
    }
    $loader = new Loader();
    $loader->registerDirs(array(__DIR__ . '/scripts/'))->registerNamespaces(array('Phalcon' => __DIR__ . '/scripts/'))->register();
    if (Version::getId() < Script::COMPATIBLE_VERSION) {
        throw new Exception(sprintf("Your Phalcon version isn't compatible with Developer Tools, download the latest at: %s", Script::DOC_DOWNLOAD_URL));
    }
    if (!defined('TEMPLATE_PATH')) {
        define('TEMPLATE_PATH', __DIR__ . '/templates');
    }
    $vendor = sprintf('Phalcon DevTools (%s)', Version::get());
    print PHP_EOL . Color::colorize($vendor, Color::FG_GREEN, Color::AT_BOLD) . PHP_EOL . PHP_EOL;
    $eventsManager = new EventsManager();
    $eventsManager->attach('command', new CommandsListener());
    $script = new Script($eventsManager);
    $commandsToEnable = array('\\Phalcon\\Commands\\Builtin\\Enumerate', '\\Phalcon\\Commands\\Builtin\\Controller', '\\Phalcon\\Commands\\Builtin\\Model', '\\Phalcon\\Commands\\Builtin\\AllModels', '\\Phalcon\\Commands\\Builtin\\Project', '\\Phalcon\\Commands\\Builtin\\Scaffold', '\\Phalcon\\Commands\\Builtin\\Migration', '\\Phalcon\\Commands\\Builtin\\Webtools');
    foreach ($commandsToEnable as $command) {
        $script->attach(new $command($script, $eventsManager));
    }
    $script->run();
} catch (PhalconException $e) {
    print Color::error($e->getMessage()) . PHP_EOL;
} catch (Exception $e) {
    if ($extensionLoaded) {
        print Color::error($e->getMessage()) . PHP_EOL;
    } else {
        print 'ERROR: ' . $e->getMessage() . PHP_EOL;
Exemple #9
0
 /**
  * Prints the available options in the script
  *
  * @param array $parameters
  */
 public function printParameters($parameters)
 {
     $length = 0;
     foreach ($parameters as $parameter => $description) {
         if ($length == 0) {
             $length = strlen($parameter);
         }
         if (strlen($parameter) > $length) {
             $length = strlen($parameter);
         }
     }
     print Color::head('Options:') . PHP_EOL;
     foreach ($parameters as $parameter => $description) {
         print Color::colorize(' --' . $parameter . str_repeat(' ', $length - strlen($parameter)), Color::FG_GREEN);
         print Color::colorize("    " . $description) . PHP_EOL;
     }
 }
 /**
  * {@inheritdoc}
  *
  * @return void
  */
 public function getHelp()
 {
     echo Color::head('Help:') . PHP_EOL;
     echo Color::colorize('  Enables/disables webtools in a project') . PHP_EOL . PHP_EOL;
     print Color::head('Usage: Enable webtools') . PHP_EOL;
     print Color::colorize('  webtools enable', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
     print Color::head('Usage: Disable webtools') . PHP_EOL;
     print Color::colorize('  webtools disable', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
     echo Color::head('Arguments:') . PHP_EOL;
     echo Color::colorize('  help', Color::FG_GREEN);
     echo Color::colorize("\tShows this help text") . PHP_EOL . PHP_EOL;
     $this->printParameters($this->getPossibleParams());
 }
 /**
  * {@inheritdoc}
  *
  * @return void
  */
 public function getHelp()
 {
     print Color::head('Help:') . PHP_EOL;
     print Color::colorize('  Generates/Run a Migration') . PHP_EOL . PHP_EOL;
     print Color::head('Usage: Generate a Migration') . PHP_EOL;
     print Color::colorize('  migration generate', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
     print Color::head('Usage: Run a Migration') . PHP_EOL;
     print Color::colorize('  migration run', Color::FG_GREEN) . PHP_EOL . PHP_EOL;
     print Color::head('Arguments:') . PHP_EOL;
     print Color::colorize('  help', Color::FG_GREEN);
     print Color::colorize("\tShows this help text") . PHP_EOL . PHP_EOL;
     $this->printParameters($this->getPossibleParams());
 }
 /**
  * Initialize task
  */
 public function mainAction()
 {
     // define error handler
     $this->setSilentErrorHandler();
     try {
         // init configurations // init logger
         $this->setConfig($this->getDI()->get('config'))->setLogger();
         // run server
         $this->sonar = new Application($this->getConfig());
         $this->sonar->run();
     } catch (AppServiceException $e) {
         echo Color::colorize($e->getMessage(), Color::FG_RED, Color::AT_BOLD) . PHP_EOL;
         if ($this->logger != null) {
             // logging all error exceptions
             $this->getLogger()->log($e->getMessage(), Logger::CRITICAL);
         }
     }
 }