예제 #1
0
 /**
  * Before running this task, register its rollback and completion
  * handlers on its collection. The reason this class exists is to
  * defer registration of rollback and completion tasks until 'run()' time.
  *
  * @return \Robo\Result
  */
 public function run()
 {
     if ($this->rollbackTask) {
         $this->collection->registerRollback($this->rollbackTask);
     }
     if ($this->task instanceof RollbackInterface) {
         $this->collection->registerRollback(new CallableTask([$this->task, 'rollback'], $this->task));
     }
     if ($this->task instanceof CompletionInterface) {
         $this->collection->registerCompletion(new CallableTask([$this->task, 'complete'], $this->task));
     }
     return $this->task->run();
 }
예제 #2
0
 /**
  * If there is a single task, run it; if there is a collection, run
  * all of its tasks.
  *
  * @return \Robo\Result
  */
 protected function runTasks()
 {
     if (!$this->collection && $this->currentTask) {
         return $this->currentTask->run();
     }
     return $this->getCollection()->run();
 }
예제 #3
0
 /**
  * @param \Robo\Result|\Robo\Contract\TaskInterface $result
  * @param \Consolidation\AnnotatedCommand\CommandData $commandData
  *
  * @return null|\Robo\Result
  */
 public function process($result, CommandData $commandData)
 {
     if ($result instanceof TaskInterface) {
         try {
             return $result->run();
         } catch (\Exception $e) {
             return Result::fromException($result, $e);
         }
     }
 }
예제 #4
0
파일: Collection.php 프로젝트: jjok/Robo
 /**
  * @param TaskInterface|NestedCollectionInterface|WrappedTaskInterface $task
  *
  * @return \Robo\Result
  */
 protected function runSubtask($task)
 {
     $original = $task instanceof WrappedTaskInterface ? $task->original() : $task;
     $this->setParentCollectionForTask($original, $this->getParentCollection());
     if ($original instanceof InflectionInterface) {
         $original->inflect($this);
     }
     $taskResult = $task->run();
     return $taskResult;
 }
예제 #5
0
파일: Base.php 프로젝트: GreenCape/robo
 /**
  * @param TaskInterface $task
  *
  * @return Result
  */
 private function runSilently(TaskInterface $task)
 {
     $this->suppressOutput();
     $result = $task->run();
     $this->restoreOutput();
     return $result;
 }