Improved versioning script

This commit is contained in:
snipe 2016-12-01 02:53:41 -08:00
parent e62f3f9fb4
commit 1be22cf051
3 changed files with 15 additions and 15 deletions

View file

@ -40,20 +40,19 @@ class Versioning extends Command
*/ */
public function fire() public function fire()
{ {
// Path to the file containing your version
// This will be overwritten everything you commit a message
$versionFile = 'config/version.php'; $versionFile = 'config/version.php';
$hash_version = str_replace("\n",'',shell_exec('git describe --tags'));
// The git's output $version = explode('-', $hash_version);
// get the argument passed in the git command
$hash_version = $this->argument('app_version');
// discard the commit hash $array = var_export(
$version = explode('-', $hash_version); array(
$realVersion = $version[0]; 'app_version' => $version[0],
'build_version' => $version[1],
// save the version array to a variable 'hash_version' => $version[2],
$array = var_export(array('app_version' => $realVersion,'hash_version' => $hash_version), true); 'full_hash' => $hash_version),
true);
// Construct our file content // Construct our file content
@ -64,7 +63,7 @@ CON;
// And finally write the file and output the current version // And finally write the file and output the current version
\File::put($versionFile, $content); \File::put($versionFile, $content);
$this->line('Setting version: '. \config('version.latest')); $this->line('Setting version: '. config('version.app_version').' build '.config('version.build_version').' ('.config('version.hash_version').')');
} }
/** /**
@ -75,7 +74,6 @@ CON;
protected function getArguments() protected function getArguments()
{ {
return array( return array(
array('app_version', InputArgument::REQUIRED, 'version number is required.'),
); );
} }

View file

@ -1,5 +1,7 @@
<?php <?php
return array ( return array (
'app_version' => 'v3.6.0', 'app_version' => 'v3.6.0',
'hash_version' => 'v3.6.0-67-g7ccef51', 'build_version' => '68',
'hash_version' => 'ge62f3f9',
'full_hash' => 'v3.6.0-68-ge62f3f9',
); );

View file

@ -584,7 +584,7 @@
<footer class="main-footer"> <footer class="main-footer">
<div class="pull-right hidden-xs"> <div class="pull-right hidden-xs">
<b>Version</b> {{ config('version.hash_version') }} <b>Version</b> {{ config('version.app_version') }} build {{ config('version.build_version') }} ({{ config('version.hash_version') }})
<a target="_blank" class="btn btn-default btn-xs" href="https://snipe-it.readme.io">Documentation</a> <a target="_blank" class="btn btn-default btn-xs" href="https://snipe-it.readme.io">Documentation</a>
<a target="_blank" class="btn btn-default btn-xs" href="https://snipe-it-manual.readme.io">User's Manual</a> <a target="_blank" class="btn btn-default btn-xs" href="https://snipe-it-manual.readme.io">User's Manual</a>
<a target="_blank" class="btn btn-default btn-xs" href="https://snipeitapp.com/support/">Report a Bug</a> <a target="_blank" class="btn btn-default btn-xs" href="https://snipeitapp.com/support/">Report a Bug</a>