Author: lacton
Date: Sun Oct 19 14:18:02 2008
New Revision: 706069

URL: http://svn.apache.org/viewvc?rev=706069&view=rev
Log:
BUILDR-164 Added artifact#sources_artifact method

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=706069&r1=706068&r2=706069&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/packaging/artifact.rb (original)
+++ incubator/buildr/trunk/lib/buildr/packaging/artifact.rb Sun Oct 19 14:18:02 
2008
@@ -109,6 +109,15 @@
         xml.classifier    classifier if classifier
       end
     end
+    
+    # :call-seq:
+    #   sources_artifact => Artifact
+    # 
+    # Convenience method that returns the sources artifact corresponding to 
this artifact.
+    def sources_artifact
+      return self if type == :sources
+      Buildr.artifact(:group=>group, :id=>id, :version=>version, 
:type=>:sources)
+    end
 
     def install
       pom.install if pom && pom != self

Modified: incubator/buildr/trunk/spec/packaging/artifact_spec.rb
URL: 
http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/packaging/artifact_spec.rb?rev=706069&r1=706068&r2=706069&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/packaging/artifact_spec.rb (original)
+++ incubator/buildr/trunk/spec/packaging/artifact_spec.rb Sun Oct 19 14:18:02 
2008
@@ -74,6 +74,10 @@
   it 'should have one artifact for all classifiers' do
     @classified.pom.to_hash.should == 
@classified.to_hash.merge(:type=>:pom).except(:classifier)
   end
+  
+  it 'should have associated sources artifact' do
+    @artifact.sources_artifact.to_hash.should == 
@artifact.to_hash.merge(:type=>:sources)
+  end
 
   it 'should download file if file does not exist' do
     lambda { @artifact.invoke }.should raise_error(Exception, /No remote 
repositories/)
@@ -638,6 +642,11 @@
 end
 
 
+describe Rake::Task, ' sources' do
+  it 'should download all sources'
+end
+
+
 describe Buildr, '#transitive' do
   before do
     repositories.remote = 'http://example.com'


Reply via email to