Пример #1
0
 /**
  * @param \Lightwerk\SurfCaptain\Domain\Facet\Deployment\GitRepositoryDeployment
  * @return \Lightwerk\SurfCaptain\Domain\Model\Deployment
  * @throws \Lightwerk\SurfCaptain\Domain\Repository\Preset\Exception
  * @throws \Lightwerk\SurfCaptain\GitApi\Exception
  */
 public function createFromGitRepositoryDeployment(GitRepositoryDeployment $gitRepositoryDeployment)
 {
     $preset = $this->presetRepository->findByIdentifier($gitRepositoryDeployment->getPresetKey());
     $postset = array();
     if ($gitRepositoryDeployment->getContext() !== '') {
         $postset['applications'][0]['options']['context'] = $gitRepositoryDeployment->getContext();
     }
     if ($gitRepositoryDeployment->getDeploymentPath() !== '') {
         $postset['applications'][0]['options']['deploymentPath'] = $gitRepositoryDeployment->getDeploymentPath();
     }
     if ($gitRepositoryDeployment->getSha() !== '') {
         $postset['applications'][0]['options']['sha1'] = $gitRepositoryDeployment->getSha();
     } elseif ($gitRepositoryDeployment->getTag() !== '') {
         $postset['applications'][0]['options']['tag'] = $gitRepositoryDeployment->getTag();
     } else {
         $postset['applications'][0]['options']['branch'] = $gitRepositoryDeployment->getBranch();
     }
     $postset['applications'][0]['type'] = $gitRepositoryDeployment->getDeploymentType();
     $configuration = \TYPO3\Flow\Utility\Arrays::arrayMergeRecursiveOverrule($preset, $postset);
     return $this->createFromConfiguration($configuration);
 }
 /**
  * @param string $presetKey 
  * @param string $type
  * @param string $branch
  * @return void
  */
 public function createGitRepositoryDeploymentCommand($presetKey, $type = 'TYPO3\\CMS\\Deploy', $branch = 'master')
 {
     $gitRepositoryDeployment = new GitRepositoryDeployment();
     $gitRepositoryDeployment->setPresetKey($presetKey);
     $gitRepositoryDeployment->setDeploymentType($type);
     $gitRepositoryDeployment->setBranch($branch);
     try {
         $deployment = $this->deploymentFactory->createFromGitRepositoryDeployment($gitRepositoryDeployment);
         $this->deploymentRepository->add($deployment);
         $this->outputLine('OK: deployment added');
     } catch (\Lightwerk\SurfCaptain\Exception $e) {
         $this->outputLine('ERROR: ' . $e->getMessage() . ' - ' . $e->getCode());
     } catch (\TYPO3\Flow\Http\Exception $e) {
         $this->outputLine('ERROR: ' . $e->getMessage() . ' - ' . $e->getCode());
     }
 }