registerRequests() public method

public registerRequests ( $list )
Ejemplo n.º 1
0
 protected function configure()
 {
     $this->setName('init');
     $this->setDescription('Setup a new project configuration in the current directory');
     $this->setHelp('The <comment>init</comment> interactive task can be used to setup a new project');
     // Create an information collector and configure the different information request
     $this->informationCollector = new \Liip\RMT\Information\InformationCollector();
     $this->informationCollector->registerRequests(array(new InformationRequest('vcs', array('description' => 'The VCS system to use', 'type' => 'choice', 'choices' => array('git', 'hg', 'none'), 'choices_shortcuts' => array('g' => 'git', 'h' => 'hg', 'n' => 'none'), 'default' => 'none')), new InformationRequest('persister', array('description' => 'The strategy to use to persist the current version value', 'type' => 'choice', 'choices' => array('vcs-tag', 'changelog', 'composer'), 'choices_shortcuts' => array('t' => 'vcs-tag', 'c' => 'composer', 'l' => 'changelog'), 'command_argument' => true, 'interactive' => true))));
     foreach ($this->informationCollector->getCommandOptions() as $option) {
         $this->getDefinition()->addOption($option);
     }
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 protected function configure()
 {
     $this->setName('init');
     $this->setDescription('Setup a new project configuration in the current directory');
     $this->setHelp('The <comment>init</comment> interactive task can be used to setup a new project');
     // Add an option to force re-creation of the config file
     $this->getDefinition()->addOption(new InputOption('force', null, InputOption::VALUE_NONE, 'Force update of the config file'));
     // Create an information collector and configure the different information request
     $this->informationCollector = new InformationCollector();
     $this->informationCollector->registerRequests(array(new InformationRequest('configonly', array('description' => 'if you want to skip creation of the RMT convenience script', 'type' => 'yes-no', 'command_argument' => true, 'interactive' => true, 'default' => 'n')), new InformationRequest('vcs', array('description' => 'The VCS system to use', 'type' => 'choice', 'choices' => array('git', 'hg', 'none'), 'choices_shortcuts' => array('g' => 'git', 'h' => 'hg', 'n' => 'none'), 'default' => 'none')), new InformationRequest('generator', array('description' => 'The generator to use for version incrementing', 'type' => 'choice', 'choices' => array('semantic-versioning', 'basic-increment'), 'choices_shortcuts' => array('s' => 'semantic-versioning', 'b' => 'basic-increment'))), new InformationRequest('persister', array('description' => 'The strategy to use to persist the current version value', 'type' => 'choice', 'choices' => array('vcs-tag', 'changelog'), 'choices_shortcuts' => array('t' => 'vcs-tag', 'c' => 'changelog'), 'command_argument' => true, 'interactive' => true))));
     foreach ($this->informationCollector->getCommandOptions() as $option) {
         $this->getDefinition()->addOption($option);
     }
 }
 public function testRegisterRequests()
 {
     $ic = new InformationCollector();
     $this->assertFalse($ic->hasRequest('foo') || $ic->hasRequest('type'));
     $ic->registerRequests(array(new InformationRequest('foo'), 'type'));
     $this->assertTrue($ic->hasRequest('foo'));
     $this->assertTrue($ic->hasRequest('type'));
 }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
 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);
 }
Ejemplo n.º 6
0
 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);
 }