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} {block pagetitle}{$page_title|strip_tags}{/block}{if $project} - {$project.shortdesc}{/if} + {appversion}
diff --git a/src/IDF/templates/idf/base-simple.html b/src/IDF/templates/idf/base-simple.html index 39c1a9b..8a0a3d5 100644 --- a/src/IDF/templates/idf/base-simple.html +++ b/src/IDF/templates/idf/base-simple.html @@ -32,6 +32,7 @@ {block extraheader}{/block} {block pagetitle}{$page_title|strip_tags}{/block} + {appversion}
diff --git a/src/IDF/templates/idf/base.html b/src/IDF/templates/idf/base.html index 0d3cfb1..cfddd85 100644 --- a/src/IDF/templates/idf/base.html +++ b/src/IDF/templates/idf/base.html @@ -32,6 +32,7 @@ {block extraheader}{/block} {block pagetitle}{$page_title|strip_tags}{/block}{if $project} - {$project.shortdesc}{/if} + {appversion}
diff --git a/src/IDF/templates/idf/gadmin/base.html b/src/IDF/templates/idf/gadmin/base.html index 15e830d..4f8a745 100644 --- a/src/IDF/templates/idf/gadmin/base.html +++ b/src/IDF/templates/idf/gadmin/base.html @@ -31,6 +31,7 @@ {block extraheader}{/block} {block pagetitle}{$page_title|strip_tags}{/block} + {appversion}
diff --git a/src/IDF/version.php b/src/IDF/version.php new file mode 100644 index 0000000..cd5ca11 --- /dev/null +++ b/src/IDF/version.php @@ -0,0 +1,5 @@ + '1.1-dev', + 'revision' => '$Format:%H$', +);