Class: SSHKit::Backend::Local
- Defined in:
- lib/sshkit/backends/local.rb
Instance Attribute Summary
Attributes inherited from Abstract
Instance Method Summary collapse
- #download!(remote, local = nil, _options = {}) ⇒ Object
-
#initialize(_ = nil, &block) ⇒ Local
constructor
A new instance of Local.
- #upload!(local, remote, _options = {}) ⇒ Object
Methods inherited from Abstract
#as, #background, #capture, config, configure, #execute, #make, #rake, #run, #test, #with, #within
Constructor Details
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, = {}) 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, = {}) if local.is_a?(String) FileUtils.cp(local, remote) else File.open(remote, "wb") do |f| IO.copy_stream(local, f) end end end |