Method: Bard::Copy#scp_using_local

Defined in:
lib/bard/copy.rb

#scp_using_local(direction, server) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/bard/copy.rb', line 24

def scp_using_local direction, server
  gateway = server.gateway ? "-oProxyCommand='ssh #{server.ssh_uri(:gateway)} -W %h:%p'" : ""

  ssh_key = server.ssh_key ? "-i #{server.ssh_key}" : ""

  from_and_to = [path, server.scp_uri(path)]
  from_and_to.reverse! if direction == :from

  command = ["scp", gateway, ssh_key, *from_and_to].join(" ")
  Bard::Command.run! command, verbose: verbose
end