class Tollgate::Runner
Attributes
success[R]
Public Class Methods
new(reporter: Tollgate::Reporter.new)
click to toggle source
# File lib/tollgate/runner.rb, line 10 def initialize(reporter: Tollgate::Reporter.new) @success = true @reporter = reporter end
Public Instance Methods
call(command_block)
click to toggle source
# File lib/tollgate/runner.rb, line 23 def call(command_block) instance_exec(&command_block) end
check(command_str)
click to toggle source
# File lib/tollgate/runner.rb, line 27 def check(command_str) return record_not_run(command_str) if failed? @success = system(command_str) if success? @reporter.record(command_str, status: :success) else @reporter.record(command_str, status: :failed) end end
failed?()
click to toggle source
# File lib/tollgate/runner.rb, line 19 def failed? !success? end
group(group_name = Undefined, &command_block)
click to toggle source
# File lib/tollgate/runner.rb, line 38 def group(group_name = Undefined, &command_block) return if failed? group_runner = Tollgate::Runner::Group.new(group_name, reporter: @reporter) @success = group_runner.call(&command_block) end
success?()
click to toggle source
# File lib/tollgate/runner.rb, line 15 def success? !!@success end
Private Instance Methods
record_not_run(command_str)
click to toggle source
# File lib/tollgate/runner.rb, line 46 def record_not_run(command_str) @reporter.record(command_str, status: :not_run) end