/**
  * Show Command
  *
  * @param string $url
  * @return void
  */
 public function showCommand($url = 'git@github.com:achimfritz/championship-distribution.git')
 {
     $repository = $this->driverComposite->getRepository($url);
     $this->outputLine('repositoryUrl: ' . $repository->getRepositoryUrl());
     $this->outputLine('name: ' . $repository->getName());
     $this->outputLine('webUrl: ' . $repository->getWebUrl());
     $this->outputLine('branches');
     $branches = $repository->getBranches();
     if (count($branches) === 0) {
         $this->outputLine('no branches found');
     } else {
         foreach ($branches as $branch) {
             $commit = $branch->getCommit();
             $this->outputLine($branch->getName() . ' ' . $commit->getId() . ' ' . $commit->getMessage() . ' ' . $commit->getCommitterName() . ' ' . $commit->getDate());
         }
     }
     $this->outputLine('tags');
     $tags = $repository->getTags();
     if (count($tags) === 0) {
         $this->outputLine('no tags found');
     } else {
         foreach ($tags as $tag) {
             $commit = $tag->getCommit();
             $this->outputLine($tag->getName() . ' ' . $commit->getId() . ' ' . $commit->getMessage() . ' ' . $commit->getCommitterName() . ' ' . $commit->getDate());
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Load the presets.
  *
  * @return array $presets
  * @throws Exception
  */
 protected function loadPresets()
 {
     if (!isset($this->presets)) {
         $this->presets = json_decode($this->driverComposite->getFileContent($this->settings['repositoryUrl'], $this->settings['filePath']), TRUE);
         if (empty($this->presets)) {
             throw new Exception('Could not load presets', 1407782202);
         }
     }
     return $this->presets;
 }
Ejemplo n.º 3
0
 /**
  * @return void
  */
 public function listAction()
 {
     try {
         $this->view->assign('repositories', $this->driverComposite->getRepositories());
     } 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);
     }
 }
Ejemplo n.º 4
0
 /**
  * Returns the form definitions for the step
  *
  * @param \TYPO3\Form\Core\Model\FormDefinition $formDefinition
  * @return void
  */
 protected function buildForm(\TYPO3\Form\Core\Model\FormDefinition $formDefinition)
 {
     $page1 = $formDefinition->createPage('page1');
     $page1->setRenderingOption('header', 'Verification Git Configuration');
     $verificationSection = $page1->createElement('verificationSection', 'TYPO3.Form:Section');
     $verificationSection->setLabel('Tried to fetch your git repositories.');
     $result = $verificationSection->createElement('result', 'TYPO3.Form:StaticText');
     try {
         $repositories = $this->driverComposite->getRepositories();
         $result->setProperty('text', 'Success: found ' . count($repositories) . ' repositories');
         $result->setProperty('elementClassAttribute', 'alert alert-success');
     } catch (\Lightwerk\SurfCaptain\Exception $e) {
         $result->setProperty('text', 'Failed with error ' . $e->getMessage() . ' - ' . $e->getCode());
         $result->setProperty('elementClassAttribute', 'alert alert-error');
     } catch (\TYPO3\Flow\Http\Exception $e) {
         $result->setProperty('text', 'Failed with error ' . $e->getMessage() . ' - ' . $e->getCode());
         $result->setProperty('elementClassAttribute', 'alert alert-error');
     }
 }
Ejemplo n.º 5
0
 /**
  * @param array
  * @return \Lightwerk\SurfCaptain\Domain\Model\Deployment
  */
 protected function createFromConfiguration($configuration)
 {
     $repositoryUrl = $configuration['applications'][0]['options']['repositoryUrl'];
     $repository = $this->driverComposite->getRepository($repositoryUrl);
     $deployment = new Deployment();
     $deployment->setRepositoryIdentifier($repository->getIdentifier());
     $deployment->setRepositoryUrl($repositoryUrl);
     $deployment->setStaticConfiguration($configuration);
     // throw the clientIp away?
     $deployment->setClientIp('');
     return $deployment;
 }
Ejemplo n.º 6
0
 /**
  * @return Repository|NULL
  */
 public function getRepository()
 {
     // ToDo lw-lm: Find better way to do that (Flow/Inject annotation?)
     // TODO refactor $this->repository, $this->configuration and $this->getOptions()
     if ($this->repository === NULL) {
         $repositoryUrl = $this->getRepositoryUrl();
         if (!empty($repositoryUrl)) {
             try {
                 $this->repository = $this->driverComposite->getRepository($repositoryUrl);
             } catch (\Exception $e) {
                 $this->repository = FALSE;
             }
         }
     }
     return $this->repository ?: NULL;
 }
Ejemplo n.º 7
0
 /**
  * @test
  * @return void
  * @expectedException \Lightwerk\SurfCaptain\GitApi\Exception
  */
 public function resolveClassNameThrowsExceptionIfNeitherClassNameNorDriverIsGiven()
 {
     $source = array('foo' => 'bar');
     $this->driverCompositeMock->_call('resolveClassName', $source, 'foo');
 }