Class: SSHKit::Backend::Local
Instance Attribute Summary
Attributes inherited from Abstract
#host
Instance Method Summary
collapse
Methods inherited from Abstract
#as, #background, #capture, config, configure, #execute, #make, #rake, #run, #test, #with, #within
Constructor Details
#initialize(_ = nil, &block) ⇒ Local
9
10
11
|
# File 'lib/sshkit/backends/local.rb', line 9
def initialize(_ = nil, &block)
super(Host.new(:local), &block)
end
|
Instance Method Details
#download!(remote, local = nil, _options = {}) ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'lib/sshkit/backends/local.rb', line 23
def download!(remote, local=nil, _options = {})
if local.nil?
FileUtils.cp(remote, File.basename(remote))
else
File.open(remote, "rb") do |f|
IO.copy_stream(f, local)
end
end
end
|
#upload!(local, remote, _options = {}) ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'lib/sshkit/backends/local.rb', line 13
def upload!(local, remote, _options = {})
if local.is_a?(String)
FileUtils.cp(local, remote)
else
File.open(remote, "wb") do |f|
IO.copy_stream(local, f)
end
end
end
|