Class: LogicalConstruct::RunOnTarget

Inherits:
Mattock::TaskLib
  • Object
show all
Includes:
Mattock::CommandLineDSL
Defined in:
lib/logical-construct/ground-control/run-on-target.rb

Constant Summary collapse

SSH_OPTIONS =
[ "ControlMaster=auto", "ControlPersist=3600",
"StrictHostKeyChecking=no", "UserKnownHostsFile=/dev/null" ]

Instance Method Summary collapse

Instance Method Details

#default_configuration(setup) ⇒ Object



13
14
15
16
# File 'lib/logical-construct/ground-control/run-on-target.rb', line 13

def default_configuration(setup)
  super
  self.remote_server = setup.proxy_value.remote_server
end

#remote_task(name, comment = nil) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/logical-construct/ground-control/run-on-target.rb', line 18

def remote_task(name, comment = nil)
  in_namespace do
    desc comment unless comment.nil?
    Mattock::Rake::RemoteCommandTask.define_task(name) do |task|
      task.ssh_options += SSH_OPTIONS

      task.runtime_definition do |task|
        copy_settings_to(task)
        yield(task)
      end
    end
  end
end