diff options
author | Ralph Amissah <ralph@amissah.com> | 2011-03-23 21:49:33 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2011-03-24 09:14:34 -0400 |
commit | 9e82ccef5eeb3228c7c958b049de4cbbf6b0d8a2 (patch) | |
tree | ecb8fccc7f527f6f5b6f98b36a5db973f94a5ad3 /bin/sisu_webrick | |
parent | v2, v3: vim syntax highlighting, fix typo (diff) |
v3, v2: bin/sisu*: v3 development ruby >=1.9.2p180; v2 maintenance ruby >=1.8.7
* bin/sisu* version checks
Diffstat (limited to 'bin/sisu_webrick')
-rw-r--r-- | bin/sisu_webrick | 80 |
1 files changed, 65 insertions, 15 deletions
diff --git a/bin/sisu_webrick b/bin/sisu_webrick index 1b2a724c..8f79a51f 100644 --- a/bin/sisu_webrick +++ b/bin/sisu_webrick @@ -1,22 +1,72 @@ #!/usr/bin/env ruby # encoding: utf-8 #SiSU: copyright (C) 1997 - 2011 Ralph Amissah; License GPL, see appended program information -raise "Please, use Ruby1.8 (1.8.4 or later), current Ruby #{RUBY_VERSION}" if RUBY_VERSION < '1.8.4' or RUBY_VERSION > '1.9' -#raise "Please, use Ruby1.8.4 or later, current Ruby #{RUBY_VERSION}" if RUBY_VERSION < '1.8.4' -$VERBOSE=nil -argv=$* -SiSU_version_dir=case argv.inspect -when /--v2/ - 'v2' -when /--v3/ - 'v3' -when /--dev/ - 'v3' -else - 'v2' +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}" + 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 + 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 + $VERBOSE=nil + argv=$* + SiSU_version_dir=case argv.inspect + when /--v2/ + check_sisu_stable_ruby_version? + 'v2' + when /--v3/ + check_sisu_dev_ruby_version? + 'v3' + when /--dev/ + check_sisu_dev_ruby_version? + 'v3' + else + check_sisu_stable_ruby_version? + 'v2' + end + SiSU_lib="sisu/#{SiSU_version_dir}" + require "#{SiSU_lib}/webrick" +rescue + STDERR.puts 'ERROR' + STDERR.puts $! + STDERR.puts $@ + require 'rbconfig' + e=Config::CONFIG + puts %{ + #{%x{ruby -v}.strip.to_s} + #{RUBY_VERSION} + ruby version: #{e['RUBY_PROGRAM_VERSION']}p#{e['PATCHLEVEL']} + ruby named: #{e['ruby_version']} + rubylib: #{e['rubylibdir']} + rubylib local: #{e['sitelibdir']} + } + system(%{echo " + system RUBYPATH: ${RUBYPATH} + system RUBYLIB: ${RUBYLIB} + "}) end -SiSU_lib="sisu/#{SiSU_version_dir}" -require "#{SiSU_lib}/webrick" __END__ * Name: SiSU |