include build date in version number #141
This commit is contained in:
@@ -9,6 +9,22 @@ class Version extends BaseCommand
|
|||||||
{
|
{
|
||||||
protected $signature = 'phpvms:version {--write}';
|
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
|
* Run dev related commands
|
||||||
* @throws \Symfony\Component\Yaml\Exception\ParseException
|
* @throws \Symfony\Component\Yaml\Exception\ParseException
|
||||||
@@ -19,8 +35,8 @@ class Version extends BaseCommand
|
|||||||
$version_file = config_path('version.yml');
|
$version_file = config_path('version.yml');
|
||||||
|
|
||||||
$cfg = Yaml::parse(file_get_contents($version_file));
|
$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;
|
$cfg['build']['number'] = $version;
|
||||||
|
|
||||||
file_put_contents($version_file, Yaml::dump($cfg, 4, 2));
|
file_put_contents($version_file, Yaml::dump($cfg, 4, 2));
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ build:
|
|||||||
mode: number
|
mode: number
|
||||||
length: 6
|
length: 6
|
||||||
increment_by: 1
|
increment_by: 1
|
||||||
number: 5e097e
|
number: 180119-6e12c0
|
||||||
git_absorb: git-local
|
git_absorb: git-local
|
||||||
git:
|
git:
|
||||||
git-local: 'git rev-parse --verify HEAD'
|
git-local: 'git rev-parse --verify HEAD'
|
||||||
|
|||||||
Reference in New Issue
Block a user