protected function loadInformationCollector() { $ic = new InformationCollector(); // Register options of all lists (prerequistes and actions) foreach (array('prerequisites', 'preReleaseActions', 'postReleaseActions') as $listName) { foreach ($this->getContext()->getList($listName) as $listItem) { $ic->registerRequests($listItem->getInformationRequests()); } } $this->getContext()->setService('information-collector', $ic); }
protected function initialize(InputInterface $input, OutputInterface $output) { $this->assertTaggingIsDisabled(); $ic = new InformationCollector(); $ic->registerStandardRequest('type'); $this->getContext()->setService('information-collector', $ic); $this->getContext()->setService('output', $this->output); $this->getContext()->getInformationCollector()->handleCommandInput($input); $currentVersion = $this->getContext()->getVersionDetector()->getCurrentVersion(); $this->getContext()->setParameter('current-version', $currentVersion); }
protected function loadInformationCollector() { $ic = new InformationCollector(); // Add a specific option if it's the first release $version = $this->getContext()->getVersionPersister()->getCurrentVersion(); if ($version->isInitial()) { $ic->registerRequest(new InformationRequest('confirm-first', array('description' => 'This is the first release for the current branch', 'type' => 'confirmation'))); } // the release task requires the type option $ic->registerStandardRequest('type'); // Register options of all lists (prerequistes and actions) foreach (array('prerequisites', 'preReleaseActions', 'postReleaseActions') as $listName) { foreach ($this->getContext()->getList($listName) as $listItem) { $ic->registerRequests($listItem->getInformationRequests()); } } $this->getContext()->setService('information-collector', $ic); }
/** * Returns initial config data. * * @return array */ public function getConfigData() { $config = array(); $vcs = $this->informationCollector->getValueFor('vcs'); if ($vcs !== 'none') { $config['vcs'] = $vcs; } $config['versionPersister'] = $this->informationCollector->getValueFor('persister'); return $config; }
protected function loadInformationCollector() { $ic = new InformationCollector(); // Add a specific option if it's the first release try { Context::get('version-persister')->getCurrentVersion(); } catch (\Liip\RMT\Exception\NoReleaseFoundException $e) { $ic->registerRequest(new InformationRequest('confirm-first', array('description' => 'This is the first release for the current branch', 'type' => 'confirmation'))); } catch (\Exception $e) { echo 'Error while trying to read the current version'; } // Register options of the release tasks $ic->registerRequests(Context::get('version-generator')->getInformationRequests()); $ic->registerRequests(Context::get('version-persister')->getInformationRequests()); // Register options of all lists (prerequistes and actions) foreach (array('prerequisites', 'pre-release-actions', 'post-release-actions') as $listName) { foreach (Context::getInstance()->getList($listName) as $listItem) { $ic->registerRequests($listItem->getInformationRequests()); } } Context::getInstance()->setService('information-collector', $ic); }
public function testGetValueForWithDefault() { $ic = new InformationCollector(); $this->assertEquals('bar', $ic->getValueFor('foo', 'bar')); }