Class: SSHKit::Interact::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/sshkit/interact/command.rb

Overview

Command wrapper

Instance Method Summary collapse

Constructor Details

#initialize(host, command) ⇒ Command

Returns a new instance of Command.



5
6
7
8
# File 'lib/sshkit/interact/command.rb', line 5

def initialize(host, command)
  @host    = host
  @command = command
end

Instance Method Details

#executeObject



19
20
21
# File 'lib/sshkit/interact/command.rb', line 19

def execute
  exec(to_cmd)
end

#to_cmdObject



10
11
12
13
14
15
16
17
# File 'lib/sshkit/interact/command.rb', line 10

def to_cmd
  [
    :ssh,
    *ssh_cmd_args,
    @host.hostname,
    %Q{'$SHELL -l -c "#{@command.to_command}"'}
  ].join(' ')
end