public function setUp() { $config = new \Liip\RMT\Helpers\ComposerConfig(); $file = __DIR__ . '/../../../../../../../composer.json'; $config->setComposerFile($file); $this->persister = new \Liip\RMT\Version\Persister\ComposerPersister(); $this->persister->setConfig($config); }
/** * * @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(); }
/** * 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()); }
protected function execute(InputInterface $input, OutputInterface $output) { // Create the executable task inside the project home $this->getOutput()->writeln("Creation of the new executable <info>{$this->executablePath}</info>"); file_put_contents($this->executablePath, "#!/usr/bin/env php\n" . "<?php define('RMT_ROOT_DIR', __DIR__); ?>\n" . "<?php require '{$this->commandPath}'; ?>\n"); exec('chmod +x RMT'); // Create the config file $composerHelper = new \Liip\RMT\Helpers\ComposerConfig(); $composerHelper->setComposerFile($this->configPath); $composerHelper->addRMTConfigSection(\Liip\RMT\Config::create($this->getConfigData())); $this->getOutput()->writeln("Added extra/rmt section to <info>{$this->configPath}</info>"); // Confirmation $this->writeBigTitle('Success, you can start using RMT by calling <info>RMT release</info>'); $this->writeEmptyLine(); }