Author: assaf
Date: Fri Jul 25 17:07:16 2008
New Revision: 679935

URL: http://svn.apache.org/viewvc?rev=679935&view=rev
Log:
Fixed: BUILDR-106 download(artifact(...)=>url) broken (Lacton)

Modified:
    incubator/buildr/trunk/CHANGELOG
    incubator/buildr/trunk/lib/buildr/core/common.rb
    incubator/buildr/trunk/spec/common_spec.rb

Modified: incubator/buildr/trunk/CHANGELOG
URL: 
http://svn.apache.org/viewvc/incubator/buildr/trunk/CHANGELOG?rev=679935&r1=679934&r2=679935&view=diff
==============================================================================
--- incubator/buildr/trunk/CHANGELOG (original)
+++ incubator/buildr/trunk/CHANGELOG Fri Jul 25 17:07:16 2008
@@ -3,6 +3,8 @@
 * Changed: Error reporting now shows 'buildr aborted!' (used to say rake),
 more of the stack trace without running --trace, and when running with
 supported terminal, error message is red.
+* Fixed: BUILDR-106 download(artifact(...)=>url) broken in certain cases
+(Lacton).
 
 1.3.2 (2008-07-18)
 * Added: --prereqs command line argument to show all tasks and their

Modified: incubator/buildr/trunk/lib/buildr/core/common.rb
URL: 
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/common.rb?rev=679935&r1=679934&r2=679935&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/common.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/common.rb Fri Jul 25 17:07:16 2008
@@ -111,7 +111,7 @@
       # Download to a file created by the task.
       fail unless args.keys.size == 1
       uri = URI.parse(args.values.first.to_s)
-      file(args.keys.first).tap do |task|
+      file(args.keys.first.to_s).tap do |task|
         task.sources << uri
         task.enhance { uri.download task.name }
       end

Modified: incubator/buildr/trunk/spec/common_spec.rb
URL: 
http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/common_spec.rb?rev=679935&r1=679934&r2=679935&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/common_spec.rb (original)
+++ incubator/buildr/trunk/spec/common_spec.rb Fri Jul 25 17:07:16 2008
@@ -110,42 +110,62 @@
   end
 
   it 'should accept a String and download from that URL' do
-    download('http://localhost/download').tap do |task|
-      task.source.should_receive(:read).and_yield [EMAIL PROTECTED]
-      task.invoke
-      task.should contain(@content)
+    define 'foo' do
+      download('http://localhost/download').tap do |task|
+        task.source.should_receive(:read).and_yield [EMAIL PROTECTED]
+        task.invoke
+        task.should contain(@content)
+      end
     end
   end
 
   it 'should accept a URI and download from that URL' do
-    download(URI.parse('http://localhost/download')).tap do |task|
-      task.source.should_receive(:read).and_yield [EMAIL PROTECTED]
-      task.invoke
-      task.should contain(@content)
+    define 'foo' do
+      download(URI.parse('http://localhost/download')).tap do |task|
+        task.source.should_receive(:read).and_yield [EMAIL PROTECTED]
+        task.invoke
+        task.should contain(@content)
+      end
     end
   end
 
   it 'should accept a path and String and download from that URL' do
-    download('downloaded'=>'http://localhost/download').tap do |task|
-      task.source.should_receive(:read).and_yield [EMAIL PROTECTED]
-      task.invoke
-      task.should contain(@content)
+    define 'foo' do
+      download('downloaded'=>'http://localhost/download').tap do |task|
+        task.source.should_receive(:read).and_yield [EMAIL PROTECTED]
+        task.invoke
+        task.should contain(@content)
+      end
+    end
+  end
+
+  it 'should accept an artifact and String and download from that URL' do
+    define 'foo' do
+      artifact('com.example:library:jar:2.0').tap do |artifact|
+        
download(artifact=>'http://localhost/download').source.should_receive(:read).and_yield
 [EMAIL PROTECTED]
+        artifact.invoke
+        artifact.should contain(@content)
+      end
     end
   end
 
   it 'should accept a path and URI and download from that URL' do
-    download('downloaded'=>URI.parse('http://localhost/download')).tap do 
|task|
-      task.source.should_receive(:read).and_yield [EMAIL PROTECTED]
-      task.invoke
-      task.should contain(@content)
+    define 'foo' do
+      download('downloaded'=>URI.parse('http://localhost/download')).tap do 
|task|
+        task.source.should_receive(:read).and_yield [EMAIL PROTECTED]
+        task.invoke
+        task.should contain(@content)
+      end
     end
   end
 
   it 'should create path for download' do
-    download('path/downloaded'=>URI.parse('http://localhost/download')).tap do 
|task|
-      task.source.should_receive(:read).and_yield [EMAIL PROTECTED]
-      task.invoke
-      task.should contain(@content)
+    define 'foo' do
+      download('path/downloaded'=>URI.parse('http://localhost/download')).tap 
do |task|
+        task.source.should_receive(:read).and_yield [EMAIL PROTECTED]
+        task.invoke
+        task.should contain(@content)
+      end
     end
   end
 
@@ -166,10 +186,12 @@
   end
 
   it 'should execute only if file does not already exist' do
-    download('downloaded'=>'http://localhost/download').tap do |task|
-      task.source.should_not_receive(:read)
-      write task.to_s, 'not really'
-      task.invoke
+    define 'foo' do
+      download('downloaded'=>'http://localhost/download').tap do |task|
+        task.source.should_not_receive(:read)
+        write task.to_s, 'not really'
+        task.invoke
+      end
     end
   end
 


Reply via email to