versions = new Versions();
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
if ($this->argument('type') === 'git') {
$this->git();
} elseif ($this->argument('type') === 'branch') {
$this->branch();
} elseif ($this->argument('type') === 'sql') {
$this->sql();
} elseif ($this->argument('type') === 'all') {
$this->all();
} else {
$this->error($this->description);
}
}
public function all()
{
$this->git();
$this->sql();
}
public function branch()
{
$this->output->writeln(''.'Git branch: '.$this->versions->getGitBranch().'');
}
/**
* Fetch git tag for latest version.
*/
public function git()
{
$this->output->writeln('Looking up Git tag version(s)');
$this->info('Hash: '.$this->versions->getGitHeadHash());
$this->info('XML version: '.$this->versions->getGitTagInFile());
$this->info('Git version: '.$this->versions->getGitTagInRepo());
}
/**
* Fetch SQL latest patch version.
*/
public function sql()
{
$this->output->writeln('Looking up SQL patch version(s)');
$latest = $this->versions->getSQLPatchFromFile();
$this->info("XML version: $latest");
try {
$dbVersion = $this->versions->getSQLPatchFromDB();
$this->info(' DB version: '.$dbVersion);
} catch (\Exception $e) {
$this->error($e->getMessage());
}
}
}