diff --git a/bin/phab b/bin/phab index 82df37ed..9f36f853 100755 --- a/bin/phab +++ b/bin/phab @@ -65,12 +65,7 @@ $dispatcher = $container->get(EventDispatcher::class); $application->setDispatcher($dispatcher); SelfUpdateCommand::registerListener($dispatcher); -$version = '@git_tag@'; -if ($version[0] == '@') { - $version = Utilities::FALLBACK_VERSION; -} - -$application->setVersion($version); +$application->setVersion(Utilities::FALLBACK_VERSION); $application->setName('phabalicious'); $application->setDefaultCommand('list'); PluginDiscovery::discoverFromFabfile($container, $output); diff --git a/src/Command/SelfUpdateCommand.php b/src/Command/SelfUpdateCommand.php index 02f53590..8737447a 100644 --- a/src/Command/SelfUpdateCommand.php +++ b/src/Command/SelfUpdateCommand.php @@ -24,7 +24,10 @@ public function __construct(ConfigurationService $configuration, $name = null) { $this->configuration = $configuration; - parent::__construct('phab', Utilities::FALLBACK_VERSION, 'factorial-io/phabalicious'); + $version_parser = new VersionParser(); + $version = $version_parser->normalize(Utilities::FALLBACK_VERSION); + + parent::__construct('phab', $version, 'factorial-io/phabalicious'); } public function getConfiguration(): ConfigurationService @@ -72,6 +75,8 @@ public function isUpdateAvailable() { try { $version = $this->getApplication()->getVersion(); + $version_parser = new VersionParser(); + $version = $version_parser->normalize($version); $preview = (stripos($version, 'alpha') !== false) || (stripos($version, 'beta') !== false); @@ -79,7 +84,7 @@ public function isUpdateAvailable() $latest = $this->getLatestReleaseFromGithub(['preview' => $preview])['version']; - $update_available = ($latest && Comparator::greaterThan($latest, $this->currentVersion)); + $update_available = ($latest && Comparator::greaterThan($latest, $version)); $this->configuration->getLogger()->debug(sprintf( 'Version-Check: current: %s, latest on remote: %s, check for preview: %s, update available: %s', $version,