Class: Mattock::Rake::RemoteCommandTask

Inherits:
CommandTask show all
Defined in:
lib/mattock/remote-command-task.rb

Instance Attribute Summary

Attributes included from ConfigurableTask

#base_task

Instance Method Summary collapse

Methods included from CommandTaskMixin

#action, #check_verification_command, included, #needed?, #resolve_runtime_configuration, shell, #shell, #verify_command

Methods included from ConfigurableTask

#action, included, #inspect, #resolve_configuration

Methods included from DeferredDefinition

add_settings, #finalize_configuration, #resolve_runtime_configuration, #runtime?, #runtime_definition, #setup_deferred

Methods included from CascadingDefinition

#confirm_configuration, #confirm_step, #confirm_steps, #default_configuration, #define, #resolve_configuration, #setup_cascade

Instance Method Details

#decorated(command_on_remote) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/mattock/remote-command-task.rb', line 19

def decorated(command_on_remote)
  fail "Need remote server for #{self.class.name}" unless remote_server.address

  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

#ssh_option(name, value) ⇒ Object



15
16
17
# File 'lib/mattock/remote-command-task.rb', line 15

def ssh_option(name, value)
  ssh_options << "\"#{name}=#{value}\""
end