예제 #1
0
 /**
  * {@inheritDoc}
  */
 protected function prepareCommand()
 {
     RuntimeHelper::setupHome($this->file->get(self::SETTING_HOME));
     $command = new UpdateCommand();
     $command->setComposer(Factory::create($this->getIO()));
     return $command;
 }
 /**
  * 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);
 }
예제 #3
0
 public function whenIRunComposerWithThePlugin()
 {
     $factory = new Factory();
     $this->io = new BufferIO();
     $config = array_merge(array('config' => array('vendor-dir' => __DIR__ . '/__tmp/vendor'), 'repositories' => array('packagist' => false)), $this->json);
     $composer = $factory->createComposer($this->io, $config, true);
     $composer->setLocker(new Locker($this->io, new JsonFile('not-existing'), $composer->getRepositoryManager(), $composer->getInstallationManager(), ''));
     $this->executor = new TestProcessExecutorMock();
     $composer->getDownloadManager()->setDownloader('git', new GitDownloader($this->io, $composer->getConfig(), $this->executor));
     $cache = new Cache($this->io, __DIR__ . '/__tmp/vendor/cache');
     $rfs = new TestRemoteFileSystemMock($this->remoteFiles);
     $composer->getDownloadManager()->setDownloader('file', new FileDownloader($this->io, $composer->getConfig(), $composer->getEventDispatcher(), $cache, $rfs));
     $composer->getPluginManager()->addPlugin(new FidoPlugin(__DIR__ . '/__tmp'));
     $update = new UpdateCommand();
     $update->setComposer($composer);
     $update->setIO($this->io);
     $update->run(new ArrayInput(array()), new BufferedOutput());
 }
예제 #4
0
 public function run($config_params = array())
 {
     ob_start();
     $input = new ArgvInput(array());
     $output = new ConsoleOutput();
     $helper = new HelperSet();
     $config = new Config();
     if (!empty($config_params)) {
         $config_composer = array('config' => $config_params);
         $config->merge($config_composer);
     }
     //        $config_composer = array('config' => array(
     //            'prepend-autoloader' => false,
     //            'no-install' => true,
     //            'no-scripts' => true,
     //            'no-plugins' => true,
     //            'no-progress' => true,
     //            'no-dev' => true,
     //            'no-custom-installers' => true,
     //            'no-autoloader' => true
     //        ));
     $output->setVerbosity(0);
     $io = new ConsoleIO($input, $output, $helper);
     $composer = Factory::create($io);
     $composer->setConfig($config);
     $update = new UpdateCommand();
     $update->setComposer($composer);
     $out = $update->run($input, $output);
     ob_end_clean();
     return $out;
     //        $update = new InstallCommand();
     //        $update->setComposer($composer);
     //        $out = $update->run($input, $output);
     //  dd($output);
     //        $input = new ArrayInput(array('command' => 'update'));
     //
     ////Create the application and run it with the commands
     //        $application = new Application();
     //        $application->setAutoExit(false);
     //        $out = $application->run($input);
     //     dd($out);
     //        echo "Done.";
 }
예제 #5
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;
 }
예제 #6
0
 /**
  * {@inheritDoc}
  */
 protected function prepareCommand()
 {
     RuntimeHelper::setupHome($this->getHome());
     $command = new UpdateCommand();
     $command->setComposer(Factory::create($this->getIO()));
     if ($this->isDryRun()) {
         $pendingUpgrades = $this->getDataDir() . DIRECTORY_SEPARATOR . 'upgrades.json';
         $installationManager = new InstallationManager(new JsonFile($pendingUpgrades, null));
         $command->getComposer()->setInstallationManager($installationManager);
         $command->getComposer()->getEventDispatcher()->addListener(InstallerEvents::PRE_DEPENDENCIES_SOLVING, function (InstallerEvent $event) use($installationManager) {
             $installationManager->setPool($event->getPool());
         });
     }
     return $command;
 }