Ejemplo n.º 1
0
 /**
  * Execute tasks
  *
  * @return Deployer
  */
 public function execute()
 {
     \Deployer\Logger::start();
     $allTasks = sizeof($this->_tasks);
     $taskNum = 0;
     foreach ($this->_tasks as $task) {
         $taskNum++;
         try {
             $header = sprintf('Step %d of %d: %s', $taskNum, $allTasks, $task['info']);
             \Deployer::messageHeader($header);
             $task['taskObject']->execute()->log();
         } catch (\Deployer\TaskException $e) {
             self::criticalError(sprintf('%s: %s', $task['taskObject']->name(), $e->getMessage()));
         } catch (Exception $e) {
             self::criticalError(sprintf('%s in %s:%s', $e->getMessage(), $e->getFile(), $e->getLine()));
         }
     }
     \Deployer\CLI::writeLn();
     \Deployer\CLI::writeLn(sprintf('Complete. Execution time: %s', \Deployer\Logger::stamp()), \Deployer\CLI::FG_LIGHT_GREEN);
     return $this;
 }