summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/fileutils.rb1
-rw-r--r--test/fileutils/test_fileutils.rb18
-rw-r--r--version.h2
4 files changed, 24 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 6551ac3f86..1bc35cb345 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Jul 13 23:29:51 2013 Akinori MUSHA <knu@iDaemons.org>
+
+ * 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@iDaemons.org>
* lib/fileutils.rb (FileUtils#chown, FileUtils#chown_R): If user
diff --git a/lib/fileutils.rb b/lib/fileutils.rb
index 8b001cc6d7..10d8b25d1c 100644
--- a/lib/fileutils.rb
+++ b/lib/fileutils.rb
@@ -930,6 +930,7 @@ module FileUtils
def mode_to_s(mode) #:nodoc:
mode.is_a?(String) ? mode : "%o" % mode
end
+ private_module_function :mode_to_s
#
# Options: noop verbose
diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb
index 54742d1d18..640c3655f4 100644
--- a/test/fileutils/test_fileutils.rb
+++ b/test/fileutils/test_fileutils.rb
@@ -991,7 +991,6 @@ class TestFileUtils
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
$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
diff --git a/version.h b/version.h
index fd195d2791..38ab1ac0b3 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#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