module Provider::Ssh

Constants

SETTINGS

Public Instance Methods

download_file(cfg, file, local) click to toggle source
# File lib/devinstall/provider/provider_ssh.rb, line 28
def download_file(cfg, file, local)
  config=Devinstall::Settings.instance
  rsync = config.ssh(:rsync) # should be config.provider[:ssh][:rsync]
  command("#{rsync} -az #{cfg[:user]}@#{cfg[:host]}:#{cfg[:target]}/#{file.to_s} #{local}")
end
exec_command(cfg, command) click to toggle source
# File lib/devinstall/provider/provider_ssh.rb, line 43
def exec_command(cfg, command)
  config=Devinstall::Settings.instance
  ssh   = config.ssh(:ssh) # should be config.provider[:ssh][:scp]
  hosts = Array === cfg[:host] ? cfg[:host] : [cfg[:host]]
  hosts.each do |host|
    command("#{ssh} #{cfg[:user]}@#{host} \"#{command}\"")
  end
end
profider_final() click to toggle source
# File lib/devinstall/provider/provider_ssh.rb, line 18
def profider_final;end
provider_init() click to toggle source
# File lib/devinstall/provider/provider_ssh.rb, line 16
def provider_init;end
upload_file(cfg, file, local) click to toggle source
# File lib/devinstall/provider/provider_ssh.rb, line 34
def upload_file(cfg, file, local)
  config=Devinstall::Settings.instance
  scp   = config.ssh(:scp) # should be config.provider[:ssh][:scp]
  hosts = Array === cfg[:host] ? cfg[:host] : [cfg[:host]]
  hosts.each do |host|
    command("#{scp} #{local}/#{file} #{cfg[:user]}@#{host}:#{cfg[:folder]}")
  end
end
upload_sources(cfg, src, dst) click to toggle source
# File lib/devinstall/provider/provider_ssh.rb, line 20
def upload_sources(cfg, src, dst)
  config =Devinstall::Settings.instance
  rsync  = config.ssh(:rsync)
  source = src[-1]=='/' ? src : "#{src}/"       # source folder(we add / because we are using rsync)
  dest   = "#{cfg[:user]}@#{cfg[:host]}:#{dst}" # cfg should provide user and host
  command("#{rsync} #{source} #{dest}")
end