示例#1
0
 /**
  * @param Application $console
  * @param Console\Input\InputInterface $input
  * @param Console\Output\OutputInterface $output
  */
 public function __construct(Application $console, Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
 {
     $this->console = $console;
     $this->input = $input;
     $this->output = $output;
     $this->collections = new Collection\Collection();
     $this->collections['tasks'] = new Task\TaskCollection();
     $this->collections['scenarios'] = new Task\Scenario\ScenarioCollection();
     $this->collections['servers'] = new Server\ServerCollection();
     $this->collections['environments'] = new Server\EnvironmentCollection();
     $this->collections['parameters'] = new Collection\Collection();
     $this->stageStrategy = new StageStrategy($this->servers, $this->environments);
     self::$instance = $this;
 }
示例#2
0
 /**
  * @param Application $console
  * @param Console\Input\InputInterface $input
  * @param Console\Output\OutputInterface $output
  */
 public function __construct(Application $console, Console\Input\InputInterface $input, Console\Output\OutputInterface $output)
 {
     parent::__construct();
     /******************************
      *           Console          *
      ******************************/
     $this['console'] = function () use($console) {
         return $console;
     };
     $this['input'] = function () use($input) {
         return $input;
     };
     $this['output'] = function () use($output) {
         return $output;
     };
     /******************************
      *           Config           *
      ******************************/
     $this['config'] = function () {
         return new Collection();
     };
     $this->config['ssh_type'] = 'phpseclib';
     $this->config['default_stage'] = null;
     /******************************
      *            Core            *
      ******************************/
     $this['tasks'] = function () {
         return new Task\TaskCollection();
     };
     $this['servers'] = function () {
         return new Server\ServerCollection();
     };
     $this['environments'] = function () {
         return new Server\EnvironmentCollection();
     };
     $this['scriptManager'] = function ($c) {
         return new Task\ScriptManager($c['tasks']);
     };
     $this['stageStrategy'] = function ($c) {
         return new StageStrategy($c['servers'], $c['environments'], $c['config']['default_stage']);
     };
     $this['onFailure'] = function () {
         return new Collection();
     };
     /******************************
      *           Logger           *
      ******************************/
     $this['log_level'] = Logger::DEBUG;
     $this['log_handler'] = function () {
         return isset($this->config['log_file']) ? new StreamHandler($this->config['log_file'], $this['log_level']) : new NullHandler($this['log_level']);
     };
     $this['log'] = function () {
         $name = isset($this->config['log_name']) ? $this->config['log_name'] : 'Deployer';
         return new Logger($name, [$this['log_handler']]);
     };
     /******************************
      *        Init command        *
      ******************************/
     $this['init_command'] = function () {
         return new InitCommand();
     };
     self::$instance = $this;
 }