From d0ad76e346541c7ed532c49f31d2f671c81eb175 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Sun, 12 Apr 2015 15:56:19 -0400
Subject: bin/sisu when run from dir tree, check git describe version info

---
 bin/sisu | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

(limited to 'bin')

diff --git a/bin/sisu b/bin/sisu
index dc399737..9bb41736 100644
--- a/bin/sisu
+++ b/bin/sisu
@@ -163,6 +163,25 @@ class Orient
     else nil
     end
   end
+  def git_version
+    if sisu_run_from? == :full_path_to_sisu_bin_in_sisu_dir_tree \
+    && FileTest.file?('/usr/bin/git') \
+    && FileTest.directory?(processing.sisu_runtime_path.gsub(/\/bin\/sisu\S*/,'/.git'))
+      bin_base=processing.sisu_runtime_path.gsub(/\/bin\/sisu\S*/,'')
+      pwd=Dir.pwd
+      Dir.chdir(bin_base)
+      x=`git describe --long --tags 2>&1`.strip.
+        gsub(/^[a-z_-]*([0-9.]+)/,'\1').
+        gsub(/([^-]*-g)/,'r\1').
+        gsub(/-/,'.')
+      x=(x=~/^[0-9]+\.[0-9]+\.[0-9]+\.r[0-9]+\.g[0-9a-f]{7}/) \
+      ? x
+      : nil
+      Dir.chdir(pwd)
+      x
+    else nil
+    end
+  end
   def sisu_path_base
     case paths_set
     when :set_path_system
@@ -238,6 +257,9 @@ class Orient
     def language_list_regex?
       language_list.regex
     end
+    def git_version_info?
+      git_version
+    end
     def runtime?
       {
         call_path:    called_from?,
-- 
cgit v1.2.3