/** * Ensures that the composer file is extended with the rmt config data. * */ public function testInitConfig() { copy(__DIR__ . '/composer_no_rmt.json', $this->tempDir . '/composer.json'); $helper = new \Liip\RMT\Helpers\ComposerConfig(); $helper->setComposerFile($this->tempDir . '/composer.json'); $this->assertNull($helper->getRMTConfigSection()); exec('./RMT init --vcs=git --persister=vcs-tag -n', $output, $returnVar); $this->assertEquals(0, $returnVar); $config = $helper->getRMTConfigSection(); $this->assertNotNull($config); $this->assertEquals('git', $config->getVcs()); $this->assertEquals('vcs-tag', $config->getVersionPersister()); }
/** * * @param type $generator * @param type $persister * @param type $otherConfig */ protected function createJsonConfig($generator, $persister, $otherConfig = array()) { $helper = new \Liip\RMT\Helpers\ComposerConfig(); $helper->setComposerFile($this->tempDir . '/composer.json'); $allConfig = array_merge($otherConfig, array('versionPersister' => $persister)); $config = \Liip\RMT\Config::create($allConfig); $helper->addRMTConfigSection($config); return $helper->getRMTConfigSection(); }
protected function initialize(InputInterface $input, OutputInterface $output) { $this->informationCollector->handleCommandInput($input); $this->writeBigTitle('Welcome to Release Manager Initialization'); $this->writeEmptyLine(); // Guessing elements path $this->buildPaths(); // Security check $helper = new \Liip\RMT\Helpers\ComposerConfig($this->getContext()); $section = $helper->getRMTConfigSection(); if ($section !== null) { throw new \Exception('A config section "extra/rmt" already exists in composer json.'); } }