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 2009/11/20 20:05:14 UTC

svn commit: r882676 - in /buildr/trunk: CHANGELOG lib/buildr/core/filter.rb spec/core/compile_spec.rb

Author: boisvert
Date: Fri Nov 20 19:04:53 2009
New Revision: 882676

URL: http://svn.apache.org/viewvc?rev=882676&view=rev
Log:
BUILDR-349 resources.filter should use defaults from profile.yaml even if
mapping is provided

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/core/filter.rb
    buildr/trunk/spec/core/compile_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=882676&r1=882675&r2=882676&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Fri Nov 20 19:04:53 2009
@@ -28,6 +28,8 @@
 * Fixed:  BUILDR-346 Test classpath can not be set (Peter Schröder)
 * Fixed:  BUILDR-347 Compile.from does not work correctly with FileTask when
           no compiler is set (Peter Schröder)
+* Fixed:  BUILDR-349 resources.filter should use defaults from profile.yaml
+          even if mapping is provided
 
 1.3.5 (2009-10-05)
 * Added:  Interactive shell (REPL) support

Modified: buildr/trunk/lib/buildr/core/filter.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/filter.rb?rev=882676&r1=882675&r2=882676&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/filter.rb (original)
+++ buildr/trunk/lib/buildr/core/filter.rb Fri Nov 20 19:04:53 2009
@@ -285,7 +285,8 @@
           @config = configurer.call(*args, &block)
         else
           raise ArgumentError, "Missing hash argument after :#{mapper_type}" unless args.size == 1 && Hash === args[0]
-          @config = args.first
+          @config = {} unless Hash === @config
+          @config = @config.merge(args.first)
         end
         @mapper_type = mapper_type
       end

Modified: buildr/trunk/spec/core/compile_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/core/compile_spec.rb?rev=882676&r1=882675&r2=882676&view=diff
==============================================================================
--- buildr/trunk/spec/core/compile_spec.rb (original)
+++ buildr/trunk/spec/core/compile_spec.rb Fri Nov 20 19:04:53 2009
@@ -592,4 +592,33 @@
     define('foo').compile.invoke
     file('target/resources/foo').should contain('bar')
   end
+
+  it 'should use current profile as default for filtering' do
+    write 'profiles.yaml', <<-YAML
+      development:
+        filter:
+          foo: bar
+    YAML
+    write 'src/main/resources/foo', '${foo} ${baz}'
+    define('foo') do
+      resources.filter.using 'baz' => 'qux'
+    end
+    project('foo').compile.invoke
+    file('target/resources/foo').should contain('bar qux')
+  end
+
+  it 'should allow clearing default filter mapping' do
+    write 'profiles.yaml', <<-YAML
+      development:
+        filter:
+          foo: bar
+    YAML
+    write 'src/main/resources/foo', '${foo} ${baz}'
+    define('foo') do
+      resources.filter.mapping.clear
+      resources.filter.using 'baz' => 'qux'
+    end
+    project('foo').compile.invoke
+    file('target/resources/foo').should contain('${foo} qux')
+  end
 end