Fixed namespaces (PHPCI -> PHPCensor)
This commit is contained in:
parent
60d74b0b44
commit
60a2b7282a
238 changed files with 1014 additions and 863 deletions
93
src/PHPCensor/Command/RebuildCommand.php
Normal file
93
src/PHPCensor/Command/RebuildCommand.php
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPCI - Continuous Integration for PHP
|
||||
*
|
||||
* @copyright Copyright 2014, Block 8 Limited.
|
||||
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
|
||||
* @link https://www.phptesting.org/
|
||||
*/
|
||||
|
||||
namespace PHPCensor\Command;
|
||||
|
||||
use b8\Store\Factory;
|
||||
use Monolog\Logger;
|
||||
use PHPCensor\Service\BuildService;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\ArgvInput;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
/**
|
||||
* Re-runs the last run build.
|
||||
* @author Dan Cryer <dan@block8.co.uk>
|
||||
* @package PHPCI
|
||||
* @subpackage Console
|
||||
*/
|
||||
class RebuildCommand extends Command
|
||||
{
|
||||
/**
|
||||
* @var Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* @var OutputInterface
|
||||
*/
|
||||
protected $output;
|
||||
|
||||
/**
|
||||
* @var boolean
|
||||
*/
|
||||
protected $run;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $sleep;
|
||||
|
||||
/**
|
||||
* @param \Monolog\Logger $logger
|
||||
* @param string $name
|
||||
*/
|
||||
public function __construct(Logger $logger, $name = null)
|
||||
{
|
||||
parent::__construct($name);
|
||||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setName('phpci:rebuild')
|
||||
->setDescription('Re-runs the last run build.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Loops through running.
|
||||
*/
|
||||
protected function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$runner = new RunCommand($this->logger);
|
||||
$runner->setMaxBuilds(1);
|
||||
$runner->setDaemon(false);
|
||||
|
||||
/** @var \PHPCI\Store\BuildStore $store */
|
||||
$store = Factory::getStore('Build');
|
||||
$service = new BuildService($store);
|
||||
|
||||
$builds = $store->getLatestBuilds(null, 1);
|
||||
$lastBuild = array_shift($builds);
|
||||
$service->createDuplicateBuild($lastBuild);
|
||||
|
||||
$runner->run(new ArgvInput([]), $output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when log entries are made in Builder / the plugins.
|
||||
* @see \PHPCI\Builder::log()
|
||||
*/
|
||||
public function logCallback($log)
|
||||
{
|
||||
$this->output->writeln($log);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue