mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* runruby.rb: added --pure (turned on by default) and --debugger
options. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11999 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f24e3f2271
commit
8f676986be
2 changed files with 24 additions and 6 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
`LANG=C date +%c` Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* runruby.rb: added --pure (turned on by default) and --debugger
|
||||||
|
options.
|
||||||
|
|
||||||
Mon Mar 5 09:19:33 2007 Minero Aoki <aamine@loveruby.net>
|
Mon Mar 5 09:19:33 2007 Minero Aoki <aamine@loveruby.net>
|
||||||
|
|
||||||
* lib/timeout.rb (Timeout.timeout): should return the block value
|
* lib/timeout.rb (Timeout.timeout): should return the block value
|
||||||
|
|
25
runruby.rb
25
runruby.rb
|
@ -1,5 +1,6 @@
|
||||||
#!./miniruby
|
#!./miniruby
|
||||||
|
|
||||||
|
pure = true
|
||||||
while arg = ARGV[0]
|
while arg = ARGV[0]
|
||||||
break ARGV.shift if arg == '--'
|
break ARGV.shift if arg == '--'
|
||||||
/\A--([-\w]+)(?:=(.*))?\z/ =~ arg or break
|
/\A--([-\w]+)(?:=(.*))?\z/ =~ arg or break
|
||||||
|
@ -12,6 +13,10 @@ while arg = ARGV[0]
|
||||||
archdir = value
|
archdir = value
|
||||||
when re =~ "extout"
|
when re =~ "extout"
|
||||||
extout = value
|
extout = value
|
||||||
|
when re =~ "pure"
|
||||||
|
pure = (value != "no")
|
||||||
|
when re =~ "debugger"
|
||||||
|
debugger = value ? (value.split unless value == "no") : %w"gdb --args"
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -32,16 +37,17 @@ unless File.exist?(ruby)
|
||||||
abort "#{ruby} is not found.\nTry `make' first, then `make test', please.\n"
|
abort "#{ruby} is not found.\nTry `make' first, then `make test', please.\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
libs = [abs_archdir, File.expand_path("lib", srcdir)]
|
libs = [abs_archdir]
|
||||||
if extout
|
if extout
|
||||||
abs_extout = File.expand_path(extout)
|
abs_extout = File.expand_path(extout)
|
||||||
libs << File.expand_path("common", abs_extout) << File.expand_path(RUBY_PLATFORM, abs_extout)
|
libs << File.expand_path("common", abs_extout) << File.expand_path(RUBY_PLATFORM, abs_extout)
|
||||||
end
|
end
|
||||||
|
libs << File.expand_path("lib", srcdir)
|
||||||
config["bindir"] = abs_archdir
|
config["bindir"] = abs_archdir
|
||||||
ENV["RUBY"] = File.expand_path(ruby)
|
ENV["RUBY"] = File.expand_path(ruby)
|
||||||
ENV["PATH"] = [abs_archdir, ENV["PATH"]].compact.join(File::PATH_SEPARATOR)
|
ENV["PATH"] = [abs_archdir, ENV["PATH"]].compact.join(File::PATH_SEPARATOR)
|
||||||
|
|
||||||
if e = ENV["RUBYLIB"]
|
if !pure and e = ENV["RUBYLIB"]
|
||||||
libs |= e.split(File::PATH_SEPARATOR)
|
libs |= e.split(File::PATH_SEPARATOR)
|
||||||
end
|
end
|
||||||
ENV["RUBYLIB"] = $:.replace(libs).join(File::PATH_SEPARATOR)
|
ENV["RUBYLIB"] = $:.replace(libs).join(File::PATH_SEPARATOR)
|
||||||
|
@ -55,8 +61,15 @@ if File.file?(libruby_so)
|
||||||
ENV["LD_PRELOAD"] = [libruby_so, ENV["LD_PRELOAD"]].compact.join(' ')
|
ENV["LD_PRELOAD"] = [libruby_so, ENV["LD_PRELOAD"]].compact.join(' ')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
begin
|
||||||
|
open("puretest.rb", IO::EXCL|IO::CREAT|IO::WRONLY) do |f|
|
||||||
|
f.puts('$LOAD_PATH.replace(ENV["RUBYLIB"].split(File::PATH_SEPARATOR))')
|
||||||
|
end
|
||||||
|
rescue Errno::EEXIST
|
||||||
|
end
|
||||||
|
|
||||||
# ruby = "gdb --args #{ruby}"
|
cmd = [ruby]
|
||||||
cmd = [ruby, *ARGV].join(' ')
|
cmd << "-rpuretest.rb" if pure
|
||||||
p cmd
|
cmd.concat(ARGV)
|
||||||
exec cmd
|
cmd.unshift(*debugger) if debugger
|
||||||
|
exec(*cmd)
|
||||||
|
|
Loading…
Reference in a new issue