/**
  * Writes the passed config into the composer file.
  * 
  * @param Config $config
  * @return string the serialized json
  */
 public function addRMTConfigSection(Config $config)
 {
     $json = $this->getJson();
     if (!isset($json->extra)) {
         $json->extra = new \stdClass();
     }
     $json->extra->rmt = $config->toJson();
     return $this->save($json);
 }
示例#2
0
 public function testToJson()
 {
     $config = Config::create($this->getConfigData());
     $json = $config->toJson();
     $this->assertEquals('git', $json->vcs);
     $this->assertContains('working-copy-check', $json->prerequisites);
 }
 /**
  * 
  * @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 rmt config section can be added to the composer file.
  */
 public function testAddRmtConfigSection()
 {
     $config = \Liip\RMT\Config::create(array('vcs' => 'git', "prerequisites" => array("working-copy-check", "display-last-changes"), 'versionPersister' => "vcs-tag"));
     $serialized = $this->helper->addRMTConfigSection($config);
     $this->assertContains('vcs-tag', $serialized);
     $config = $this->helper->getRMTConfigSection();
     $this->assertNotNull($config);
     $this->assertEquals('git', $config->getVcs(), var_export($config, true));
 }
示例#5
0
 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();
 }