* @package PHPCI * @subpackage Console */ class RunCommand extends Command { protected function configure() { $this ->setName('phpci:run-builds') ->setDescription('Run all pending PHPCI builds.'); } /** * Pulls all pending builds from the database and runs them. */ protected function execute(InputInterface $input, OutputInterface $output) { $this->output = $output; $store = Factory::getStore('Build'); $result = $store->getByStatus(0); foreach ($result['items'] as $build) { $build = BuildFactory::getBuild($build); if ($input->getOption('verbose')) { $builder = new Builder($build, array($this, 'logCallback')); } else { $builder = new Builder($build); } $builder->execute(); } } /** * Called when log entries are made in Builder / the plugins. * @see \PHPCI\Builder::log() */ public function logCallback($log) { $this->output->writeln($log); } }