/** * Execute * * @param InputInterface $input * @param OutputInterface $output * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $updater = new Updater(null, false); $updater->setStrategy(Updater::STRATEGY_GITHUB); $strategy = $updater->getStrategy(); /* @var GithubStrategy $strategy */ $strategy->setPackageName('TYPO3/Surf'); $strategy->setPharName('surf.phar'); $strategy->setCurrentLocalVersion($this->getApplication()->getVersion()); $stability = $input->getOption('stability'); if (empty($stability)) { // Unstable by default. Should be removed once we have a 2.0.0 final $stability = GithubStrategy::UNSTABLE; } $strategy->setStability($stability); if ($input->getOption('check')) { $result = $updater->hasUpdate(); if ($result) { $output->writeln(sprintf('The %s build available remotely is: %s', $strategy->getStability() === GithubStrategy::ANY ? 'latest' : 'current ' . $strategy->getStability(), $updater->getNewVersion())); } elseif (false === $updater->getNewVersion()) { $output->writeln('There are no new builds available.'); } else { $output->writeln(sprintf('You have the current %s build installed.', $strategy->getStability())); } } elseif ($input->getOption('rollback')) { $result = $updater->rollback(); $result ? $output->writeln('Success!') : $output->writeln('Failure!'); } else { $result = $updater->update(); $result ? $output->writeln('Updated.') : $output->writeln('No update needed!'); } }
/** * Configure updater to use unstable builds. * * @param Updater $updater */ private function stable(Updater $updater) { $updater->setStrategy(Updater::STRATEGY_GITHUB); $updater->getStrategy()->setPackageName('nanbando/core'); $updater->getStrategy()->setPharName('nanbando.phar'); $updater->getStrategy()->setCurrentLocalVersion('@git_version@'); $updater->getStrategy()->setStability(GithubStrategy::STABLE); }
/** * Execute Command. * * @param InputInterface $consoleInput * @param OutputInterface $consoleOutput * * @return int|null|void */ public function execute(InputInterface $consoleInput, OutputInterface $consoleOutput) { $updater = new Updater(); $updater->setStrategy(Updater::STRATEGY_GITHUB); $updater->getStrategy()->setPackageName('kriskbx/wyn'); $updater->getStrategy()->setPharName('wyn.phar'); $updater->getStrategy()->setCurrentLocalVersion($GLOBALS['wynVersion']); try { $result = $updater->rollback(); $result ? exit('Success!') : exit('Failure!'); } catch (\Exception $e) { exit('Well, something happened! Either an oopsie or something involving hackers.'); } }
protected function execute(InputInterface $input, OutputInterface $output) { $updater = new Updater(); $updater->setStrategy(Updater::STRATEGY_GITHUB); $updater->getStrategy()->setPackageName('relamptk/git-deployer'); $updater->getStrategy()->setPharName('git-deployer.phar'); $updater->getStrategy()->setCurrentLocalVersion($this->getApplication()->getVersion()); $result = $updater->update(); if ($result) { $new = $updater->getNewVersion(); $output->writeln('<info>Git-Deployer</info> updated to version ' . $new . '.'); } else { $output->writeln('<info>Git-Deployer</info> is already on the latest version!'); } }
/** * Execute the self-update command * * @param InputInterface $input * @param OutputInterface $output * @return void */ protected function execute(InputInterface $input, OutputInterface $output) { $updater = new Updater(null, false); $updater->setStrategy(Updater::STRATEGY_GITHUB); $updater->getStrategy()->setPackageName('studioforty9/modrepo'); $updater->getStrategy()->setPharName('modrepo.phar'); $updater->getStrategy()->setCurrentLocalVersion($this->getApplication()->getVersion()); $updater->getStrategy()->setStability('stable'); try { $result = $updater->update(); if ($result) { $output->writeln('<fg=green>Modrepo has been updated.</fg=green>'); $output->writeln(sprintf('<fg=green>Current version is:</fg=green> <options=bold>%s</options=bold>.', $updater->getNewVersion())); $output->writeln(sprintf('<fg=green>Previous version was:</fg=green> <options=bold>%s</options=bold>.', $updater->getOldVersion())); } else { $output->writeln('<fg=green>Modrepo is currently up to date.</fg=green>'); $output->writeln(sprintf('<fg=green>Current version is:</fg=green> <options=bold>%s</options=bold>.', $updater->getOldVersion())); } } catch (\Exception $e) { $output->writeln(sprintf('Error: <fg=yellow>%s</fg=yellow>', $e->getMessage())); } $output->write(PHP_EOL); }
protected function getMostRecentNonDevUpdater() { $updater = new Updater(); $updater->setStrategy(Updater::STRATEGY_GITHUB); $updater->getStrategy()->setStability(GithubStrategy::ANY); return $this->getGithubReleasesUpdater($updater); }
protected function getMostRecentNonDevUpdater() { $updater = new Updater(null, false); $updater->setStrategy(Updater::STRATEGY_GITHUB); /** @var GithubStrategy $strategyInterface */ $strategyInterface = $updater->getStrategy(); $strategyInterface->setStability(GithubStrategy::ANY); return $this->getGithubReleasesUpdater($updater); }
private function getUpdater() { $updater = new Updater(null, false); $updater->setStrategy(Updater::STRATEGY_GITHUB); $strategy = $updater->getStrategy(); /* @var $strategy GithubStrategy */ $strategy->setPackageName(CliCentralApplication::PACKAGE_NAME); $strategy->setPharName(self::FILE_NAME); $strategy->setCurrentLocalVersion($this->getApplication()->getVersion()); return $updater; }