Module: ZTK::SSH::Download
- Included in:
- ZTK::SSH
- Defined in:
- lib/ztk/ssh/download.rb
Overview
SSH Download Functionality
Instance Method Summary (collapse)
-
- (Boolean) download(remote, local, options = {})
Downloads a remote file to the local host.
Instance Method Details
- (Boolean) download(remote, local, options = {})
Downloads a remote file to the local host.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/ztk/ssh/download.rb', line 32 def download(remote, local, ={}) = { :recursive => ::File.directory?(local), :use_scp => false }.merge() = OpenStruct.new(config.send(:table).merge()) .ui.logger.debug { "config=#{config.send(:table).inspect}" } .ui.logger.debug { "options=#{.send(:table).inspect}" } .ui.logger.info { "download(#{remote.inspect}, #{local.inspect})" } ZTK::RescueRetry.try(:ui => config.ui, :tries => ZTK::SSH::RESCUE_RETRY_ATTEMPTS, :on_retry => method(:on_retry)) do if (.use_scp == true) scp_download(remote, local, ) else sftp_download(remote, local, ) end end true end |