From 171df94c2751146c894fe7cb2812020e17c47fc3 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 25 Jan 2003 22:23:17 +0000 Subject: [PATCH] * 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 --- ChangeLog | 5 ++++- instruby.rb | 15 +++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index e46662866fd87e..e33455e1ca9077 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,12 @@ -Sun Jan 26 06:43:48 2003 Nobuyoshi Nakada +Sun Jan 26 07:18:42 2003 Nobuyoshi Nakada * instruby.rb: re-define individual methods verbosely rather than including FileUtils::Verbose, in order to suppress messages from FileUtils#cmp. + * instruby.rb (makedirs): make same directory only once even if + dryrun. + * lib/fileutils.rb (FileUtils::Verbose, FileUtils::NoWrite): re-define methods with define_method instead of module_eval. diff --git a/instruby.rb b/instruby.rb index 943bfabc367712..7833076f67d9ae 100644 --- a/instruby.rb +++ b/instruby.rb @@ -53,10 +53,21 @@ def parse_args() alias makelink ln_sf class << self body = proc {|*args|super(*args<<:verbose)} - for func in [:install, :makedirs, :makelink] + for func in [:install, :makelink] define_method(func, body) 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"] @@ -151,7 +162,7 @@ class << self Dir.glob("lib/**/*{.rb,help-message}") do |f| dir = File.dirname(f).sub!(/\Alib/, rubylibdir) || rubylibdir - makedirs dir unless File.directory? dir + makedirs dir install f, dir, 0644 end