class Edict::SSHCommand

Public Instance Methods

run_command(command) click to toggle source
Calls superclass method Edict::Command#run_command
# File lib/edict/ssh-command.rb, line 40
def run_command(command)
  fail "Need remote server for #{self.class.name}" unless remote_server.address

  super(wrap_ssh_around(command))
end
ssh_option(name, value) click to toggle source
# File lib/edict/ssh-command.rb, line 18
def ssh_option(name, value)
  ssh_options << "\"#{name}=#{value}\""
end
wrap_ssh_around(command_on_remote) click to toggle source
# File lib/edict/ssh-command.rb, line 22
def wrap_ssh_around(command_on_remote)
  raise "Empty remote command" if command_on_remote.nil?
  cmd("ssh") do |cmd|
    cmd.options << "-i #{id_file}" if id_file
    cmd.options << "-l #{remote_server.user}" unless remote_server.user.nil?
    cmd.options << remote_server.address
    cmd.options << "-p #{remote_server.port}" #ok
    cmd.options << "-n"
    cmd.options << "-#{'v'*verbose}" if verbose > 0
    unless ssh_options.empty?
      ssh_options.each do |opt|
        cmd.options << "-o #{opt}"
      end
    end
    cmd - escaped_command(command_on_remote)
  end
end