Inheritance: extends Symfony\Component\Console\Application
Beispiel #1
0
 /**
  * @return null|string
  */
 public function getCustomTemplate($domain)
 {
     $config = $this->application->getConfig();
     if ('pull-request-create' === $domain && null !== $config && $config->has('table-pr')) {
         return 'custom';
     }
     return;
 }
 /**
  * {@inheritdoc}
  *
  * Overwritten so the helpers can be mocked.
  * This method is called within the constructor so setting it later
  * will not give the expected result.
  *
  * @return \Symfony\Component\Console\Helper\HelperSet
  */
 protected function getDefaultHelperSet()
 {
     $helperSet = parent::getDefaultHelperSet();
     $callback = $this->helperSetManipulator;
     $callback($helperSet);
     return $helperSet;
 }
 /**
  * @param array|string $input
  */
 private function setExpectedApplicationInput($input)
 {
     if (is_array($input)) {
         $input = implode("\n", $input);
     }
     $helper = $this->application->getHelperSet()->get('gush_question');
     $helper->setInputStream($this->getInputStream($input));
 }
 /**
  * {@inheritdoc}
  *
  * @throws \RuntimeException when fields structure is invalid
  */
 public function getRequirements()
 {
     $fields = $this->application->getConfig()->get('table-pr') ?: [];
     $fields['description'] = ['Description', ''];
     if (count($fields) < 2) {
         throw new \RuntimeException('table-pr structure requires at least one row, please check your local .gush.yml');
     }
     foreach ($fields as $name => $rowData) {
         if (!is_string($name)) {
             throw new \RuntimeException('table-pr table row-name must be a string, please check your local .gush.yml');
         }
         if (!is_array($rowData) || count($rowData) != 2) {
             throw new \RuntimeException(sprintf('table-pr table row-data "%s" must be an array with at least two values like: ' . '[Label, default value].' . PHP_EOL . 'please check your local .gush.yml', $name));
         }
     }
     return $fields;
 }
Beispiel #5
0
 /**
  * Ensure the remote exist for the org and repo.
  *
  * @param string $org
  * @param string $repo
  */
 public function ensureRemoteExists($org, $repo)
 {
     $adapter = $this->application->getAdapter();
     $pushUrl = $adapter->getRepositoryInfo($org, $repo)['push_url'];
     if (!$this->remoteExists($org, $pushUrl)) {
         $this->getHelperSet()->get('gush_style')->note(sprintf('Adding remote "%s" with "%s".', $org, $pushUrl));
         $this->setRemote($org, $pushUrl, $pushUrl);
     }
 }