зеркало из https://github.com/github/ruby.git
* 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:
Родитель
7c93e56560
Коммит
7f0a43c1e1
|
@ -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>
|
||||
|
||||
* lib/mkmf.rb (have_header): needs dependent headers if trying to
|
||||
|
|
18
runruby.rb
18
runruby.rb
|
@ -1,6 +1,8 @@
|
|||
#!./miniruby
|
||||
|
||||
pure = true
|
||||
show = false
|
||||
precommand = []
|
||||
while arg = ARGV[0]
|
||||
break ARGV.shift if arg == '--'
|
||||
/\A--([-\w]+)(?:=(.*))?\z/ =~ arg or break
|
||||
|
@ -16,7 +18,13 @@ while arg = ARGV[0]
|
|||
when re =~ "pure"
|
||||
pure = (value != "no")
|
||||
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
|
||||
break
|
||||
end
|
||||
|
@ -72,8 +80,12 @@ ENV.update env
|
|||
cmd = [ruby]
|
||||
cmd << "-rpurelib.rb" if pure
|
||||
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)
|
||||
|
|
Загрузка…
Ссылка в новой задаче