/**
  * @param string $identifier 
  * @return void
  */
 public function showCommand($key)
 {
     try {
         $preset = $this->presetRepository->findByIdentifier($key);
         $this->outputLine(print_r($preset, TRUE));
     } catch (\Lightwerk\SurfCaptain\Domain\Repository\Preset\Exception $e) {
         $this->outputLine('ERROR: ' . $e->getMessage . ' - ' . $e->getCode());
     }
 }
 /**
  * @param string $key
  * @throws \TYPO3\Flow\Persistence\Exception\IllegalObjectTypeException
  * @return void
  */
 public function createAction($key)
 {
     $configuration = $this->presetRepository->findByIdentifier($key);
     $deployment = new Deployment();
     $deployment->setConfiguration($configuration);
     $deployment->setClientIp($this->request->getHttpRequest()->getClientIpAddress());
     $this->deploymentRepository->add($deployment);
     $this->addFlashMessage('Created a new deployment.');
     $this->redirect('index', NULL, NULL, array('deployment' => $deployment));
 }
 /**
  * @param string $repositoryUrl
  * @return void
  */
 public function showAction($repositoryUrl)
 {
     try {
         $repository = $this->driverComposite->getRepository($repositoryUrl)->setDeployments($this->deploymentRepository->findByRepositoryUrl($repositoryUrl))->setPresets($this->presetRepository->findByRepositoryUrl($repositoryUrl));
         $this->view->assign('repository', $repository);
     } catch (\Lightwerk\SurfCaptain\Service\Exception $e) {
         $this->handleException($e);
     } catch (\Lightwerk\SurfCaptain\GitApi\Exception $e) {
         $this->handleException($e);
     } catch (\TYPO3\Flow\Http\Exception $e) {
         $this->handleException($e);
     }
 }
 /**
  * @param string $key
  * @return void
  */
 public function deleteAction($key)
 {
     try {
         $this->presetRepository->remove($key);
         $this->addFlashMessage('Deleted a preset.');
         $this->redirect('list');
     } catch (\Lightwerk\SurfCaptain\Service\Exception $e) {
         $this->handleException($e);
     } catch (\TYPO3\Flow\Http\Exception $e) {
         $this->handleException($e);
     }
 }
 /**
  * @param string $key 
  * @param string $type
  * @param string $context 
  * @param string $branch 
  * @return void
  */
 public function createCommand($key, $type = 'TYPO3\\CMS\\Deploy', $context = 'Development', $branch = 'master')
 {
     $deployment = new Deployment();
     $deployment->setClientIp('127.0.0.1');
     try {
         $preset = $this->presetRepository->findByIdentifier($key);
     } catch (\Lightwerk\Surfcaptain\Exception $e) {
         $this->outputLine('cannot get preset');
         $this->quit();
     }
     $preset['applications'][0]['options']['branch'] = $branch;
     $preset['applications'][0]['options']['context'] = $context;
     $preset['applications'][0]['type'] = $type;
     if ($deployment->getRepository() !== NULL) {
         $this->deploymentRepository->add($deployment);
         $this->outputLine('SUCCESS: deployment created');
     } else {
         $this->outputLine('ERROR: no repository');
     }
 }
 /**
  * @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);
 }