improved version checker

This commit is contained in:
denisdulici
2020-02-21 11:45:37 +03:00
parent d8a0948faf
commit 4b0e836e21
3 changed files with 32 additions and 13 deletions

View File

@ -43,7 +43,11 @@ class Update extends Command
$this->alias = $this->argument('alias');
$this->new = $this->getNewVersion();
if (false === $this->new = $this->getNewVersion()) {
$this->error('Not able to get the latest version of ' . $this->alias . '!');
return self::CMD_ERROR;
}
$this->old = $this->getOldVersion();
@ -71,15 +75,7 @@ class Update extends Command
public function getNewVersion()
{
$new = $this->argument('new');
if ($new == 'latest') {
$modules = ($this->alias == 'core') ? [] : [$this->alias];
$new = Versions::latest($modules)[$this->alias]->data->latest;
}
return $new;
return ($this->argument('new') == 'latest') ? Versions::latest($this->alias) : $this->argument('new');
}
public function getOldVersion()