1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/fileutils.rb: fix visibility of FileUtils::NoWrite, Verbose, DryRun (backported from trunk, rev 1.66). [ruby-core:05954]

* test/fileutils/test_nowrite.rb: test it.
* test/fileutils/test_dryrun.rb: new file.
* test/fileutils/test_verbose.rb: new file.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
aamine 2005-09-23 23:39:01 +00:00
parent cd244d63ca
commit 6e77ae4c13
3 changed files with 47 additions and 1 deletions

View file

@ -1,3 +1,14 @@
Sat Sep 24 08:38:07 2005 Minero Aoki <aamine@loveruby.net>
* lib/fileutils.rb: fix visibility of FileUtils::NoWrite, Verbose,
DryRun (backported from trunk, rev 1.66). [ruby-core:05954]
* test/fileutils/test_nowrite.rb: test it.
* test/fileutils/test_dryrun.rb: new file.
* test/fileutils/test_verbose.rb: new file.
Thu Sep 22 23:36:24 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/mkmf.rb (find_executable0): default path if environment is not

View file

@ -1443,6 +1443,8 @@ module FileUtils
end
private_module_function :fu_output_message
METHODS = singleton_methods() - ['private_module_function']
#
# Returns an Array of method names which have any options.
#
@ -1505,9 +1507,15 @@ module FileUtils
def #{name}(*args)
super(*fu_update_option(args, :verbose => true))
end
private :#{name}
EOS
end
extend self
class << self
::FileUtils::METHODS.each do |m|
public m
end
end
end
#
@ -1524,9 +1532,15 @@ module FileUtils
def #{name}(*args)
super(*fu_update_option(args, :noop => true))
end
private :#{name}
EOS
end
extend self
class << self
::FileUtils::METHODS.each do |m|
public m
end
end
end
#
@ -1544,9 +1558,15 @@ module FileUtils
def #{name}(*args)
super(*fu_update_option(args, :noop => true, :verbose => true))
end
private :#{name}
EOS
end
extend self
class << self
::FileUtils::METHODS.each do |m|
public m
end
end
end
end

View file

@ -5,10 +5,25 @@ require 'fileasserts'
require 'tmpdir'
require 'test/unit'
class TestNoWrite < Test::Unit::TestCase
class TestFileUtilsNoWrite < Test::Unit::TestCase
include FileUtils::NoWrite
def test_visibility
FileUtils::METHODS.each do |m|
assert_equal true, FileUtils::NoWrite.respond_to?(m, true),
"FileUtils::NoWrite.#{m} is not defined"
assert_equal true, FileUtils::NoWrite.respond_to?(m, false),
"FileUtils::NoWrite.#{m} is not public"
end
FileUtils::METHODS.each do |m|
assert_equal true, respond_to?(m, true),
"FileUtils::NoWrite\##{m} is not defined"
assert_equal true, FileUtils::NoWrite.private_method_defined?(m),
"FileUtils::NoWrite\##{m} is not private"
end
end
def my_rm_rf(path)
if File.exist?('/bin/rm')
system %Q[/bin/rm -rf "#{path}"]