#!/usr/bin/env php
<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright    Copyright 2013, Block 8 Limited.
* @license      https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link         http://www.phptesting.org/
*/

define('PHPCI_IS_CONSOLE', true);

require('bootstrap.php');

use PHPCI\Command\RunCommand;
use PHPCI\Command\RebuildCommand;
use PHPCI\Command\GenerateCommand;
use PHPCI\Command\UpdateCommand;
use PHPCI\Command\InstallCommand;
use PHPCI\Command\DaemonCommand;
use PHPCI\Command\PollCommand;
use PHPCI\Command\CreateAdminCommand;
use PHPCI\Command\CreateBuildCommand;
use PHPCI\Command\WorkerCommand;
use PHPCI\Command\RebuildQueueCommand;
use PHPCI\Service\BuildService;
use Symfony\Component\Console\Application;
use b8\Store\Factory;

$application = new Application();

$application->add(new RunCommand($loggerConfig->getFor('RunCommand')));
$application->add(new RebuildCommand($loggerConfig->getFor('RunCommand')));
$application->add(new InstallCommand);
$application->add(new UpdateCommand($loggerConfig->getFor('UpdateCommand')));
$application->add(new GenerateCommand);
$application->add(new DaemonCommand($loggerConfig->getFor('DaemonCommand')));
$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();
