Moved commands to Application from console.php
This commit is contained in:
parent
9d5fcf6834
commit
bcfc5578de
23
bin/console
23
bin/console
|
@ -9,16 +9,6 @@
|
|||
* @link http://www.phptesting.org/
|
||||
*/
|
||||
|
||||
use PHPCensor\Command\RunCommand;
|
||||
use PHPCensor\Command\RebuildCommand;
|
||||
use PHPCensor\Command\InstallCommand;
|
||||
use PHPCensor\Command\PollCommand;
|
||||
use PHPCensor\Command\CreateAdminCommand;
|
||||
use PHPCensor\Command\CreateBuildCommand;
|
||||
use PHPCensor\Command\WorkerCommand;
|
||||
use PHPCensor\Command\RebuildQueueCommand;
|
||||
use PHPCensor\Service\BuildService;
|
||||
use b8\Store\Factory;
|
||||
use PHPCensor\Console\Application;
|
||||
|
||||
define('IS_CONSOLE', true);
|
||||
|
@ -28,15 +18,4 @@ ini_set('display_errors', 1);
|
|||
|
||||
require_once(dirname(__DIR__) . '/bootstrap.php');
|
||||
|
||||
$application = new Application();
|
||||
|
||||
$application->add(new RunCommand($loggerConfig->getFor('RunCommand')));
|
||||
$application->add(new RebuildCommand($loggerConfig->getFor('RunCommand')));
|
||||
$application->add(new InstallCommand);
|
||||
$application->add(new PollCommand($loggerConfig->getFor('PollCommand')));
|
||||
$application->add(new CreateAdminCommand(Factory::getStore('User')));
|
||||
$application->add(new CreateBuildCommand(Factory::getStore('Project'), new BuildService(Factory::getStore('Build'))));
|
||||
$application->add(new WorkerCommand($loggerConfig->getFor('WorkerCommand')));
|
||||
$application->add(new RebuildQueueCommand($loggerConfig->getFor('RebuildQueueCommand')));
|
||||
|
||||
$application->run();
|
||||
(new Application())->run();
|
||||
|
|
|
@ -39,6 +39,7 @@ class CreateBuildCommand extends Command
|
|||
|
||||
/**
|
||||
* @param ProjectStore $projectStore
|
||||
* @param BuildService $buildService
|
||||
*/
|
||||
public function __construct(ProjectStore $projectStore, BuildService $buildService)
|
||||
{
|
||||
|
|
|
@ -3,6 +3,20 @@
|
|||
namespace PHPCensor\Console;
|
||||
|
||||
use b8\Config;
|
||||
use b8\Store\Factory;
|
||||
use PHPCensor\Command\CreateAdminCommand;
|
||||
use PHPCensor\Command\CreateBuildCommand;
|
||||
use PHPCensor\Command\InstallCommand;
|
||||
use PHPCensor\Command\PollCommand;
|
||||
use PHPCensor\Command\RebuildCommand;
|
||||
use PHPCensor\Command\RebuildQueueCommand;
|
||||
use PHPCensor\Command\RunCommand;
|
||||
use PHPCensor\Command\WorkerCommand;
|
||||
use PHPCensor\Logging\LoggerConfig;
|
||||
use PHPCensor\Service\BuildService;
|
||||
use PHPCensor\Store\BuildStore;
|
||||
use PHPCensor\Store\ProjectStore;
|
||||
use PHPCensor\Store\UserStore;
|
||||
use Symfony\Component\Console\Application as BaseApplication;
|
||||
use Phinx\Console\Command\Create;
|
||||
use Phinx\Console\Command\Migrate;
|
||||
|
@ -10,15 +24,21 @@ use Phinx\Console\Command\Rollback;
|
|||
use Phinx\Console\Command\Status;
|
||||
use Phinx\Config\Config as PhinxConfig;
|
||||
|
||||
/**
|
||||
* Class Application
|
||||
*
|
||||
* @package PHPCensor\Console
|
||||
*/
|
||||
class Application extends BaseApplication
|
||||
{
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param string $name The name of the application
|
||||
* @param string $version The version of the application
|
||||
* @param string $name The name of the application
|
||||
* @param string $version The version of the application
|
||||
* @param LoggerConfig $loggerConfig Logger config
|
||||
*/
|
||||
public function __construct($name = 'PHP Censor - Continuous Integration for PHP', $version = '')
|
||||
public function __construct($name = 'PHP Censor - Continuous Integration for PHP', $version = '', LoggerConfig $loggerConfig = null)
|
||||
{
|
||||
parent::__construct($name, $version);
|
||||
|
||||
|
@ -68,5 +88,23 @@ class Application extends BaseApplication
|
|||
->setConfig($phinxConfig)
|
||||
->setName('php-censor-migrations:status')
|
||||
);
|
||||
|
||||
/** @var UserStore $userStore */
|
||||
$userStore = Factory::getStore('User');
|
||||
|
||||
/** @var ProjectStore $projectStore */
|
||||
$projectStore = Factory::getStore('Project');
|
||||
|
||||
/** @var BuildStore $buildStore */
|
||||
$buildStore = Factory::getStore('Build');
|
||||
|
||||
$this->add(new RunCommand($loggerConfig->getFor('RunCommand')));
|
||||
$this->add(new RebuildCommand($loggerConfig->getFor('RunCommand')));
|
||||
$this->add(new InstallCommand());
|
||||
$this->add(new PollCommand($loggerConfig->getFor('PollCommand')));
|
||||
$this->add(new CreateAdminCommand($userStore));
|
||||
$this->add(new CreateBuildCommand($projectStore, new BuildService($buildStore)));
|
||||
$this->add(new WorkerCommand($loggerConfig->getFor('WorkerCommand')));
|
||||
$this->add(new RebuildQueueCommand($loggerConfig->getFor('RebuildQueueCommand')));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue