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

ruby-changes:29894

From: nagachika <ko1@a...>
Date: Sat, 13 Jul 2013 23:33:09 +0900 (JST)
Subject: [ruby-changes:29894] nagachika:r41946 (ruby_2_0_0): merge revision(s) 41853: [Backport #8633]

nagachika	2013-07-13 23:32:56 +0900 (Sat, 13 Jul 2013)

  New Revision: 41946

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41946

  Log:
    merge revision(s) 41853: [Backport #8633]
    
    * lib/fileutils.rb (FileUtils#mode_to_s): Define mode_to_s() also
      as singleton method, or FileUtils.chmod fails in verbose mode.

  Modified directories:
    branches/ruby_2_0_0/
  Modified files:
    branches/ruby_2_0_0/ChangeLog
    branches/ruby_2_0_0/lib/fileutils.rb
    branches/ruby_2_0_0/test/fileutils/test_fileutils.rb
    branches/ruby_2_0_0/version.h

Index: ruby_2_0_0/ChangeLog
===================================================================
--- ruby_2_0_0/ChangeLog	(revision 41945)
+++ ruby_2_0_0/ChangeLog	(revision 41946)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1
+Sat Jul 13 23:29:51 2013  Akinori MUSHA  <knu@i...>
+
+	* lib/fileutils.rb (FileUtils#mode_to_s): Define mode_to_s() also
+	  as singleton method, or FileUtils.chmod fails in verbose mode.
+
 Sat Jul 13 23:27:12 2013  Akinori MUSHA  <knu@i...>
 
 	* lib/fileutils.rb (FileUtils#chown, FileUtils#chown_R): If user
Index: ruby_2_0_0/lib/fileutils.rb
===================================================================
--- ruby_2_0_0/lib/fileutils.rb	(revision 41945)
+++ ruby_2_0_0/lib/fileutils.rb	(revision 41946)
@@ -930,6 +930,7 @@ module FileUtils https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/lib/fileutils.rb#L930
   def mode_to_s(mode)  #:nodoc:
     mode.is_a?(String) ? mode : "%o" % mode
   end
+  private_module_function :mode_to_s
 
   #
   # Options: noop verbose
Index: ruby_2_0_0/version.h
===================================================================
--- ruby_2_0_0/version.h	(revision 41945)
+++ ruby_2_0_0/version.h	(revision 41946)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1
 #define RUBY_VERSION "2.0.0"
 #define RUBY_RELEASE_DATE "2013-07-13"
-#define RUBY_PATCHLEVEL 259
+#define RUBY_PATCHLEVEL 260
 
 #define RUBY_RELEASE_YEAR 2013
 #define RUBY_RELEASE_MONTH 7
Index: ruby_2_0_0/test/fileutils/test_fileutils.rb
===================================================================
--- ruby_2_0_0/test/fileutils/test_fileutils.rb	(revision 41945)
+++ ruby_2_0_0/test/fileutils/test_fileutils.rb	(revision 41946)
@@ -991,7 +991,6 @@ class TestFileUtils https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/fileutils/test_fileutils.rb#L991
   def test_chmod_verbose
     check_singleton :chmod
 
-    r, w = IO.pipe
     stderr_back = $stderr
     read, $stderr = IO.pipe
     th = Thread.new { read.read }
@@ -1009,6 +1008,23 @@ class TestFileUtils https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/fileutils/test_fileutils.rb#L1008
     $stderr = stderr_back if stderr_back
   end if have_file_perm?
 
+  def test_s_chmod_verbose
+    output_back = FileUtils.instance_variable_get(:@fileutils_output)
+    read, write = IO.pipe
+    FileUtils.instance_variable_set(:@fileutils_output, write)
+    th = Thread.new { read.read }
+
+    touch 'tmp/a'
+    FileUtils.chmod 0700, 'tmp/a', verbose: true
+    assert_equal 0700, File.stat('tmp/a').mode & 0777
+
+    write.close
+    lines = th.value.lines.map {|l| l.chomp }
+    assert_equal(["chmod 700 tmp/a"], lines)
+  ensure
+    FileUtils.instance_variable_set(:@fileutils_output, output_back) if output_back
+  end if have_file_perm?
+
   # FIXME: How can I test this method?
   def test_chown
     check_singleton :chown

Property changes on: ruby_2_0_0
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r41853


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

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