Example #1
0
 protected function initialize(InputInterface $input, OutputInterface $output)
 {
     $helper = new ComposerConfig();
     $file = $this->getApplication()->getProjectRootDir() . '/composer.json';
     $helper->setComposerFile($file);
     $config = $helper->getRMTConfigSection();
     if (!$config) {
         return;
     }
     $this->writeBigTitle('Current: ' . $helper->getProjectName() . ' ' . $helper->getCurrentVersion());
     $this->writeEmptyLine();
 }
Example #2
0
 /**
  * Context factory method.
  * 
  * @param \Liip\RMT\Application $application
  * @return \Liip\RMT\Context
  */
 public static function create(Application $application)
 {
     $rootDir = $application->getProjectRootDir();
     $helper = new Helpers\ComposerConfig();
     $helper->setComposerFile($rootDir . '/composer.json');
     $config = $helper->getRMTConfigSection();
     $context = new Context();
     $builder = new Helpers\ServiceBuilder($context);
     /*
      * The following services are config-dependent
      */
     if ($config !== null) {
         if ($config->getVcs()) {
             $context->setService('vcs', $builder->getService($config->getVcs(), 'vcs'));
         }
         // Store the config for latter usage
         $context->setParameter('config', $config);
         /*
          * populate version persister
          */
         $context->setService("version-persister", $builder->getService($config->getVersionPersister(), 'versionPersister'));
         $context->setService("version-detector", $builder->getService($config->getVersionDetector(), 'versionDetector'));
         /*
          * popluate lists
          */
         foreach (array("prerequisites", self::PRERELEASE_LIST, "postReleaseActions") as $listName) {
             $context->createEmptyList($listName);
             foreach ($config->{$listName} as $service) {
                 $context->addToList($listName, $builder->getService($service, $listName));
             }
         }
     }
     // Provide the root dir as a context parameter
     $context->setParameter('project-root', $rootDir);
     return $context;
 }
 public function testGetProjectName()
 {
     $this->assertEquals('bonndan/ReleaseManager', $this->helper->getProjectName());
 }
Example #4
0
 /**
  * Returns the configuration.
  * 
  * @return object
  * @throws NoConfigurationException
  */
 public function getConfig()
 {
     $helper = new Helpers\ComposerConfig();
     $file = $this->getProjectRootDir() . '/composer.json';
     $helper->setComposerFile($file);
     $config = $helper->getRMTConfigSection();
     if ($config === null) {
         throw new NoConfigurationException("Impossible to locate the extra/rmt config section in {$file}. If it's the first time you\n                are using this tool, you need to setup your project using the [RMT init] command");
     }
     return $config;
 }
 /**
  * Execute replacement.
  * 
  */
 public function execute()
 {
     $helper = new ComposerConfig($this->context);
     $helper->setVersion($this->context->getNewVersion());
     $this->confirmSuccess();
 }