From 5102422f1417d5f0a4215965dcd18ef6596ab782 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 26 Apr 2011 20:27:52 -0400 Subject: v2 v3: bin/ improved ruby version check --- bin/sisu | 29 ++++++++++++++++++----------- bin/sisu3 | 29 ++++++++++++++++++----------- bin/sisu_termsheet | 29 ++++++++++++++++++----------- bin/sisu_webrick | 29 ++++++++++++++++++----------- 4 files changed, 72 insertions(+), 44 deletions(-) (limited to 'bin') diff --git a/bin/sisu b/bin/sisu index ceeebd6c..5f60f8d7 100644 --- a/bin/sisu +++ b/bin/sisu @@ -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 $KCODE='u' if RUBY_VERSION < '1.9' argv=$* diff --git a/bin/sisu3 b/bin/sisu3 index e3246376..31664a70 100644 --- a/bin/sisu3 +++ b/bin/sisu3 @@ -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 $KCODE='u' if RUBY_VERSION < '1.9' argv=$* 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 diff --git a/bin/sisu_webrick b/bin/sisu_webrick index 8f79a51f..4abcaff4 100644 --- a/bin/sisu_webrick +++ b/bin/sisu_webrick @@ -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 -- cgit v1.2.3 From 03073b714c0d0821003b0491b4a19c1a67d3a98d Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 27 Apr 2011 20:32:05 -0400 Subject: v2 v3: bin/ type fix for ruby version check --- bin/sisu | 12 ++++++------ bin/sisu3 | 12 ++++++------ bin/sisu_termsheet | 12 ++++++------ bin/sisu_webrick | 12 ++++++------ 4 files changed, 24 insertions(+), 24 deletions(-) (limited to 'bin') diff --git a/bin/sisu b/bin/sisu index 5f60f8d7..0fde8a55 100644 --- a/bin/sisu +++ b/bin/sisu @@ -5,12 +5,12 @@ begin 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] + 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 diff --git a/bin/sisu3 b/bin/sisu3 index 31664a70..e02f2588 100644 --- a/bin/sisu3 +++ b/bin/sisu3 @@ -5,12 +5,12 @@ begin 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] + 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 diff --git a/bin/sisu_termsheet b/bin/sisu_termsheet index 28ac0277..2e344728 100644 --- a/bin/sisu_termsheet +++ b/bin/sisu_termsheet @@ -5,12 +5,12 @@ begin 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] + 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 diff --git a/bin/sisu_webrick b/bin/sisu_webrick index 4abcaff4..ca678acd 100644 --- a/bin/sisu_webrick +++ b/bin/sisu_webrick @@ -5,12 +5,12 @@ begin 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] + 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 -- cgit v1.2.3 From 6a20d40eadbdafa95cf6c77c42d146d05844d1c4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 4 May 2011 21:24:43 -0400 Subject: v2 v3: bin/ cosmetic --- bin/sisu | 4 ++-- bin/sisu3 | 4 ++-- bin/sisu_termsheet | 4 ++-- bin/sisu_webrick | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) (limited to 'bin') diff --git a/bin/sisu b/bin/sisu index 0fde8a55..9facda87 100644 --- a/bin/sisu +++ b/bin/sisu @@ -18,8 +18,8 @@ begin 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 <