25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/punt/mode/mode_scp.rb', line 25
def transfer(local_path, remote_path, mode_opts: nil, dry_run: false, verbose: false)
scp_args = ["scp"]
scp_common_options(mode_opts, verbose, scp_args)
if (File.directory?(local_path))
scp_args << "-r"
end
if (@has_sshpass && @ssh_password)
scp_args.unshift(@ssh_password).unshift("-p").unshift("sshpass")
end
scp_args << local_path
scp_args << scp_remote_file(remote_path, mode_opts)
scp_command = scp_args.join(" ")
puts scp_command
`#{scp_command}` unless dry_run
end
|