Class: SSHLine

Inherits:
Object
  • Object
show all
Defined in:
lib/rbbt/util/ssh/refactor.rb

Instance Method Summary collapse

Instance Method Details

#ruby(script) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rbbt/util/ssh/refactor.rb', line 3

def ruby(script)
  @output = ""
  @complete_output = false
  script = "require 'rbbt-util'\n" << script
  cmd = "ruby -I ~/git/rbbt6/lib/ -e \"#{script.gsub('"','\\"')}\"\n"
  Log.debug "Running ruby on #{@host}:\n#{ script }"
  @ch.send_data(cmd)
  @ch.send_data("echo DONECMD: $?\n")
  @ssh.loop{ !@complete_output }
  if @exit_status.to_i == 0
    return @output
  else
    raise SSHProcessFailed.new @host, "Ruby script:\n#{script}"
  end
end