Top Level Namespace

Defined Under Namespace

Modules: Mina

Instance Method Summary collapse

Instance Method Details

#scp_download(from, to, options = {}) ⇒ Object



16
17
18
# File 'lib/mina/scp.rb', line 16

def scp_download(from, to, options = {})
  scp_transfer(:down, from, to, options)
end

#scp_transfer(direction, from, to, options = {}) ⇒ Object



1
2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/mina/scp.rb', line 1

def scp_transfer(direction, from, to, options = {})
  remote_prefix = "#{domain!}:"
  remote_prefix = "#{user}@#{remote_prefix}" if user?
  command = "scp"
  command << " -i #{identity_file}" if identity_file?
  command << " -P #{port}" if port?
  case direction
  when :up   then to   = remote_prefix + to
  when :down then from = remote_prefix + from
  end
  command << " #{from} #{to}"
  print_command command if options[:verbose]
  exec command
end

#scp_upload(from, to, options = {}) ⇒ Object



20
21
22
# File 'lib/mina/scp.rb', line 20

def scp_upload(from, to, options = {})
  scp_transfer(:up, from, to, options)
end