/**
  * Execute command, adjust constraints and start update
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = $this->getIO();
     $io->writeError('> ichhabrecht/composer-git-flow-plugin');
     $this->stability = $input->getOption('stability');
     $stability = trim((string) getenv('STABILITY'));
     if (!empty($stability)) {
         $io->writeError('Warning: You are using the deprecated environment variable `STABILITY`. Please use cli option --stability ' . $stability);
         $this->stability = $stability;
     }
     $io->writeError('  - using STABILITY=' . $this->stability);
     $io->writeError('');
     $composer = $this->getComposer(true, $input->getOption('no-plugins'));
     $requires = $composer->getPackage()->getRequires();
     $newRequires = $this->adjustGitFlowPackages($requires);
     $packages = array_keys($newRequires);
     $composer->getPackage()->setRequires(array_merge($requires, $newRequires));
     if (!$input->getOption('no-dev')) {
         $requires = $this->adjustGitFlowPackages($composer->getPackage()->getDevRequires());
         $newRequires = $this->adjustGitFlowPackages($requires);
         $packages += array_keys($newRequires);
         $composer->getPackage()->setDevRequires(array_merge($requires, $newRequires));
     }
     $input->setArgument('packages', $packages);
     $io->writeError('');
     return parent::execute($input, $output);
 }
Beispiel #2
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $newWorkDir = $this->getNewWorkingDir($input);
     if (!is_dir($newWorkDir)) {
         throw new \RuntimeException("Not found directory:" . $newWorkDir);
     }
     $oldWorkingDir = getcwd();
     chdir($newWorkDir);
     $io = new ConsoleIO($input, $output, $this->getHelperSet());
     $composer = Factory::create($io);
     $this->setComposer($composer);
     $this->setIO($io);
     $statusCode = parent::execute($input, $output);
     if (isset($oldWorkingDir)) {
         chdir($oldWorkingDir);
     }
     return $statusCode;
 }