From 7e71e2ec7bae1f0fb6b144265325833881ba8228 Mon Sep 17 00:00:00 2001 From: Marco Vito Moscaritolo Date: Sun, 31 May 2015 11:43:21 +0200 Subject: [PATCH] User services in rebuild command. --- PHPCI/Command/RebuildCommand.php | 15 +++++++++------ services.yml | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/PHPCI/Command/RebuildCommand.php b/PHPCI/Command/RebuildCommand.php index 1ed474d2..fc9ef0ab 100644 --- a/PHPCI/Command/RebuildCommand.php +++ b/PHPCI/Command/RebuildCommand.php @@ -56,13 +56,19 @@ class RebuildCommand extends Command */ 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(); $this->logger = $logger; $this->buildStore = $buildStore; $this->buildService = $buildService; + $this->runCommand = $runCommand; } protected function configure() @@ -77,11 +83,8 @@ class RebuildCommand extends Command */ protected function execute(InputInterface $input, OutputInterface $output) { - $runner = new RunCommand($this->logger); - $runner->setMaxBuilds(1); - $runner->setDaemon(false); - - $service = new BuildService($this->buildStore); + $this->runCommand->setMaxBuilds(1); + $this->runCommand->setDaemon(false); $builds = $this->buildStore->getLatestBuilds(null, 1); $lastBuild = array_shift($builds); diff --git a/services.yml b/services.yml index 42c96463..d66f3f47 100644 --- a/services.yml +++ b/services.yml @@ -81,6 +81,7 @@ services: - @console.logger - @storage.build - @service.build + - @console.command.run console.command.update: class: PHPCI\Command\UpdateCommand arguments: