Class: Moku::Task::RemoteShell

Inherits:
Task
  • Object
show all
Defined in:
lib/moku/task/remote_shell.rb

Overview

A shell task that is resolved in the context of the deployed release on each target host.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Task

#to_s

Constructor Details

#initialize(command:, scope:) ⇒ RemoteShell

Returns a new instance of RemoteShell.


17
18
19
20
# File 'lib/moku/task/remote_shell.rb', line 17

def initialize(command:, scope:)
  @command = command
  @scope = scope
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command


22
23
24
# File 'lib/moku/task/remote_shell.rb', line 22

def command
  @command
end

#scopeObject (readonly)

Returns the value of attribute scope


22
23
24
# File 'lib/moku/task/remote_shell.rb', line 22

def scope
  @scope
end

Class Method Details

.from_spec(task_spec) ⇒ Object


13
14
15
# File 'lib/moku/task/remote_shell.rb', line 13

def self.from_spec(task_spec)
  new(command: task_spec.command, scope: task_spec.scope)
end

Instance Method Details

#call(release) ⇒ Object

Parameters:


25
26
27
28
29
30
# File 'lib/moku/task/remote_shell.rb', line 25

def call(release)
  return Status.failure("Must specify a command") unless command
  return Status.failure("Must specify scope") unless scope

  release.run(scope, command)
end