include build date in version number #141
This commit is contained in:
parent
6e12c00725
commit
333f866232
@ -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));
|
||||
|
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user