Repository: buildr
Updated Branches:
  refs/heads/master 569578ba4 -> e3fc2671b


BUILDR-674 Artifacts with bundle extension cannot be downloaded by Buildr
Add an indirection to allow changing the type to jar when computing the file 
path of the artifact.

Specifically when the type of the artifact is bundle, use jar instead.
It's possible more expections will appear in this method.


Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/e3fc2671
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/e3fc2671
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/e3fc2671

Branch: refs/heads/master
Commit: e3fc2671b6818c184a8ecc95ad63e5437261bb08
Parents: 569578b
Author: Antoine Toulme <[email protected]>
Authored: Mon May 2 23:41:02 2016 -0700
Committer: Antoine Toulme <[email protected]>
Committed: Mon May 2 23:41:02 2016 -0700

----------------------------------------------------------------------
 CHANGELOG                        | 2 +-
 lib/buildr/packaging/artifact.rb | 7 ++++++-
 spec/packaging/artifact_spec.rb  | 4 ++++
 3 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/e3fc2671/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index e0e76f3..5841258 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -12,7 +12,7 @@
 * Added: BUILDR-577 Allow remote repo to be added with http basic auth 
support. Submitted by Michael Guymon.
 * Fixed: BUILDR-207 remove 'Skipping tests' messages
 * Added: BUILDR-703 release: allow THIS_VERSION to be defined in another file
-
+* Fixed: BUILDR-674 Artifacts with bundle extension cannot be downloaded by 
Buildr
 
 1.4.25 (2016-04-18)
 * Change: BUILDR-712 Update jruby-openssl dependency version or support a 
range of versions

http://git-wip-us.apache.org/repos/asf/buildr/blob/e3fc2671/lib/buildr/packaging/artifact.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/packaging/artifact.rb b/lib/buildr/packaging/artifact.rb
index f696c61..4f18be3 100644
--- a/lib/buildr/packaging/artifact.rb
+++ b/lib/buildr/packaging/artifact.rb
@@ -229,6 +229,11 @@ module Buildr #:nodoc:
     def group_path
       group.gsub('.', '/')
     end
+    
+    def extract_type(type)
+      return :jar if type == :bundle
+      type
+    end
 
   end
 
@@ -335,7 +340,7 @@ module Buildr #:nodoc:
       def hash_to_file_name(hash)
         version = "-#{hash[:version]}" if hash[:version]
         classifier = "-#{hash[:classifier]}" if hash[:classifier]
-        "#{hash[:id]}#{version}#{classifier}.#{hash[:type] || DEFAULT_TYPE}"
+        "#{hash[:id]}#{version}#{classifier}.#{extract_type(hash[:type]) || 
DEFAULT_TYPE}"
       end
 
     end

http://git-wip-us.apache.org/repos/asf/buildr/blob/e3fc2671/spec/packaging/artifact_spec.rb
----------------------------------------------------------------------
diff --git a/spec/packaging/artifact_spec.rb b/spec/packaging/artifact_spec.rb
index c00bdc4..b6bd84d 100644
--- a/spec/packaging/artifact_spec.rb
+++ b/spec/packaging/artifact_spec.rb
@@ -601,6 +601,10 @@ describe Buildr, '#artifact' do
     artifact(@spec.merge(:type=>nil)).should respond_to(:invoke)
   end
 
+  it 'should use JAR type if type is set to bundle' do
+    artifact(@spec.merge(:type=>:bundle)).to_s.should match('\.jar$')
+  end
+
   it 'should accept string specification' do
     artifact('com.example:library:jar:2.0').should respond_to(:invoke)
   end

Reply via email to