diff --git a/PHPCI/Command/DaemoniseCommand.php b/PHPCI/Command/DaemoniseCommand.php index f8cbc45b..b4d0295c 100644 --- a/PHPCI/Command/DaemoniseCommand.php +++ b/PHPCI/Command/DaemoniseCommand.php @@ -76,6 +76,7 @@ class DaemoniseCommand extends Command $this->run = true; $this->sleep = 0; $runner = new RunCommand($this->logger); + $runner->setBaxBuilds(1); $emptyInput = new ArgvInput(array()); diff --git a/PHPCI/Command/RunCommand.php b/PHPCI/Command/RunCommand.php index 318f9247..dc64aef9 100644 --- a/PHPCI/Command/RunCommand.php +++ b/PHPCI/Command/RunCommand.php @@ -42,6 +42,11 @@ class RunCommand extends Command */ protected $logger; + /** + * @var int + */ + protected $maxBuilds = null; + /** * @param \Monolog\Logger $logger * @param string $name @@ -52,7 +57,6 @@ class RunCommand extends Command $this->logger = $logger; } - protected function configure() { $this @@ -69,7 +73,7 @@ class RunCommand extends Command // For verbose mode we want to output all informational and above // messages to the symphony output interface. - if ($input->getOption('verbose')) { + if ($input->hasOption('verbose')) { $this->logger->pushHandler( new OutputLogHandler($this->output, Logger::INFO) ); @@ -79,7 +83,7 @@ class RunCommand extends Command $this->logger->addInfo("Finding builds to process"); $store = Factory::getStore('Build'); - $result = $store->getByStatus(0); + $result = $store->getByStatus(0, $this->maxBuilds); $this->logger->addInfo(sprintf("Found %d builds", count($result['items']))); $builds = 0; @@ -113,4 +117,9 @@ class RunCommand extends Command return $builds; } + + public function setBaxBuilds($numBuilds) + { + $this->maxBuilds = (int)$numBuilds; + } }