feat: VersionGit에 'hash' 추가.(WIP)

This commit is contained in:
2021-08-25 02:05:27 +09:00
parent 59b09fa084
commit ee1639bbef
5 changed files with 83 additions and 11 deletions
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace sammo;
class VersionGitDynamic
{
public static $version = '_tK_verionGit_';
static function getVersion()
{
$command = 'git describe --long --tags';
exec($command, $output);
if (is_array($output)) {
$output = join('', $output);
}
return trim($output);
}
static function getHash()
{
$command = 'git rev-parse HEAD';
exec($command, $output);
if (is_array($output)) {
$output = join('', $output);
}
return trim($output);
}
static function __get($name){
if($name === 'version'){
return static::getVersion();
}
if($name === 'hash'){
return static::getHash();
}
trigger_error("Undefined property $name");
}
private function __construct()
{
}
}
//{"version":"_tK_verionGit_"}