Class: Remoting::RemoteCommander

Inherits:
Commander show all
Defined in:
lib/remoting/remote_commander.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Commander

#exec

Constructor Details

#initialize(login, *args) ⇒ RemoteCommander

Returns a new instance of RemoteCommander.



8
9
10
11
12
# File 'lib/remoting/remote_commander.rb', line 8

def initialize(, *args)
  options = args.extract_options!
  @login = 
  @interactive = !!options[:interactive]
end

Instance Attribute Details

#interactiveObject (readonly)

Returns the value of attribute interactive.



7
8
9
# File 'lib/remoting/remote_commander.rb', line 7

def interactive
  @interactive
end

#loginObject (readonly)

Returns the value of attribute login.



7
8
9
# File 'lib/remoting/remote_commander.rb', line 7

def 
  @login
end

Instance Method Details

#do_exec(cmds) ⇒ Object

overrides



15
16
17
# File 'lib/remoting/remote_commander.rb', line 15

def do_exec(cmds)
  remote(cmds)
end

#remote(cmds) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/remoting/remote_commander.rb', line 19

def remote(cmds)
  user, host = .split("@")
  
  ssh = ::Remoting::Ssh.new(
    :user => user,
    :host => host,
    :interactive => interactive
  )
  
  ssh.exec(cmds)
end