From 333f866232f5a45a0341362ebd062fcc60cd64aa Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Fri, 19 Jan 2018 12:08:43 -0500 Subject: [PATCH] include build date in version number #141 --- app/Console/Commands/Version.php | 20 ++++++++++++++++++-- config/version.yml | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/Version.php b/app/Console/Commands/Version.php index 34a0850e..9740b216 100644 --- a/app/Console/Commands/Version.php +++ b/app/Console/Commands/Version.php @@ -9,6 +9,22 @@ class Version extends BaseCommand { protected $signature = 'phpvms:version {--write}'; + /** + * Create the version number that gets written out + */ + protected function createVersionNumber($cfg) + { + exec($cfg['git']['git-local'], $version); + $version = substr($version[0], 0, $cfg['build']['length']); + + # prefix with the date in YYMMDD format + $date = date('ymd'); + + $version = $date.'-'.$version; + + return $version; + } + /** * Run dev related commands * @throws \Symfony\Component\Yaml\Exception\ParseException @@ -19,8 +35,8 @@ class Version extends BaseCommand $version_file = config_path('version.yml'); $cfg = Yaml::parse(file_get_contents($version_file)); - exec($cfg['git']['git-local'], $version); - $version = substr($version[0], 0, $cfg['build']['length']); + + $version = $this->createVersionNumber($cfg); $cfg['build']['number'] = $version; file_put_contents($version_file, Yaml::dump($cfg, 4, 2)); diff --git a/config/version.yml b/config/version.yml index a57e1724..5070bcc2 100644 --- a/config/version.yml +++ b/config/version.yml @@ -9,7 +9,7 @@ build: mode: number length: 6 increment_by: 1 - number: 5e097e + number: 180119-6e12c0 git_absorb: git-local git: git-local: 'git rev-parse --verify HEAD'