Class: Net::SSH::Connection::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/tinyssh.rb

Instance Method Summary collapse

Instance Method Details

#dl(src, dst) ⇒ Object



41
42
43
44
45
46
# File 'lib/tinyssh.rb', line 41

def dl(src, dst)
  self.scp.download!(src, dst, :recursive => true)
  "\n#{OUTPUT_TITLE}\nDownload #{host}:#{src} to #{dst}: [ #{"OK".green} ] !\n"
rescue
  "\n#{OUTPUT_TITLE}\nDownload #{host}:#{src} to #{dst}: [ #{"FAIL".red} ] !\n"
end

#run(cmd) ⇒ Object



27
28
29
30
31
32
# File 'lib/tinyssh.rb', line 27

def run(cmd)
  output = self.exec!(cmd)
  "\n#{output}#{OUTPUT_TITLE}\nExecute \"#{cmd}\" at #{host}: [ #{"OK".green} ]\n"
rescue
  "\n#{OUTPUT_TITLE}\nExecute \"#{cmd}\" at #{host}: [ #{"FAIL".red} ] !\n"
end

#up(src, dst) ⇒ Object



34
35
36
37
38
39
# File 'lib/tinyssh.rb', line 34

def up(src, dst)
  self.scp.upload!(src, dst, :recursive => true)
  "\n#{OUTPUT_TITLE}\nUpload #{host}:#{src} to #{dst}: [ #{"OK".green} ] !\n"
rescue
  "\n#{OUTPUT_TITLE}\nUpload #{host}:#{src} to #{dst}: [ #{"FAIL".red} ] !\n"
end