From ae6ce4581bd5967b8a0044847c0a09b349200b66 Mon Sep 17 00:00:00 2001
From: Ralph Amissah <ralph@amissah.com>
Date: Tue, 3 Dec 2013 00:40:01 -0500
Subject: debian/bin/sisu sync bin/sisu, update for sisugem & sisu when called
 as gem

---
 debian/bin/sisu | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

(limited to 'debian/bin')

diff --git a/debian/bin/sisu b/debian/bin/sisu
index 0b149111..07aa1fb4 100644
--- a/debian/bin/sisu
+++ b/debian/bin/sisu
@@ -54,31 +54,35 @@ WOK
   $KCODE='u' if RUBY_VERSION < '1.9'
   argv=$*
   SiSU_called_from_directory=Dir.pwd
-  if $0 !~/\bsisu[45]$/
+  require 'rubygems'
+  check_sisu_stable_ruby_version?
+  if __FILE__ =~/gem/ \
+  and  __FILE__ =~/sisu-[45]\.\d+\.\d+/
+    SiSU_version_dir=(__FILE__ =~/sisu-5\.\d+\.\d+/) \
+    ? 'v5'
+    : 'v4'
+  elsif $0 !~/\b(?:sisu[45]|sisugem)$/
     SiSU_version_dir=case argv.inspect
     when /"(?:--v4)"/
-      check_sisu_stable_ruby_version?
       'v4'
     when /"(?:--v5)"/
-      check_sisu_stable_ruby_version?
       'v5'
-    when /"(?:--dev)"/
-      check_sisu_dev_ruby_version?
+    when /"--dev"/
       'v5'
     else
-      check_sisu_stable_ruby_version?
       'v4'
     end
   else
     SiSU_version_dir=case $0
     when /\bsisu4$/
-      check_sisu_stable_ruby_version?
       'v4'
     when /\bsisu5$/
-      check_sisu_stable_ruby_version?
       'v5'
+    when /sisugem$/  # should have been caught earlier, unused, debug check
+      SiSU_version_dir=(__FILE__ =~/sisu-5\.\d+\.\d+/) \
+      ? 'v5'
+      : 'v4'
     else
-      check_sisu_stable_ruby_version?
       'v4'
     end
   end
@@ -158,6 +162,7 @@ rescue
   STDERR.puts $!
   STDERR.puts $@
   require 'rbconfig'
+  require 'rubygems'
   e=Config::CONFIG
   puts %{
                    #{%x{ruby -v}.strip.to_s}
@@ -166,6 +171,8 @@ rescue
     ruby named:    #{e['ruby_version']}
     rubylib:       #{e['rubylibdir']}
     rubylib local: #{e['sitelibdir']}
+    gem dir:       #{Gem.dir}
+    gem path:      #{Gem.path}
   }
   system(%{echo "
     system RUBYPATH: ${RUBYPATH}
-- 
cgit v1.2.3