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;
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);

View file

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