Beispiel #1
0
 /**
  * @SuppressWarnings(PHPMD.ExitExpression)
  */
 public function __construct()
 {
     // Creation
     parent::__construct('Release Management Tool', RMT_VERSION);
     self::$instance = $this;
     // Change the current directory in favor of the project root folder,
     // this allow to run the task from outside the project like:
     //     $/home/www> myproject/RMT release
     chdir($this->getProjectRootDir());
     // Add all command, in a controlled way and render exception if any
     try {
         // Add the default command
         $this->add(new InitCommand());
         // Add command that require the config file
         if (file_exists($this->getConfigFilePath())) {
             $this->add(new ReleaseCommand());
             $this->add(new CurrentCommand());
             $this->add(new ChangesCommand());
             $this->add(new ConfigCommand());
         }
     } catch (\Exception $e) {
         $output = new \Liip\RMT\Output\Output();
         $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
         $this->renderException($e, $output);
         exit(1);
     }
 }
 /**
  * Constructor.
  */
 public function __construct(Context $context = null)
 {
     // Creation
     parent::__construct('This is release-manager', RMT_VERSION);
     if ($context === null) {
         $context = Context::create($this);
     }
     // Change the current directory in favor of the project root folder,
     // this allow to run the task from outside the project like:
     //     $/home/www> myproject/RMT release
     chdir($this->getProjectRootDir());
     // Add all command, in a controlled way and render exception if any
     try {
         // Add the default command
         $this->add($this->createCommand('InitCommand'));
         try {
             $config = $this->getConfig();
             // Add command that require the config file
             $this->add($this->createCommand('ListCommand'));
             $this->add($this->createCommand('ReleaseCommand'));
             $this->add($this->createCommand('CurrentCommand'));
             $this->add($this->createCommand('ChangesCommand'));
             $this->addGitFlowCommands($context);
         } catch (NoConfigurationException $exception) {
             echo $exception->getMessage();
         }
     } catch (\Exception $e) {
         $output = new \Liip\RMT\Output\Output();
         $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
         $this->renderException($e, $output);
         exit(1);
     }
 }