Author: boisvert
Date: Thu Dec  9 01:33:43 2010
New Revision: 1043812

URL: http://svn.apache.org/viewvc?rev=1043812&view=rev
Log:
BUILDR-558 Artifact uploads should show a progress bar (Tammo van Lessen)

Also fixes display of filename during upload.

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/core/transports.rb

Modified: buildr/trunk/CHANGELOG
URL: 
http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1043812&r1=1043811&r2=1043812&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Thu Dec  9 01:33:43 2010
@@ -31,6 +31,7 @@
           application.xml contained within an ear.
 * Fixed:  BUILDR-547 - Ensure ECJ compiler works when there is a space in the
           path of dependencies.
+* Fixed:  BUILDR-558 Artifact uploads should show a progress bar (Tammo van 
Lessen)
 
 1.4.4 (2010-11-16)
 * Change: BUILDR-549 Upgrade to RJB 1.3.3 to address "Cannot create JVM" issue 
with Java Update 3

Modified: buildr/trunk/lib/buildr/core/transports.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/core/transports.rb?rev=1043812&r1=1043811&r2=1043812&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/core/transports.rb (original)
+++ buildr/trunk/lib/buildr/core/transports.rb Thu Dec  9 01:33:43 2010
@@ -214,7 +214,7 @@ module URI
       elsif source.respond_to?(:read)
         digests = (options[:digests] || [:md5, :sha1]).
           inject({}) { |hash, name| hash[name] = 
Digest.const_get(name.to_s.upcase).new ; hash }
-        size = source.size rescue nil
+        size = source.stat.size rescue nil
         write (options).merge(:progress=>verbose && size, :size=>size) do 
|bytes|
           source.read(bytes).tap do |chunk|
             digests.values.each { |digest| digest << chunk } if chunk
@@ -406,7 +406,7 @@ module URI
           SFTP.passwords[host] = ssh_options[:password]
           trace 'connected'
 
-          with_progress_bar options[:progress] && options[:size], 
path.split('/'), options[:size] || 0 do |progress|
+          with_progress_bar options[:progress] && options[:size], 
path.split('/').last, options[:size] || 0 do |progress|
             trace "Downloading from #{path}"
             sftp.file.open(path, 'r') do |file|
               while chunk = file.read(RW_CHUNK_SIZE)
@@ -450,7 +450,7 @@ module URI
             "#{combined}/"
           end
 
-          with_progress_bar options[:progress] && options[:size], 
path.split('/'), options[:size] || 0 do |progress|
+          with_progress_bar options[:progress] && options[:size], 
path.split('/').last, options[:size] || 0 do |progress|
             trace "Uploading to #{path}"
             sftp.file.open(path, 'w') do |file|
               while chunk = yield(RW_CHUNK_SIZE)
@@ -546,7 +546,7 @@ module URI
       raise ArgumentError, 'Either you\'re attempting to write a file to 
another host (which we don\'t support), or you used two slashes by mistake, 
where you should have file:///<path>.' if host
       temp = Tempfile.new(File.basename(path))
       temp.binmode
-      with_progress_bar options[:progress] && options[:size], path.split('/'), 
options[:size] || 0 do |progress|
+      with_progress_bar options[:progress] && options[:size], 
path.split('/').last, options[:size] || 0 do |progress|
         while chunk = yield(RW_CHUNK_SIZE)
           temp.write chunk
           progress << chunk


Reply via email to