[前][次][番号順一覧][スレッド一覧]

ruby-changes:3953

From: ko1@a...
Date: Tue, 12 Feb 2008 15:28:52 +0900 (JST)
Subject: [ruby-changes:3953] naruse - Ruby:r15443 (trunk): * bootstraptest/runner.rb, bootstraptest/test_method.rb, enc/depend,

naruse	2008-02-12 15:28:23 +0900 (Tue, 12 Feb 2008)

  New Revision: 15443

  Modified files:
    trunk/ChangeLog
    trunk/bootstraptest/runner.rb
    trunk/bootstraptest/test_method.rb
    trunk/enc/depend
    trunk/instruby.rb
    trunk/lib/mkmf.rb
    trunk/lib/test/unit/util/procwrapper.rb
    trunk/mkconfig.rb
    trunk/sample/test.rb
    trunk/template/vm.inc.tmpl
    trunk/test/ruby/test_stringchar.rb

  Log:
    * bootstraptest/runner.rb, bootstraptest/test_method.rb, enc/depend,
    instruby.rb, lib/mkmf.rb, lib/test/unit/util/procwrapper.rb,
    mkconfig.rb, sample/test.rb, template/vm.inc.tmpl,
    test/ruby/test_stringchar.rb: fixes arround String#gsub.

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/sample/test.rb?r1=15443&r2=15442&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15443&r2=15442&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/bootstraptest/test_method.rb?r1=15443&r2=15442&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/bootstraptest/runner.rb?r1=15443&r2=15442&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/test/unit/util/procwrapper.rb?r1=15443&r2=15442&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/template/vm.inc.tmpl?r1=15443&r2=15442&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/lib/mkmf.rb?r1=15443&r2=15442&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_stringchar.rb?r1=15443&r2=15442&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/mkconfig.rb?r1=15443&r2=15442&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/instruby.rb?r1=15443&r2=15442&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/enc/depend?r1=15443&r2=15442&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 15442)
+++ ChangeLog	(revision 15443)
@@ -1,3 +1,11 @@
+Tue Feb 12 15:27:19 2008  NARUSE, Yui  <naruse@r...>
+
+	* bootstraptest/runner.rb, bootstraptest/test_method.rb, enc/depend,
+	instruby.rb, lib/mkmf.rb, lib/test/unit/util/procwrapper.rb,
+	mkconfig.rb, sample/test.rb, template/vm.inc.tmpl,
+	test/ruby/test_stringchar.rb: fixes arround String#gsub.
+
+
 Tue Feb 12 15:11:47 2008  NARUSE, Yui  <naruse@r...>
 
 	* ext/json/lib/json/pure/generator.rb,
Index: mkconfig.rb
===================================================================
--- mkconfig.rb	(revision 15442)
+++ mkconfig.rb	(revision 15443)
@@ -150,7 +150,8 @@
   MAKEFILE_CONFIG = {}
   CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
   def RbConfig::expand(val, config = CONFIG)
-    val.gsub!(/\\$\\$|\\$\\(([^()]+)\\)|\\$\\{([^{}]+)\\}/) do |var|
+    val.gsub!(/\\$\\$|\\$\\(([^()]+)\\)|\\$\\{([^{}]+)\\}/) do
+      var = $&
       if !(v = $1 || $2)
 	'$'
       elsif key = config[v = v[/\\A[^:]+(?=(?::(.*?)=(.*))?\\z)/]]
@@ -158,7 +159,7 @@
 	config[v] = false
 	RbConfig::expand(key, config)
 	config[v] = key
