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:
parent
cd244d63ca
commit
6e77ae4c13
3 changed files with 47 additions and 1 deletions
11
ChangeLog
11
ChangeLog
|
|
@ -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>
|
Thu Sep 22 23:36:24 2005 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* lib/mkmf.rb (find_executable0): default path if environment is not
|
* lib/mkmf.rb (find_executable0): default path if environment is not
|
||||||
|
|
|
||||||
|
|
@ -1443,6 +1443,8 @@ module FileUtils
|
||||||
end
|
end
|
||||||
private_module_function :fu_output_message
|
private_module_function :fu_output_message
|
||||||
|
|
||||||
|
METHODS = singleton_methods() - ['private_module_function']
|
||||||
|
|
||||||
#
|
#
|
||||||
# Returns an Array of method names which have any options.
|
# Returns an Array of method names which have any options.
|
||||||
#
|
#
|
||||||
|
|
@ -1505,9 +1507,15 @@ module FileUtils
|
||||||
def #{name}(*args)
|
def #{name}(*args)
|
||||||
super(*fu_update_option(args, :verbose => true))
|
super(*fu_update_option(args, :verbose => true))
|
||||||
end
|
end
|
||||||
|
private :#{name}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
extend self
|
extend self
|
||||||
|
class << self
|
||||||
|
::FileUtils::METHODS.each do |m|
|
||||||
|
public m
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
@ -1524,9 +1532,15 @@ module FileUtils
|
||||||
def #{name}(*args)
|
def #{name}(*args)
|
||||||
super(*fu_update_option(args, :noop => true))
|
super(*fu_update_option(args, :noop => true))
|
||||||
end
|
end
|
||||||
|
private :#{name}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
extend self
|
extend self
|
||||||
|
class << self
|
||||||
|
::FileUtils::METHODS.each do |m|
|
||||||
|
public m
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
@ -1544,9 +1558,15 @@ module FileUtils
|
||||||
def #{name}(*args)
|
def #{name}(*args)
|
||||||
super(*fu_update_option(args, :noop => true, :verbose => true))
|
super(*fu_update_option(args, :noop => true, :verbose => true))
|
||||||
end
|
end
|
||||||
|
private :#{name}
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
extend self
|
extend self
|
||||||
|
class << self
|
||||||
|
::FileUtils::METHODS.each do |m|
|
||||||
|
public m
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -5,10 +5,25 @@ require 'fileasserts'
|
||||||
require 'tmpdir'
|
require 'tmpdir'
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
|
||||||
class TestNoWrite < Test::Unit::TestCase
|
class TestFileUtilsNoWrite < Test::Unit::TestCase
|
||||||
|
|
||||||
include FileUtils::NoWrite
|
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)
|
def my_rm_rf(path)
|
||||||
if File.exist?('/bin/rm')
|
if File.exist?('/bin/rm')
|
||||||
system %Q[/bin/rm -rf "#{path}"]
|
system %Q[/bin/rm -rf "#{path}"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue