diff options
author | Ralph Amissah <ralph@amissah.com> | 2014-01-17 21:35:12 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2014-01-17 21:36:09 -0500 |
commit | c00345b2e7cf7041a01a84e51e77ce88dceaa6e1 (patch) | |
tree | 47345e98ca88d03f2dfece3c77449b482b1cafef /bin | |
parent | README clean info related to unsupported --help option (diff) |
bin/sisu experimentationsisu_4.2.19
* start preparing for ruby changes
* work on fix for bug related to gem path & system installed sisu
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sisu | 70 |
1 files changed, 18 insertions, 52 deletions
@@ -2,45 +2,6 @@ # encoding: utf-8 #SiSU: copyright (C) 1997 - 2014 Ralph Amissah; License GPL 3, see appended program information begin - def ruby_version_ok?(base_version) - @v ||=RUBY_VERSION.scan(/\d+/) - vb=base_version.scan(/\d+/) - if @v[0].to_i < vb[0].to_i \ - or @v[0].to_i == vb[0].to_i \ - && @v[1].to_i < vb[1].to_i \ - or @v[0].to_i == vb[0].to_i \ - && @v[1].to_i == vb[1].to_i \ - && @v[1].to_i < vb[2].to_i - raise "Please, use Ruby#{vb} or later, current Ruby #{RUBY_VERSION}" - else check_incompatible_ruby_build? - end - end - def check_incompatible_ruby_build? - require 'rbconfig' - e=Config::CONFIG - if RUBY_VERSION == '1.9.2' \ - && e['PATCHLEVEL'].to_i < 180 - raise <<WOK -There are known issues with early versions of ruby1.9.2. -Please, use Ruby 1.9.2p180 or later, -current version #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']} -#{%x{ruby -v}.strip.to_s} - -WOK - end - end - def check_sisu_legacy_ruby_version? - rbv_sisu_legacy='1.9.2' #'1.8.7' - ruby_version_ok?(rbv_sisu_legacy) - end - def check_sisu_stable_ruby_version? - rbv_sisu_stable='1.9.2' - ruby_version_ok?(rbv_sisu_stable) - end - def check_sisu_dev_ruby_version? - rbv_sisu_dev='1.9.2' - ruby_version_ok?(rbv_sisu_dev) - end def require_hub_path(sisu_path_specified_lib_) if sisu_path_specified_lib_ \ && FileTest.file?("#{sisu_path_specified_lib_}/#{SiSU_lib}/hub.rb") @@ -51,21 +12,22 @@ WOK end #% sisu branch $VERBOSE=nil - $KCODE='u' if RUBY_VERSION < '1.9' argv=$* SiSU_called_from_directory=Dir.pwd + sisu_is_=:system_install require 'rubygems' - check_sisu_stable_ruby_version? - default_version=if __FILE__ =~/gem/ \ + default_version=if __FILE__ =~/\/gems\// \ and __FILE__ =~/\/sisu-[45]\.(?:\d+|[a-z])\.(?:\d+|[a-z])\// - SiSU_version_dir=case __FILE__ + sisu_is_=:gem_install + 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 - SiSU_version_dir=case $0 + SiSU_is=sisu_is_ + sisu_version_dir_=case $0 when /\bsisu4$/ then 'v4' when /\bsisu5$/ then 'v5' else @@ -75,10 +37,11 @@ WOK else default_version end end + SiSU_version_dir=sisu_version_dir_ #% $0 File.expand_path($0) e=Config::CONFIG - SiSU_path_base=if $0 =~ /^#{e['bindir']}\/sisu[45]?$/ - nil + sisu_path_base=if $0 =~ /^#{e['bindir']}\/sisu[45]?$/ + :system_default elsif $0 !~ /^#{e['bindir']}\/sisu[45]?$/ \ && File.expand_path($0) =~/bin\/sisu[45]?$/ \ && FileTest.file?($0) @@ -87,16 +50,19 @@ WOK nil end SiSU_lib="sisu/#{SiSU_version_dir}" - sisu_path_specified_lib_=SiSU_path_base \ + sisu_path_specified_lib_=($0 !~ /^#{e['bindir']}\/sisu[45]?$/) \ ? File.expand_path($0).sub(/bin\/sisu[45]?$/,'lib') : 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" + SiSU_path_specified_Version_=if SiSU_is==:gem_install + Gem::Specification.find_by_name("sisu").gem_dir + "/data/sisu/#{SiSU_version_dir}/v/version.yml" + elsif sisu_path_specified_lib_ \ + and sisu_path_base + "#{sisu_path_base}/data/sisu/#{SiSU_version_dir}/v/version.yml" + elsif sisu_path_base + Config::CONFIG['datadir'] + '/sisu' + "/#{SiSU_version_dir}/v/version.yml" else nil end + SiSU_path_base=sisu_path_base SiSU_path_lib="#{require_hub_path(sisu_path_specified_lib_)}" #% $* require "#{SiSU_path_lib}/hub" |