User services in rebuild command.

This commit is contained in:
Marco Vito Moscaritolo 2015-05-31 11:43:21 +02:00
parent 6a43003f24
commit 7e71e2ec7b
2 changed files with 10 additions and 6 deletions

View file

@ -56,13 +56,19 @@ class RebuildCommand extends Command
*/ */
protected $buildService; protected $buildService;
public function __construct(Logger $logger, BuildStore $buildStore, BuildService $buildService) /**
* @param RunCommand
*/
protected $runCommand;
public function __construct(Logger $logger, BuildStore $buildStore, BuildService $buildService, RunCommand $runCommand)
{ {
parent::__construct(); parent::__construct();
$this->logger = $logger; $this->logger = $logger;
$this->buildStore = $buildStore; $this->buildStore = $buildStore;
$this->buildService = $buildService; $this->buildService = $buildService;
$this->runCommand = $runCommand;
} }
protected function configure() protected function configure()
@ -77,11 +83,8 @@ class RebuildCommand extends Command
*/ */
protected function execute(InputInterface $input, OutputInterface $output) protected function execute(InputInterface $input, OutputInterface $output)
{ {
$runner = new RunCommand($this->logger); $this->runCommand->setMaxBuilds(1);
$runner->setMaxBuilds(1); $this->runCommand->setDaemon(false);
$runner->setDaemon(false);
$service = new BuildService($this->buildStore);
$builds = $this->buildStore->getLatestBuilds(null, 1); $builds = $this->buildStore->getLatestBuilds(null, 1);
$lastBuild = array_shift($builds); $lastBuild = array_shift($builds);

View file

@ -81,6 +81,7 @@ services:
- @console.logger - @console.logger
- @storage.build - @storage.build
- @service.build - @service.build
- @console.command.run
console.command.update: console.command.update:
class: PHPCI\Command\UpdateCommand class: PHPCI\Command\UpdateCommand
arguments: arguments: