diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..404c823 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +src/IDF/version.php export-subst diff --git a/src/IDF/Middleware.php b/src/IDF/Middleware.php index b836e25..028f412 100644 --- a/src/IDF/Middleware.php +++ b/src/IDF/Middleware.php @@ -87,6 +87,7 @@ class IDF_Middleware 'markdown' => 'IDF_Template_Markdown', 'showuser' => 'IDF_Template_ShowUser', 'ashowuser' => 'IDF_Template_AssignShowUser', + 'appversion' => 'IDF_Template_AppVersion', )); $params['modifiers'] = array_merge($params['modifiers'], array( diff --git a/src/IDF/Template/AppVersion.php b/src/IDF/Template/AppVersion.php new file mode 100644 index 0000000..00d6f2a --- /dev/null +++ b/src/IDF/Template/AppVersion.php @@ -0,0 +1,61 @@ +'."\n"; + } + + if (array_key_exists('revision', $info)) { + if (strpos($info['revision'], '$') !== false) { + $info['revision'] = 'unknown'; + $cmd = Pluf::f('idf_exec_cmd_prefix', ''). + Pluf::f('git_path', 'git'). + ' log -1 --format=%H'; + + if (IDF_Scm::exec('IDF_Template_AppVersion::start', $cmd, $output)) { + $info['revision'] = trim(@$output[0]); + } + } + echo ''."\n"; + } + } +} + diff --git a/src/IDF/templates/idf/base-full.html b/src/IDF/templates/idf/base-full.html index d2e69fa..8e19345 100644 --- a/src/IDF/templates/idf/base-full.html +++ b/src/IDF/templates/idf/base-full.html @@ -32,6 +32,7 @@ {block extraheader}{/block}