You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by bo...@apache.org on 2010/03/23 05:59:44 UTC

svn commit: r926463 - in /buildr/trunk: lib/buildr/core/filter.rb spec/core/common_spec.rb

Author: boisvert
Date: Tue Mar 23 04:59:44 2010
New Revision: 926463

URL: http://svn.apache.org/viewvc?rev=926463&view=rev
Log:
filter.using(hash) now correctly substitutes mappings with boolean "false" value

Modified:
    buildr/trunk/lib/buildr/core/filter.rb
    buildr/trunk/spec/core/common_spec.rb

Modified: buildr/trunk/lib/buildr/core/filter.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/filter.rb?rev=926463&r1=926462&r2=926463&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/filter.rb (original)
+++ buildr/trunk/lib/buildr/core/filter.rb Tue Mar 23 04:59:44 2010
@@ -299,7 +299,7 @@ module Buildr
         else
           raise ArgumentError, "Missing hash argument after :#{mapper_type}" unless args.size == 1 && Hash === args[0]
           @config = {} unless Hash === @config
-          @config = @config.merge(args.first)
+          args.first.each_pair { |k, v| @config[k] = v.to_s }
         end
         @mapper_type = mapper_type
       end

Modified: buildr/trunk/spec/core/common_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/common_spec.rb?rev=926463&r1=926462&r2=926463&view=diff
==============================================================================
--- buildr/trunk/spec/core/common_spec.rb (original)
+++ buildr/trunk/spec/core/common_spec.rb Tue Mar 23 04:59:44 2010
@@ -419,6 +419,12 @@ describe Buildr::Filter do
     @filter.using('key1'=>'value1', 'key2'=>'value2').mapper.should eql(:maven)
   end
 
+  it 'should apply hash mapping with boolean values' do
+    write "src/file", "${key1} and ${key2}"
+    @filter.from('src').into('target').using(:key1=>true, :key2=>false).run
+    read("target/file").should eql("true and false")
+  end
+
   it 'should apply hash mapping using regular expression' do
     1.upto(4) { |i| write "src/file#{i}", "file#{i} with #key1# and #key2#" }
     @filter.from('src').into('target').using(/#(.*?)#/, 'key1'=>'value1', 'key2'=>'value2').run