Beispiel #1
0
 /**
  * @param TaskDefinition $taskDef
  * @return AntTarget|GitResetHardPullProduction
  * @throws InvalidArgumentException
  */
 public static function getTask(TaskDefinition $taskDef)
 {
     switch ($taskDef->getType()) {
         case TasksEnum::GIT_RESET_HARD_PULLPRODUCTION:
             return new GitResetHardPullProduction($taskDef->getName(), $taskDef->getWorkingDir());
         case TasksEnum::ANT_TARGET:
             return new AntTarget($taskDef->getName(), $taskDef->getWorkingDir(), $taskDef->getProperty(AntTarget::TARGET));
         default:
             throw new InvalidArgumentException('Invalid Task: ' . $taskDef->getType());
     }
 }
Beispiel #2
0
 /**
  * @param $project
  */
 public function runProject($project, $branch = '')
 {
     $results = ['project' => $project, 'branch' => $branch];
     foreach ($this->getProjectTaskDefs($project, $branch) as $taskDefs) {
         foreach ($taskDefs as $name => $taskDefArray) {
             $task = Factory::getTask(TaskDefinition::createFromArray($name, $taskDefArray));
             $results['tasks'][$task->getName()] = $task->run();
         }
     }
     return $results;
 }