class ChoresKit::Executors::Shell

Attributes

name[R]

Public Class Methods

new(name, attributes) click to toggle source
# File lib/chores_kit/executors/shell.rb, line 8
def initialize(name, attributes)
  @name = name
  @callee = attributes.fetch(:callee)
  @callable = attributes.fetch(:callable)
end

Public Instance Methods

command() click to toggle source
# File lib/chores_kit/executors/shell.rb, line 18
def command
  @callable.join(' ')
end
friendly_name() click to toggle source
# File lib/chores_kit/executors/shell.rb, line 14
def friendly_name
  'Shell'
end
run!() click to toggle source
# File lib/chores_kit/executors/shell.rb, line 22
def run!
  output, status = Open3.capture2e(*@callable)

  raise "Running #{friendly_name} '#{@callable}' failed with status #{status.exitstatus}. Error message: #{output}" unless status.success?
end