summaryrefslogtreecommitdiffstats
path: root/tool/rbinstall.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-14 21:43:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-14 21:43:00 +0000
commit3fbff03bfa0568ac1f9b25ba2bd422cf69051d92 (patch)
treef16a629762c5ef969d03942cecfecbe56800073a /tool/rbinstall.rb
parent6c18e66108eb15c475258146125f785cf2bea4cc (diff)
downloadruby-3fbff03bfa0568ac1f9b25ba2bd422cf69051d92.tar.gz
ruby-3fbff03bfa0568ac1f9b25ba2bd422cf69051d92.tar.xz
ruby-3fbff03bfa0568ac1f9b25ba2bd422cf69051d92.zip
* tool/rbinstall.rb (parse_args): show help message and exit if
rbconfig could not load. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@24930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/rbinstall.rb')
-rwxr-xr-xtool/rbinstall.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/tool/rbinstall.rb b/tool/rbinstall.rb
index 6d272907b..4263cdace 100755
--- a/tool/rbinstall.rb
+++ b/tool/rbinstall.rb
@@ -1,8 +1,13 @@
#!./miniruby
-load "./rbconfig.rb"
-include RbConfig
-$".unshift File.expand_path("./rbconfig.rb")
+begin
+ load "./rbconfig.rb"
+rescue LoadError
+ CONFIG = Hash.new {""}
+else
+ include RbConfig
+ $".unshift File.expand_path("./rbconfig.rb")
+end
srcdir = File.expand_path('../..', __FILE__)
unless defined?(CROSS_COMPILING) and CROSS_COMPILING
@@ -35,7 +40,7 @@ def parse_args(argv = ARGV)
$cmdtype = ('bat' if File::ALT_SEPARATOR == '\\')
mflags = []
opt = OptionParser.new
- opt.on('-n') {$dryrun = true}
+ opt.on('-n', '--dry-run') {$dryrun = true}
opt.on('--dest-dir=DIR') {|dir| $destdir = dir}
opt.on('--extout=DIR') {|dir| $extout = (dir unless dir.empty?)}
opt.on('--make=COMMAND') {|make| $make = make}
@@ -79,6 +84,11 @@ def parse_args(argv = ARGV)
end
end rescue abort "#{$!.message}\n#{opt.help}"
+ unless defined?(RbConfig)
+ puts opt.help
+ exit
+ end
+
$make, *rest = Shellwords.shellwords($make)
$mflags.unshift(*rest) unless rest.empty?
$mflags.unshift(*mflags)