ruby-changes:10549
From: nobu <ko1@a...>
Date: Sat, 7 Feb 2009 11:57:31 +0900 (JST)
Subject: [ruby-changes:10549] Ruby:r22104 (trunk): * runruby.rb: added --precommand and --show options.
nobu 2009-02-07 11:57:15 +0900 (Sat, 07 Feb 2009) New Revision: 22104 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22104 Log: * runruby.rb: added --precommand and --show options. Modified files: trunk/ChangeLog trunk/runruby.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 22103) +++ ChangeLog (revision 22104) @@ -1,3 +1,7 @@ +Sat Feb 7 11:57:13 2009 Nobuyoshi Nakada <nobu@r...> + + * runruby.rb: added --precommand and --show options. + Sat Feb 7 11:44:06 2009 Nobuyoshi Nakada <nobu@r...> * lib/mkmf.rb (have_header): needs dependent headers if trying to Index: runruby.rb =================================================================== --- runruby.rb (revision 22103) +++ runruby.rb (revision 22104) @@ -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 @@ 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 @@ 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/