diff options
author | Ralph Amissah <ralph@amissah.com> | 2011-04-26 20:27:52 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2011-04-26 20:27:52 -0400 |
commit | 5102422f1417d5f0a4215965dcd18ef6596ab782 (patch) | |
tree | b69569f775e0441bc6abdf216eaa71c599edaa50 /bin/sisu_termsheet | |
parent | v2 v3: 2.9.3 & 3.0.8 version & changelogs "opened" (diff) |
v2 v3: bin/ improved ruby version check
Diffstat (limited to 'bin/sisu_termsheet')
-rw-r--r-- | bin/sisu_termsheet | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/bin/sisu_termsheet b/bin/sisu_termsheet index 10318191..28ac0277 100644 --- a/bin/sisu_termsheet +++ b/bin/sisu_termsheet @@ -2,17 +2,16 @@ # 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.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] < vb[0] \ + or @v[0] == vb[0] \ + && @v[1] < vb[1] \ + or @v[0] == vb[0] \ + && @v[1] == vb[1] \ + && @v[1] < vb[2] + raise "Please, use Ruby#{vb} or later, current Ruby #{RUBY_VERSION}" else check_incompatible_ruby_build? end end @@ -30,6 +29,14 @@ current version #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']} WOK end end + def check_sisu_stable_ruby_version? + rbv_sisu_stable='1.8.7' + 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 argv=$* SiSU_version_dir=case argv.inspect |