diff --git a/app/Console/Commands/Version.php b/app/Console/Commands/Version.php index 34a0850e7..9740b2167 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 @@ public function handle() $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 a57e17248..5070bcc28 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'