You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2012/11/07 23:07:16 UTC

svn commit: r1406842 - in /buildr/trunk/lib/buildr/core: application.rb util.rb

Author: donaldp
Date: Wed Nov  7 22:07:15 2012
New Revision: 1406842

URL: http://svn.apache.org/viewvc?rev=1406842&view=rev
Log:
Simplify the way we interact with FileUtils/RakeFileUtils/Rake::DSL to try and avoid reliance on the order in which the dependencies are loaded. Unfortunately there was several problems in different platforms based seemingly on order of files returned from Dir in rubygems library. This attempts to side-step the issue completely

Modified:
    buildr/trunk/lib/buildr/core/application.rb
    buildr/trunk/lib/buildr/core/util.rb

Modified: buildr/trunk/lib/buildr/core/application.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/application.rb?rev=1406842&r1=1406841&r2=1406842&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/application.rb (original)
+++ buildr/trunk/lib/buildr/core/application.rb Wed Nov  7 22:07:15 2012
@@ -679,46 +679,15 @@ module Rake #:nodoc
   end
 end
 
-
-module RakeFileUtils #:nodoc:
-  FileUtils::OPT_TABLE.each do |name, opts|
-    default_options = []
-    if opts.include?(:verbose) || opts.include?("verbose")
-      default_options << ':verbose => RakeFileUtils.verbose_flag == true'
-    end
-    next if default_options.empty?
-    module_eval(<<-EOS, __FILE__, __LINE__ + 1)
-    def #{name}( *args, &block )
-      super(
-        *rake_merge_option(args,
-          #{default_options.join(', ')}
-          ), &block)
+module FileUtils
+  def fu_output_message(msg)   #:nodoc:
+    if Rake::FileUtilsExt::DEFAULT == RakeFileUtils.verbose_flag
+      # Swallow the default output
+    elsif RakeFileUtils.verbose_flag
+      @fileutils_output ||= $stderr
+      @fileutils_label ||= ''
+      @fileutils_output.puts @fileutils_label + msg
     end
-    EOS
   end
-end
-
-
-# It is unclear why this needs to be included on windows but it does seem to be needed.
-# But it can not be included under linux as it rewrites the install command
-if Buildr::Util.win_os?
-
-module Rake::DSL #:nodoc:
-  FileUtils::OPT_TABLE.each do |name, opts|
-    default_options = []
-    if opts.include?(:verbose) || opts.include?("verbose")
-      default_options << ':verbose => RakeFileUtils.verbose_flag == true'
-    end
-    next if default_options.empty?
-    module_eval(<<-EOS, __FILE__, __LINE__ + 1)
-    def #{name}( *args, &block )
-      super(
-        *rake_merge_option(args,
-          #{default_options.join(', ')}
-          ), &block)
-    end
-    EOS
-  end
-end
-
+  private_module_function :fu_output_message
 end

Modified: buildr/trunk/lib/buildr/core/util.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/util.rb?rev=1406842&r1=1406841&r2=1406842&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/util.rb (original)
+++ buildr/trunk/lib/buildr/core/util.rb Wed Nov  7 22:07:15 2012
@@ -285,20 +285,6 @@ if Buildr::Util.java_platform?
     remove_method :error if method_defined?(:error)
   end
 
-  module RakeFileUtils #:nodoc:
-    def rake_merge_option(args, defaults)
-      defaults[:verbose] = false if defaults[:verbose] == Rake::FileUtilsExt::DEFAULT
-
-      if Hash === args.last
-        defaults.update(args.last)
-        args.pop
-      end
-      args.push defaults
-      args
-    end
-    private :rake_merge_option
-  end
-
   module Buildr
     class ProcessStatus
       attr_reader :pid, :termsig, :stopsig, :exitstatus