* instruby.rb (makedirs): make same directory only once even if

dryrun.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2003-01-25 22:23:17 +00:00
parent 3380618f1c
commit 171df94c27
2 changed files with 17 additions and 3 deletions

View File

@ -1,9 +1,12 @@
Sun Jan 26 06:43:48 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net> Sun Jan 26 07:18:42 2003 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* instruby.rb: re-define individual methods verbosely rather than * instruby.rb: re-define individual methods verbosely rather than
including FileUtils::Verbose, in order to suppress messages from including FileUtils::Verbose, in order to suppress messages from
FileUtils#cmp. FileUtils#cmp.
* instruby.rb (makedirs): make same directory only once even if
dryrun.
* lib/fileutils.rb (FileUtils::Verbose, FileUtils::NoWrite): * lib/fileutils.rb (FileUtils::Verbose, FileUtils::NoWrite):
re-define methods with define_method instead of module_eval. re-define methods with define_method instead of module_eval.

View File

@ -53,10 +53,21 @@ include FileUtils::NoWrite if $dryrun
alias makelink ln_sf alias makelink ln_sf
class << self class << self
body = proc {|*args|super(*args<<:verbose)} body = proc {|*args|super(*args<<:verbose)}
for func in [:install, :makedirs, :makelink] for func in [:install, :makelink]
define_method(func, body) define_method(func, body)
end end
end end
$made_dirs = {}
def makedirs(dirs)
dirs = fu_list(dirs)
dirs.reject! do |dir|
$made_dirs.fetch(dir) do
$made_dirs[dir] = true
File.directory?(dir)
end
end
super(dirs, :verbose) unless dirs.empty?
end
exeext = CONFIG["EXEEXT"] exeext = CONFIG["EXEEXT"]
@ -151,7 +162,7 @@ end
Dir.glob("lib/**/*{.rb,help-message}") do |f| Dir.glob("lib/**/*{.rb,help-message}") do |f|
dir = File.dirname(f).sub!(/\Alib/, rubylibdir) || rubylibdir dir = File.dirname(f).sub!(/\Alib/, rubylibdir) || rubylibdir
makedirs dir unless File.directory? dir makedirs dir
install f, dir, 0644 install f, dir, 0644
end end