Skip to content
This repository was archived by the owner on Nov 14, 2019. It is now read-only.

Added an option to force the installer update #272

Merged
merged 1 commit into from
Jul 24, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/Symfony/Installer/SelfUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Symfony\Installer;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Exception\IOException;

Expand Down Expand Up @@ -66,6 +67,7 @@ protected function configure()
$this
->setName('self-update')
->setAliases(array('selfupdate'))
->addOption('force-update', 'f', InputOption::VALUE_NONE, 'It updates the installer to the latest available version without checking if it\'s older or newer than the locally installed version.')
->setDescription('Update the Symfony Installer to the latest version.')
->setHelp('The <info>%command.name%</info> command updates the installer to the latest available version.')
;
Expand Down Expand Up @@ -100,14 +102,15 @@ protected function initialize(InputInterface $input, OutputInterface $output)
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if ($this->isInstallerUpdated()) {
$forceUpdate = true === $input->getOption('force-update');
if (!$forceUpdate && $this->isInstallerUpdated()) {
$this->output->writeln(sprintf('// Symfony Installer is <info>already updated</info> to the latest version (%s).', $this->latestInstallerVersion));

return;
} else {
$this->output->writeln(sprintf('// <info>updating</info> Symfony Installer to <info>%s</info> version', $this->latestInstallerVersion));
}

$this->output->writeln(sprintf('// <info>updating</info> Symfony Installer to <info>%s</info> version', $this->latestInstallerVersion));

try {
$this
->downloadNewVersion()
Expand Down