lib/core/transports.rb in buildr-1.2.1 vs lib/core/transports.rb in buildr-1.2.2
- old
+ new
@@ -204,12 +204,12 @@
options ||= {}
if String === source
raise NotFoundError, "No source file/directory to upload." unless File.exist?(source)
if File.directory?(source)
Dir.glob("#{source}/**/*").reject { |file| File.directory?(file) }.each do |file|
- path = self.path + file.sub(source, "")
- (self + path).upload file, {:digests=>[]}.merge(options)
+ uri = self + (File.join(self.path, file.sub(source, "")))
+ uri.upload file, {:digests=>[]}.merge(options)
end
else
File.open(source, "rb") { |input| upload input, options }
end
elsif source.respond_to?(:read)
@@ -395,10 +395,10 @@
puts "connected" if Rake.application.options.trace
# To create a path, we need to create all its parent. We use realpath to determine if
# the path already exists, otherwise mkdir fails.
puts "Creating path #{@base_path}" if Rake.application.options.trace
- path.split("/").inject("") do |base, part|
+ File.dirname(path).split("/").inject("") do |base, part|
combined = base + part
sftp.realpath combined rescue sftp.mkdir combined, {}
"#{combined}/"
end