-	key = key.gsub(/\#{Regexp.quote(pat)}(?=\\s|\\z)/n) {sub} if pat
+	key = key.gsub(/\#{Regexp.quote(pat)}(?=\\s|\\z)/n, sub) if pat
 	key
       else
 	var
Index: enc/depend
===================================================================
--- enc/depend	(revision 15442)
+++ enc/depend	(revision 15443)
@@ -46,12 +46,12 @@
 	echo EXPORTS > <%=df%>
 	echo <%=EXPORT_PREFIX%>Init_<%=File.basename(e)%> >> <%=df%>
 %   end
-	<%=link_so.sub(/\$\(OBJS\)/) {obj}.sub(/\$\(DEFFILE\)/) {df}.gsub(/-(?:implib|pdb):/) {|s|"#{s}enc/#{e.sub(/[^\/]+\z/, '')}"}%>
+	<%=link_so.sub(/\$\(OBJS\)/, obj).sub(/\$\(DEFFILE\)/, df.to_s).gsub(/-(?:implib|pdb):/, "\\1enc/#{e.sub(/[^\/]+\z/, '')}")%>
 
 % end
 % dependencies.each do |e|
 enc/<%=e%>.$(OBJEXT): $(srcdir)/enc/<%=e%>.c
-	<%=COMPILE_C.sub(/\$\(<(?:.*)\)/) {"$(srcdir)/enc/#{e}.c"}%>
+	<%=COMPILE_C.sub(/\$\(<(?:.*)\)/, "$(srcdir)/enc/#{e}.c")%>
 % end
 
 clean:
Index: bootstraptest/test_method.rb
===================================================================
--- bootstraptest/test_method.rb	(revision 15442)
+++ bootstraptest/test_method.rb	(revision 15443)
@@ -657,7 +657,7 @@
 
 
 tests.each{|setup, methods| setup = setup.dup; setup.strip!
-  setup = BASE.gsub(/<TEST>/){setup}
+  setup = BASE.gsub(/<TEST>/, setup)
   methods.split(/\n/).each{|m| m = m.dup; m.strip!
     next if m.empty?
     expr = "#{setup}; #{m}"
Index: bootstraptest/runner.rb
===================================================================
--- bootstraptest/runner.rb	(revision 15442)
+++ bootstraptest/runner.rb	(revision 15443)
@@ -264,7 +264,7 @@
 end
 
 def untabify(str)
-  str.gsub(/^\t+/) {|tabs| ' ' * (8 * tabs.size) }
+  str.gsub(/^\t+/) {' ' * (8 * $&.size) }
 end
 
 def make_srcfile(src)
Index: sample/test.rb
===================================================================
--- sample/test.rb	(revision 15442)
+++ sample/test.rb	(revision 15443)
@@ -1495,7 +1495,7 @@
 ABCD
 ABCD
 END
-$x.gsub!(/((.|\n)*?)B((.|\n)*?)D/){$1+$3}
+$x.gsub!(/((.|\n)*?)B((.|\n)*?)D/, '\1\3')
 test_ok($x == "AC\nAC\n")
 
 test_ok("foobar" =~ /foo(?=(bar)|(baz))/)
Index: lib/mkmf.rb
===================================================================
--- lib/mkmf.rb	(revision 15442)
+++ lib/mkmf.rb	(revision 15443)
@@ -1512,10 +1512,10 @@
         f.gsub!("/", sep)
         dir.gsub!("/", sep)
         sep = ":/="+sep
-        f.gsub!(/(\$\(\w+)(\))/) {$1+sep+$2}
-        f.gsub!(/(\$\{\w+)(\})/) {$1+sep+$2}
-        dir.gsub!(/(\$\(\w+)(\))/) {$1+sep+$2}
-        dir.gsub!(/(\$\{\w+)(\})/) {$1+sep+$2}
+        f.gsub!(/(\$\(\w+)(\))/, "\\1#{sep}\\2")
+        f.gsub!(/(\$\{\w+)(\})/, "\\1#{sep}\\2")
+        dir.gsub!(/(\$\(\w+)(\))/, "\\1#{sep}\\2")
+        dir.gsub!(/(\$\{\w+)(\})/, "\\1#{sep}\\2")
       end
       mfile.print "\t$(INSTALL_PROG) #{f} #{dir}\n"
       if defined?($installed_list)
@@ -1546,8 +1546,8 @@
 	if sep
 	  f = f.gsub("/", sep)
 	  sep = ":/="+sep
-	  f = f.gsub(/(\$\(\w+)(\))/) {$1+sep+$2}
-	  f = f.gsub(/(\$\{\w+)(\})/) {$1+sep+$2}
+	  f = f.gsub(/(\$\(\w+)(\))/, "\\1#{sep}\\2")
+	  f = f.gsub(/(\$\{\w+)(\})/, "\\1#{sep}\\2")
 	else
 	  sep = ""
 	end
Index: lib/test/unit/util/procwrapper.rb
===================================================================
--- lib/test/unit/util/procwrapper.rb	(revision 15442)
+++ lib/test/unit/util/procwrapper.rb	(revision 15443)
@@ -22,7 +22,7 @@
         # Creates a new wrapper for a_proc.
         def initialize(a_proc)
           @a_proc = a_proc
-          @hash = a_proc.inspect.sub(/^(#<#{a_proc.class}:)/){''}.sub(/(>)$/){''}.hex
+          @hash = a_proc.inspect.sub(/^(#<#{a_proc.class}:)/, '').sub(/(>)$/, '').hex
         end
 
         def hash # :nodoc:
Index: instruby.rb
===================================================================
--- instruby.rb	(revision 15442)
+++ instruby.rb	(revision 15443)
@@ -275,7 +275,7 @@
       shebang = f.gets
       body = f.read
 
-      if shebang.sub!(/^\#!.*?ruby\b/) {"#!" + ruby_shebang}
+      if shebang.sub!(/^\#!.*?ruby\b/, "#!" + ruby_shebang)
         f.rewind
         f.print shebang, body
         f.truncate(f.pos)
Index: test/ruby/test_stringchar.rb
===================================================================
--- test/ruby/test_stringchar.rb	(revision 15442)
+++ test/ruby/test_stringchar.rb	(revision 15443)
@@ -34,7 +34,7 @@
 ABCD
 ABCD
 END
-    $x.gsub!(/((.|\n)*?)B((.|\n)*?)D/){$1+$3}
+    $x.gsub!(/((.|\n)*?)B((.|\n)*?)D/m ,'\1\3')
     assert_equal("AC\nAC\n", $x)
 
     assert("foobar" =~ /foo(?=(bar)|(baz))/)
Index: template/vm.inc.tmpl
===================================================================
--- template/vm.inc.tmpl	(revision 15442)
+++ template/vm.inc.tmpl	(revision 15443)
@@ -13,7 +13,8 @@
 
 <%=
 line = 15
-vm_body.gsub(/\n|__CURRENT_LINE__|__CURRENT_FILE__/){|e|
+vm_body.gsub(/\n|__CURRENT_LINE__|__CURRENT_FILE__/){
+  e = $&
   case e
   when '__CURRENT_LINE__'
     line.to_s

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]