class AmicoDb::Download
Attributes
cmd[RW]
host[RW]
local_path[RW]
remote_path[RW]
user[RW]
Public Class Methods
new(user: AmicoDb.configuration.ssh_user, host: AmicoDb.configuration.host, remote_path: AmicoDb.configuration.remote_path, local_path: AmicoDb.configuration.local_path)
click to toggle source
# File lib/amico-db/download.rb, line 11 def initialize(user: AmicoDb.configuration.ssh_user, host: AmicoDb.configuration.host, remote_path: AmicoDb.configuration.remote_path, local_path: AmicoDb.configuration.local_path) self.user = user self.host = host self.remote_path = remote_path self.local_path = local_path self.cmd = generate_cmd end
Public Instance Methods
call()
click to toggle source
# File lib/amico-db/download.rb, line 22 def call AmicoDb::DownloadTools::CreateDirIfNotExist.new(local_path).call log_cmd system(cmd) end
Private Instance Methods
generate_cmd()
click to toggle source
# File lib/amico-db/download.rb, line 35 def generate_cmd "scp #{user}@#{host}:#{remote_path} #{local_path}" end
log_cmd()
click to toggle source
# File lib/amico-db/download.rb, line 30 def log_cmd puts 'Start download with scp:'.colorize(:red) puts cmd.colorize(:red) end