Пример #1
0
 public function execute($input = null)
 {
     register_shutdown_function(array($this, 'shutdown'));
     set_error_handler(array($this, 'handleError'));
     Config::setOutput(new ConsoleOutput());
     $input = $this->prepareInput($input ? $input : $_SERVER['argv']);
     $app = new Application('Robo', self::VERSION);
     $app->addCommandsFromClass($this->roboClass, $this->passThroughArgs);
     $app->run($input);
 }
Пример #2
0
 public function execute($input = null)
 {
     register_shutdown_function(array($this, 'shutdown'));
     set_error_handler(array($this, 'handleError'));
     Config::setOutput(new ConsoleOutput());
     $input = $this->prepareInput($input ? $input : $_SERVER['argv']);
     $app = new Application('Robo', self::VERSION);
     if (!$this->loadRoboFile()) {
         $this->yell("Robo is not initialized here. Please run `robo init` to create a new RoboFile", 40, 'yellow');
         $app->addInitRoboFileCommand($this->roboFile, $this->roboClass);
         $app->run($input);
         return;
     }
     $app->addCommandsFromClass($this->roboClass, $this->passThroughArgs);
     $app->run($input);
 }
Пример #3
0
 /**
  * @param \Robo\Application $app
  * @param string|BuilderAwareInterface|ContainerAwareInterface $commandClass
  *
  * @return mixed|void
  */
 public function registerCommandClass($app, $commandClass)
 {
     $container = Robo::getContainer();
     $roboCommandFileInstance = $this->instantiateCommandClass($commandClass);
     if (!$roboCommandFileInstance) {
         return;
     }
     // Register commands for all of the public methods in the RoboFile.
     $commandFactory = $container->get('commandFactory');
     $commandList = $commandFactory->createCommandsFromClass($roboCommandFileInstance);
     foreach ($commandList as $command) {
         $app->add($command);
     }
     return $roboCommandFileInstance;
 }
Пример #4
0
 public function testCommandNaming()
 {
     $this->assertNotNull($this->app->find('generate:user-avatar'));
 }
Пример #5
0
 protected function createCommand($name)
 {
     return $this->app->createCommand(new \Robo\TaskInfo(self::ROBOFILE, $name));
 }