Class: TasteTester::SSH
- Inherits:
-
Object
- Object
- TasteTester::SSH
- Defined in:
- lib/taste_tester/ssh.rb,
lib/taste_tester/ssh_util.rb
Overview
Thin ssh wrapper
Defined Under Namespace
Modules: Util
Instance Method Summary collapse
- #add(string) ⇒ Object (also: #<<)
-
#initialize(host, tunnel = false) ⇒ SSH
constructor
A new instance of SSH.
- #run(stream = nil) ⇒ Object
- #run!(stream = nil) ⇒ Object
Methods included from Util
#build_ssh_cmd, #error!, #ssh_base_cmd
Methods included from Logging
#formatter, formatterproc=, logger, #logger, use_log_formatter=, verbosity=
Constructor Details
#initialize(host, tunnel = false) ⇒ SSH
Returns a new instance of SSH.
27 28 29 30 31 |
# File 'lib/taste_tester/ssh.rb', line 27 def initialize(host, tunnel = false) @host = host @tunnel = tunnel @cmds = [] end |
Instance Method Details
#add(string) ⇒ Object Also known as: <<
33 34 35 |
# File 'lib/taste_tester/ssh.rb', line 33 def add(string) @cmds << string end |
#run(stream = nil) ⇒ Object
39 40 41 |
# File 'lib/taste_tester/ssh.rb', line 39 def run(stream = nil) exec(cmd, logger, stream) end |
#run!(stream = nil) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/taste_tester/ssh.rb', line 43 def run!(stream = nil) exec!(cmd, logger, stream) rescue StandardError => e logger.error(e.) error! end |