Skip to content

Commit

Permalink
Version Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
ben182 committed Sep 24, 2019
1 parent e84f418 commit 5b36615
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/Console/Commands/General/WelcomeMessageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function __construct()
public function handle()
{
$this->line('This server was provisioned by stool | created by Benjamin Bortels');
$this->line('stool v' . Stool::version());
$this->line('stool ' . Stool::versionString());

if (Stool::updateAvailable()) {
$this->error('An update for stool is available (' . Stool::versionOnRemote() . ')');
Expand Down
12 changes: 11 additions & 1 deletion app/Console/Stool.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,19 @@

class Stool
{
public static function versionString()
{
$commitHash = trim(exec('git log --pretty="%h" -n1 HEAD'));

$commitDate = new \DateTime(trim(exec('git log -n1 --pretty=%ci HEAD')));
$commitDate->setTimezone(new \DateTimeZone('UTC'));

return sprintf('v%s-%s (%s)', self::version(), $commitHash, $commitDate->format('Y-m-d H:i:s'));
}

public static function version()
{
return '2.0.3';
return trim(exec('git describe --tags --abbrev=0'));
}

/**
Expand Down

0 comments on commit 5b36615

Please sign in to comment.