36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/kitchen/transport/rsync.rb', line 36
def upload(locals, remote)
Array(locals).each do |local|
full_remote = File.join(remote, File.basename(local))
recursive = File.directory?(local)
execute("mkdir -p #{full_remote}") if recursive
time = Benchmark.realtime do
ssh_command = [login_command.command, login_command.arguments[0..-2]].flatten.join(' ')
sync_command = "rsync -e '#{ssh_command}' -a#{@logger.debug? ? 'v' : ''}z #{local} #{@session.options[:user]}@#{@session.host}:#{remote}"
@logger.debug("[RSYNC] Running rsync command: #{sync_command}")
system(sync_command)
end
logger.debug("[RSYNC] Time taken to upload #{local} to #{self}:#{full_remote}: %.2f sec" % time)
end
end
|