aboutsummaryrefslogtreecommitdiffhomepage
path: root/bin
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-01-06 22:03:06 -0500
committerRalph Amissah <ralph@amissah.com>2014-01-06 22:03:28 -0500
commit42aae8da2b103b4038cfb2fc24591b9004972d4a (patch)
tree43664a21f64de59ca4fd0a241603260e3b7de04a /bin
parentv5: date 2014: headers bin/sisu & lib/; code constants.rb (diff)
bin/sisu, version dir (fix) & version info
* (ensure SiSU_version_dir) fix * sisu version info, yml info also when installed via ruby gem * downstream libs
Diffstat (limited to 'bin')
-rw-r--r--bin/sisu29
1 files changed, 19 insertions, 10 deletions
diff --git a/bin/sisu b/bin/sisu
index 2b31dc9b..102d10d1 100644
--- a/bin/sisu
+++ b/bin/sisu
@@ -58,15 +58,20 @@ WOK
check_sisu_stable_ruby_version?
default_version=if __FILE__ =~/gem/ \
and __FILE__ =~/\/sisu-[45]\.(?:\d+|[a-z])\.(?:\d+|[a-z])\//
- SiSU_version_dir=(__FILE__ =~/\/sisu-5\.(?:\d+|[a-z])\.(?:\d+|[a-z])\//) ? 'v5' : 'v4'
- else 'v4'
+ SiSU_version_dir=case __FILE__
+ when /\/sisu-5\.(?:\d+|[a-z])\.(?:\d+|[a-z])\// then 'v5'
+ when /\/sisu-4\.(?:\d+|[a-z])\.(?:\d+|[a-z])\// then 'v4'
+ else 'v4'
+ end
+ else 'v4'
end
- if $0 =~/\bsisu4$/ then 'v4'
- elsif $0 =~/\bsisu5$/ then 'v5'
+ SiSU_version_dir=case $0
+ when /\bsisu4$/ then 'v4'
+ when /\bsisu5$/ then 'v5'
else
- SiSU_version_dir=case argv.inspect
- when /"(?:--v4|--current|--stable)"/ then 'v4'
- when /"(?:--v5|--next|--dev)"/ then 'v5'
+ case argv.inspect
+ when /"(?:--v4|--current|--stable)"/ then 'v4'
+ when /"(?:--v5|--next|--dev)"/ then 'v5'
else default_version
end
end
@@ -85,9 +90,13 @@ WOK
sisu_path_specified_lib_=SiSU_path_base \
? File.expand_path($0).sub(/bin\/sisu[45]?$/,'lib')
: nil
- SiSU_path_specified_Version_=SiSU_path_base \
- ? "#{SiSU_path_base}/data/sisu/#{SiSU_version_dir}/v/version.yml"
- : nil
+ SiSU_path_specified_Version_=if __FILE__ =~/gem/
+ spec = Gem::Specification.find_by_name("sisu")
+ spec.gem_dir + "/data/sisu/#{SiSU_version_dir}/v/version.yml"
+ elsif SiSU_path_base
+ "#{SiSU_path_base}/data/sisu/#{SiSU_version_dir}/v/version.yml"
+ else nil
+ end
SiSU_path_lib="#{require_hub_path(sisu_path_specified_lib_)}"
#% $*
require "#{SiSU_path_lib}/hub"