From 1f267f1ee5cac23ca05baade186d20f8ad726cf2 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 25 Jan 2003 21:42:42 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- instruby.rb | 8 +++++++- lib/fileutils.rb | 34 ++++++++++++++++------------------ 2 files changed, 23 insertions(+), 19 deletions(-) diff --git a/instruby.rb b/instruby.rb index 16caec158f..943bfabc36 100644 --- a/instruby.rb +++ b/instruby.rb @@ -46,11 +46,17 @@ end parse_args() -include FileUtils::Verbose +include FileUtils include FileUtils::NoWrite if $dryrun @fileutils_output = STDOUT @fileutils_label = '' alias makelink ln_sf +class << self + body = proc {|*args|super(*args<<:verbose)} + for func in [:install, :makedirs, :makelink] + define_method(func, body) + end +end exeext = CONFIG["EXEEXT"] diff --git a/lib/fileutils.rb b/lib/fileutils.rb index c4f695aadf..5c7b216b92 100644 --- a/lib/fileutils.rb +++ b/lib/fileutils.rb @@ -776,17 +776,16 @@ module FileUtils @fileutils_label = 'fileutils.' @fileutils_verbose = true + body = proc do |*args| + unless defined? @fileutils_verbose + @fileutils_verbose = true + end + args.push :verbose if @fileutils_verbose + super(*args) + end FileUtils::OPT_TABLE.each do |name, opts| next unless opts.include? 'verbose' - module_eval(<<-End, __FILE__, __LINE__ + 1) - def #{name}( *args ) - unless defined? @fileutils_verbose - @fileutils_verbose = true - end - args.push :verbose if @fileutils_verbose - super(*args) - end - End + define_method(name, body) end extend self @@ -807,17 +806,16 @@ module FileUtils @fileutils_label = 'fileutils.' @fileutils_nowrite = true + body = proc do |*args| + unless defined? @fileutils_nowrite + @fileutils_nowrite = true + end + args.push :noop if @fileutils_nowrite + super(*args) + end FileUtils::OPT_TABLE.each do |name, opts| next unless opts.include? 'noop' - module_eval(<<-End, __FILE__, __LINE__ + 1) - def #{name}( *args ) - unless defined? @fileutils_nowrite - @fileutils_nowrite = true - end - args.push :noop if @fileutils_nowrite - super(*args) - end - End + define_method(name, body) end extend self