buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boisv...@apache.org
Subject svn commit: r1006249 - in /buildr/trunk: lib/buildr/java/packaging.rb spec/java/packaging_spec.rb
Date Sun, 10 Oct 2010 04:26:57 GMT
Author: boisvert
Date: Sun Oct 10 04:26:57 2010
New Revision: 1006249

URL: http://svn.apache.org/viewvc?rev=1006249&view=rev
Log:
BUILDR-527: package(:war) if libs passed are files (instead of artifacts)

Modified:
    buildr/trunk/lib/buildr/java/packaging.rb
    buildr/trunk/spec/java/packaging_spec.rb

Modified: buildr/trunk/lib/buildr/java/packaging.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/java/packaging.rb?rev=1006249&r1=1006248&r2=1006249&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/java/packaging.rb (original)
+++ buildr/trunk/lib/buildr/java/packaging.rb Sun Oct 10 04:26:57 2010
@@ -257,7 +257,7 @@ module Buildr
           @classes = []
           @libs = []
           enhance do |war|
-            @libs.each {|lib| lib.invoke}
+            @libs.each {|lib| lib.invoke if lib.respond_to?(:invoke) }
             @classes.to_a.flatten.each { |classes| include classes, :as => 'WEB-INF/classes'
}
             path('WEB-INF/lib').include Buildr.artifacts(@libs) unless @libs.nil? || @libs.empty?
           end

Modified: buildr/trunk/spec/java/packaging_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/java/packaging_spec.rb?rev=1006249&r1=1006248&r2=1006249&view=diff
==============================================================================
--- buildr/trunk/spec/java/packaging_spec.rb (original)
+++ buildr/trunk/spec/java/packaging_spec.rb Sun Oct 10 04:26:57 2010
@@ -567,12 +567,19 @@ describe Packaging, 'war' do
   end
 
   it 'should accept file from :libs option' do
+    write 'lib/foo.jar'
+    define('foo', :version=>'1.0') { package(:war).libs << 'lib/foo.jar' }
+    inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/foo.jar')
}
+  end
+
+
+  it 'should accept artifacts from :libs option' do
     make_jars
     define('foo', :version=>'1.0') { package(:war).with(:libs=>'group:id:jar:1.0')
}
     inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/id-1.0.jar')
}
   end
 
-  it 'should accept file from :libs option' do
+  it 'should accept artifacts from :libs option' do
     make_jars
     define('foo', :version=>'1.0') { package(:war).with(:libs=>['group:id:jar:1.0',
'group:id:jar:2.0']) }
     inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/id-1.0.jar',
'WEB-INF/lib/id-2.0.jar') }
@@ -601,25 +608,25 @@ describe Packaging, 'war' do
     define('foo', :version=>'1.0') { compile.with 'group:id:jar:1.0', 'group:id:jar:2.0'
; package(:war).exclude('**/id-2.0.jar')   }
     inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/id-1.0.jar')
}
   end
-  
+
   it 'should exclude files regardless of the path where they are included, specifying target
path entirely' do
      make_jars
      define('foo', :version=>'1.0') { compile.with 'group:id:jar:1.0', 'group:id:jar:2.0'
; package(:war).exclude('WEB-INF/lib/id-2.0.jar')   }
      inspect_war { |files| files.should include('META-INF/MANIFEST.MF', 'WEB-INF/lib/id-1.0.jar')
}
    end
-  
-  it 'should exclude files regardless of the path where they are included for war files'
do 
-     write 'src/main/java/com/example/included/Test.java', 'package com.example.included;
class Test {}' 
-     write 'src/main/java/com/example/excluded/Test.java', 'package com.example.excluded;
class Test {}' 
-     define('foo', :version=>'1.0') do 
-       package(:war).enhance do |war| 
+
+  it 'should exclude files regardless of the path where they are included for war files'
do
+     write 'src/main/java/com/example/included/Test.java', 'package com.example.included;
class Test {}'
+     write 'src/main/java/com/example/excluded/Test.java', 'package com.example.excluded;
class Test {}'
+     define('foo', :version=>'1.0') do
+       package(:war).enhance do |war|
          war.exclude('WEB-INF/classes/com/example/excluded/**.class')
        end
-     end 
-     inspect_war do |files| 
-       files.should include('WEB-INF/classes/com/example/included/Test.class') 
-       files.should_not include('WEB-INF/classes/com/example/excluded/Test.class') 
-     end 
+     end
+     inspect_war do |files|
+       files.should include('WEB-INF/classes/com/example/included/Test.class')
+       files.should_not include('WEB-INF/classes/com/example/excluded/Test.class')
+     end
    end
 
   it 'should include only specified libraries' do



Mime
View raw message