lib/core/transports.rb in buildr-0.22.0 vs lib/core/transports.rb in buildr-1.0.0

- old
+ new

@@ -267,10 +267,11 @@ class HTTP < Transport #:nodoc: def initialize(url, options) super + rake_check_options options, :digests if options @http = Net::HTTP.start(@uri.host, @uri.port) end def download(path, target = nil, &block) puts "Requesting #{@uri}/#{path} " if Rake.application.options.trace @@ -315,11 +316,12 @@ if target # If download breaks we end up with a partial file which is # worse than not having a file at all, so download to temporary # file and then move over. - temp = Tempfile.new(File.basename(target)) + temp = Tempfile.open(File.basename(target)) + temp.binmode download[ proc { |chunk| temp.write chunk } ] temp.close File.move temp.path, target File.utime last_modified, last_modified, target else @@ -358,9 +360,10 @@ attr_reader :sftp def initialize(url, options) super + rake_check_options options, :digests, :permissions, :port, :uri, :username, :password @permissions = options.delete :permissions # SSH options are based on the username/password from the URI. ssh_options = { :port=>@uri.port, :username=>@uri.user }.merge(options || {}) ssh_options[:password] ||= SFTP.passwords[@uri.host] begin