Author: lacton
Date: Sat Oct 25 09:14:33 2008
New Revision: 707857

URL: http://svn.apache.org/viewvc?rev=707857&view=rev
Log:
BUILDR-164 task 'artifacts:sources' should not try to download sources for the 
project's artifacts

Modified:
    incubator/buildr/trunk/lib/buildr/packaging/artifact.rb
    incubator/buildr/trunk/spec/packaging/artifact_spec.rb

Modified: incubator/buildr/trunk/lib/buildr/packaging/artifact.rb
URL: 
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/packaging/artifact.rb?rev=707857&r1=707856&r2=707857&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/packaging/artifact.rb (original)
+++ incubator/buildr/trunk/lib/buildr/packaging/artifact.rb Sat Oct 25 09:14:33 
2008
@@ -627,7 +627,7 @@
       task.send :apply_spec, spec
       Rake::Task['rake:artifacts'].enhance [task]
       Artifact.register(task)
-      OptionalArtifact.register_source_artifact_for(spec)
+      OptionalArtifact.register_source_artifact_for(spec) unless spec[:type] 
== :pom
     end
     task.enhance &block
   end

Modified: incubator/buildr/trunk/spec/packaging/artifact_spec.rb
URL: 
http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/packaging/artifact_spec.rb?rev=707857&r1=707856&r2=707857&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/packaging/artifact_spec.rb (original)
+++ incubator/buildr/trunk/spec/packaging/artifact_spec.rb Sat Oct 25 09:14:33 
2008
@@ -643,17 +643,24 @@
   before do
     task('artifacts:sources').clear
     repositories.remote = 'http://example.com'
-    artifact 'group:id:jar:1.0'
   end
   
   it 'should download sources for all specified artifacts' do
+    artifact 'group:id:jar:1.0'
     URI.should_receive(:download).any_number_of_times.and_return { |uri, 
target| write target }
     lambda { task('artifacts:sources').invoke }.should change { 
File.exist?('home/.m2/repository/group/id/1.0/id-1.0-sources.jar') }.to(true)
   end
   
+  it "should not try to download sources for the project's artifacts" do
+    define('foo', :version=>'1.0') { package(:jar) }
+    URI.should_not_receive(:download)
+    task('artifacts:sources').invoke
+  end
+  
   describe 'when the source artifact does not exist' do
     
     before do
+      artifact 'group:id:jar:1.0'
       
URI.should_receive(:download).any_number_of_times.and_raise(URI::NotFoundError)
     end
     


Reply via email to