mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* runruby.rb: added --precommand and --show options.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22104 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
7c93e56560
commit
7f0a43c1e1
2 changed files with 19 additions and 3 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Sat Feb 7 11:57:13 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* runruby.rb: added --precommand and --show options.
|
||||||
|
|
||||||
Sat Feb 7 11:44:06 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sat Feb 7 11:44:06 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/mkmf.rb (have_header): needs dependent headers if trying to
|
* lib/mkmf.rb (have_header): needs dependent headers if trying to
|
||||||
|
|
18
runruby.rb
18
runruby.rb
|
@ -1,6 +1,8 @@
|
||||||
#!./miniruby
|
#!./miniruby
|
||||||
|
|
||||||
pure = true
|
pure = true
|
||||||
|
show = false
|
||||||
|
precommand = []
|
||||||
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
|
||||||
|
@ -16,7 +18,13 @@ while arg = ARGV[0]
|
||||||
when re =~ "pure"
|
when re =~ "pure"
|
||||||
pure = (value != "no")
|
pure = (value != "no")
|
||||||
when re =~ "debugger"
|
when re =~ "debugger"
|
||||||
debugger = value ? (value.split unless value == "no") : %w"gdb --args"
|
require 'shellwords'
|
||||||
|
precommand.concat(value ? (Shellwords.shellwords(value) unless value == "no") : %w"gdb --args")
|
||||||
|
when re =~ "precommand"
|
||||||
|
require 'shellwords'
|
||||||
|
precommand.concat(Shellwords.shellwords(value))
|
||||||
|
when re =~ "show"
|
||||||
|
show = true
|
||||||
else
|
else
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -72,8 +80,12 @@ ENV.update env
|
||||||
cmd = [ruby]
|
cmd = [ruby]
|
||||||
cmd << "-rpurelib.rb" if pure
|
cmd << "-rpurelib.rb" if pure
|
||||||
cmd.concat(ARGV)
|
cmd.concat(ARGV)
|
||||||
cmd.unshift(*debugger) if debugger
|
cmd.unshift(*precommand) unless precommand.empty?
|
||||||
|
|
||||||
#require 'shellwords'; puts Shellwords.join(env.map {|k,v| "#{k}=#{v}" } + cmd)
|
if show
|
||||||
|
require 'shellwords'
|
||||||
|
env.each {|k,v| puts "#{k}=#{v}"}
|
||||||
|
puts Shellwords.join(cmd)
|
||||||
|
end
|
||||||
|
|
||||||
exec(*cmd)
|
exec(*cmd)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue