class Tollgate::Runner::Group

Public Class Methods

new(name = Undefined, reporter: Tollgate::Reporter.new) click to toggle source
# File lib/tollgate/runner/group.rb, line 6
def initialize(name = Undefined, reporter: Tollgate::Reporter.new)
  @name = name
  @group_status = true
  @reporter = reporter
end

Public Instance Methods

call(&command_block) click to toggle source
# File lib/tollgate/runner/group.rb, line 20
def call(&command_block)
  puts @name unless @name == Undefined

  instance_exec(&command_block) if block_given?

  @group_status
end
check(command_str) click to toggle source
# File lib/tollgate/runner/group.rb, line 28
def check(command_str)
  result = system(command_str)
  @group_status = result if group_success?

  if result
    @reporter.record(command_str, status: :success)
  else
    @reporter.record(command_str, status: :failed)
  end
end
group_failed?() click to toggle source
# File lib/tollgate/runner/group.rb, line 16
def group_failed?
  !group_success?
end
group_success?() click to toggle source
# File lib/tollgate/runner/group.rb, line 12
def group_success?
  !!@group_status
end