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); }
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); }
/** * @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; }
public function testCommandNaming() { $this->assertNotNull($this->app->find('generate:user-avatar')); }
protected function createCommand($name) { return $this->app->createCommand(new \Robo\TaskInfo(self::ROBOFILE, $name)); }