class Samus::Action

Attributes

files[W]

Public Class Methods

new(opts = {}) click to toggle source
# File lib/samus/action.rb, line 6
def initialize(opts = {})
  @raw_options = opts
  @dry_run = opts[:dry_run]
  @allow_fail = false
  @command = nil
  @creds = nil
  @arguments = opts[:arguments] || {}
end

Public Instance Methods

action=(name) click to toggle source
# File lib/samus/action.rb, line 44
def action=(name)
  @command = Command.new(stage, name)
end
allowFail=(value) click to toggle source
# File lib/samus/action.rb, line 52
def allowFail=(value)
  @allow_fail = value
end
arguments=(args) click to toggle source
# File lib/samus/action.rb, line 58
def arguments=(args)
  args.each { |k, v| @arguments[k] = v }
end
command_options() click to toggle source
# File lib/samus/action.rb, line 35
def command_options
  {
    arguments: @creds ? @arguments.merge(@creds.load) : @arguments,
    files: @files,
    dry_run: @dry_run,
    allow_fail: @allow_fail
  }
end
credentials=(key) click to toggle source
# File lib/samus/action.rb, line 48
def credentials=(key)
  @creds = Credentials.new(key)
end
load(opts = {}) click to toggle source
# File lib/samus/action.rb, line 19
def load(opts = {})
  opts.each do |key, value|
    meth = "#{key}="
    if respond_to?(meth)
      send(meth, value)
    else
      Samus.error("Unknown action property: #{key}")
    end
  end
  self
end
run() click to toggle source
# File lib/samus/action.rb, line 31
def run
  @command.run(command_options) if @command
end
stage() click to toggle source
# File lib/samus/action.rb, line 15
def stage
  raise NotImplementedError, 'action must define stage'
end