buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boisv...@apache.org
Subject svn commit: r1200853 - in /buildr/trunk: CHANGELOG lib/buildr/packaging/artifact.rb spec/packaging/artifact_spec.rb
Date Fri, 11 Nov 2011 12:31:43 GMT
Author: boisvert
Date: Fri Nov 11 12:31:43 2011
New Revision: 1200853

URL: http://svn.apache.org/viewvc?rev=1200853&view=rev
Log:
Buildr.artifacts() should handle any object with :to_spec method
(i.e., any object that ActsAsArtifact)

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

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1200853&r1=1200852&r2=1200853&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Fri Nov 11 12:31:43 2011
@@ -1,4 +1,6 @@
 1.4.7 (Pending)
+* Fixed:  Buildr.artifacts() should handle any object with :to_spec method
+          (i.e., any object that ActsAsArtifact)
 * Fixed:  Handle HTTP Unauthorized (501) result code when downloading artifacts.
 * Change: Make it possible to parameterize the JDepend extension and control the projects
that
           are included in the analysis and to enable support for loading a per project

Modified: buildr/trunk/lib/buildr/packaging/artifact.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/packaging/artifact.rb?rev=1200853&r1=1200852&r2=1200853&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/packaging/artifact.rb (original)
+++ buildr/trunk/lib/buildr/packaging/artifact.rb Fri Nov 11 12:31:43 2011
@@ -802,7 +802,11 @@ module Buildr
       when Struct
         set |= artifacts(spec.values)
       else
-        fail "Invalid artifact specification in #{specs.inspect}"
+        if spec.respond_to? :to_spec
+          set |= artifacts(spec.to_spec)
+        else
+          fail "Invalid artifact specification in #{specs.inspect}"
+        end
       end
     end
   end

Modified: buildr/trunk/spec/packaging/artifact_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/packaging/artifact_spec.rb?rev=1200853&r1=1200852&r2=1200853&view=diff
==============================================================================
--- buildr/trunk/spec/packaging/artifact_spec.rb (original)
+++ buildr/trunk/spec/packaging/artifact_spec.rb Fri Nov 11 12:31:43 2011
@@ -690,6 +690,14 @@ describe Buildr, '#artifacts' do
     artifacts('c:test').first.should be_kind_of(String)
   end
 
+  it 'should accept any object responding to :to_spec' do
+    obj = Object.new
+    class << obj
+      def to_spec; "org.example:artifact:jar:1.1"; end
+    end
+    artifacts(obj).size.should be(1)
+  end
+
   it 'should accept project and return all its packaging tasks' do
     define 'foobar', :group=>'group', :version=>'1.0' do
       package :jar, :id=>'code'



Mime
View raw message