diff options
Diffstat (limited to 'debian/bin/sisu3')
-rw-r--r-- | debian/bin/sisu3 | 54 |
1 files changed, 38 insertions, 16 deletions
diff --git a/debian/bin/sisu3 b/debian/bin/sisu3 index 66e57f11..473c18ce 100644 --- a/debian/bin/sisu3 +++ b/debian/bin/sisu3 @@ -2,25 +2,24 @@ # encoding: utf-8 #SiSU: copyright (C) 1997 - 2011 Ralph Amissah; License GPL, see appended program information begin - def check_sisu_stable_ruby_version? - rbv_sisu_stable='1.9.2' #'1.8.7' - if RUBY_VERSION < rbv_sisu_stable - raise "Please, use Ruby#{rbv_sisu_stable} or later, current Ruby #{RUBY_VERSION}" - else check_incompatible_ruby_build? - end - end - def check_sisu_dev_ruby_version? - rbv_sisu_dev='1.9.2' - if RUBY_VERSION < rbv_sisu_dev - raise "Please, use Ruby#{rbv_sisu_dev} or later, current Ruby #{RUBY_VERSION}" + 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' \ - and e['PATCHLEVEL'].to_i < 180 + 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, @@ -30,21 +29,33 @@ current version #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']} 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 $VERBOSE=nil $KCODE='u' if RUBY_VERSION < '1.9' argv=$* SiSU_version_dir=case argv.inspect when /--v2/ - check_sisu_stable_ruby_version? + check_sisu_legacy_ruby_version? 'v2' when /--v3/ - check_sisu_dev_ruby_version? + check_sisu_stable_ruby_version? 'v3' when /--dev/ check_sisu_dev_ruby_version? 'v3' else - check_sisu_dev_ruby_version? + check_sisu_stable_ruby_version? 'v3' end SiSU_lib="sisu/#{SiSU_version_dir}" @@ -67,6 +78,17 @@ rescue system RUBYPATH: ${RUBYPATH} system RUBYLIB: ${RUBYLIB} "}) + puts %{ + On a Debian system the following system commands may help set the default version of ruby to 1.9.2: + sudo update-alternatives --verbose --set ruby /usr/bin/ruby1.9.1 + export RUBYPATH='/usr/local/bin:/usr/bin' + export RUBYLIB='/usr/local/lib/site_ruby/1.9.1:/usr/lib/ruby/1.9.1:/usr/local/lib/site_ruby/1.8:/usr/lib/ruby/1.8' + + To return to ruby 1.8 (not suitable for sisu): + sudo update-alternatives --verbose --set ruby /usr/bin/ruby1.8 + export RUBYPATH='/usr/local/bin' + export RUBYLIB='/usr/local/lib/site_ruby/1.8:/usr/lib/ruby/1.8:/usr/local/lib/site_ruby/1.9.1:/usr/lib/ruby/1.9.1' + } end __END__ |