示例#1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->getConfig()->set('meta-header', $this->getMetaHeader(), Config::CONFIG_LOCAL);
     ConfigFactory::dumpToFile($this->getConfig(), Config::CONFIG_LOCAL);
     $this->getHelper('gush_style')->success('Configuration file saved successfully.');
     return self::COMMAND_SUCCESS;
 }
示例#2
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var \Gush\Application $application */
     $application = $this->getApplication();
     $config = $application->getConfig();
     $valid = true;
     $styleHelper = $this->getHelper('gush_style');
     $adapters = $this->getAdapters();
     $repositoryManagers = $adapters[0];
     $issueTrackers = $adapters[1];
     $repositoryManager = GitHelper::undefinedToDefault($input->getOption('repo-adapter'));
     $issueTracker = GitHelper::undefinedToDefault($input->getOption('issue-adapter'));
     $org = GitHelper::undefinedToDefault($input->getOption('org'));
     $repo = GitHelper::undefinedToDefault($input->getOption('repo'));
     $issueOrg = GitHelper::undefinedToDefault($input->getOption('issue-org'), $org);
     $issueRepo = GitHelper::undefinedToDefault($input->getOption('issue-project'), $repo);
     $this->validateAdapter($repositoryManager, $repositoryManagers, 'Repository-manager', $valid);
     $this->validateAdapter($issueTracker, $issueTrackers, 'Issue-tracker', $valid);
     if (!$valid) {
         return self::COMMAND_FAILURE;
     }
     $this->checkAdapterConfigured($repositoryManager, $repositoryManagers[$repositoryManager], 'Repository-manager', $valid);
     $this->checkAdapterConfigured($issueTracker, $issueTrackers[$issueTracker], 'Issue-tracker', $valid);
     if (!$valid) {
         if ($input->isInteractive() && $styleHelper->confirm('Would you like to configure the missing adapters now?')) {
             $application->doRun(new ArrayInput(['command' => 'core:configure']), $output);
         } else {
             $styleHelper->note(['You cannot use the selected repository-manager and/or issue-tracker until its configured.', 'Run the "core:configure" command to configure the adapters.']);
         }
     }
     $params = ['repo_adapter' => $repositoryManager, 'issue_tracker' => $issueTracker, 'repo_org' => $org, 'repo_name' => $repo, 'issue_project_org' => $issueOrg, 'issue_project_name' => $issueRepo];
     $config->merge($params, Config::CONFIG_LOCAL);
     ConfigFactory::dumpToFile($config, Config::CONFIG_LOCAL);
     $styleHelper->success('Configuration file saved successfully.');
     return self::COMMAND_SUCCESS;
 }
示例#3
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     ConfigFactory::dumpToFile($this->getConfig(), Config::CONFIG_SYSTEM);
     $this->getHelper('gush_style')->success('Configuration file saved successfully.');
     return self::COMMAND_SUCCESS;
 }
示例#4
0
 public function testDumpConfigToLocalFile()
 {
     $localDir = $this->getNewTmpFolder('gush-local');
     $config = ConfigFactory::createConfig($localDir);
     $config->merge(['adapter' => 'bitbucket'], Config::CONFIG_LOCAL);
     $this->assertFileNotExists($localDir . '/.gush.yml');
     ConfigFactory::dumpToFile($config, Config::CONFIG_LOCAL);
     ConfigFactory::dumpToFile($config, Config::CONFIG_SYSTEM);
     $this->assertFileExists($localDir . '/.gush.yml');
     $this->assertEquals(['adapter' => 'bitbucket'], Yaml::parse(file_get_contents($localDir . '/.gush.yml')));
     ConfigFactory::dumpToFile($config, Config::CONFIG_SYSTEM);
     $this->assertFileExists($this->homedir . '/.gush.yml');
     $this->assertEquals(['adapters' => []], Yaml::parse(file_get_contents($this->homedir . '/.gush.yml')));
 }