2017-02-12 18:33:31 -05:00
|
|
|
module SystemCheck
|
2017-02-13 03:45:39 -05:00
|
|
|
# Simple Executor is current default executor for GitLab
|
|
|
|
# It is a simple port from display logic in the old check.rake
|
|
|
|
#
|
|
|
|
# There is no concurrency level and the output is progressively
|
|
|
|
# printed into the STDOUT
|
2017-02-12 18:33:31 -05:00
|
|
|
class SimpleExecutor < BaseExecutor
|
2017-02-13 03:45:39 -05:00
|
|
|
# Executes defined checks in the specified order and outputs confirmation or error information
|
2017-02-12 18:33:31 -05:00
|
|
|
def execute
|
|
|
|
start_checking(component)
|
|
|
|
|
|
|
|
@checks.each do |check|
|
2017-02-13 03:45:39 -05:00
|
|
|
$stdout.print "#{check.name}"
|
2017-02-12 18:33:31 -05:00
|
|
|
if check.skip?
|
2017-02-13 03:45:39 -05:00
|
|
|
$stdout.puts "skipped #{'(' + skip_message + ')' if skip_message}".color(:magenta)
|
2017-02-12 18:33:31 -05:00
|
|
|
elsif check.check?
|
2017-02-13 03:45:39 -05:00
|
|
|
$stdout.puts 'yes'.color(:green)
|
2017-02-12 18:33:31 -05:00
|
|
|
else
|
2017-02-13 03:45:39 -05:00
|
|
|
$stdout.puts 'no'.color(:red)
|
2017-02-12 18:33:31 -05:00
|
|
|
check.show_error
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
finished_checking(component)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2017-02-13 03:45:39 -05:00
|
|
|
# Prints header content for the series of checks to be executed for this component
|
|
|
|
#
|
|
|
|
# @param [String] component name of the component relative to the checks being executed
|
2017-02-12 18:33:31 -05:00
|
|
|
def start_checking(component)
|
2017-02-13 03:45:39 -05:00
|
|
|
$stdout.puts "Checking #{component.color(:yellow)} ..."
|
|
|
|
$stdout.puts ''
|
2017-02-12 18:33:31 -05:00
|
|
|
end
|
|
|
|
|
2017-02-13 03:45:39 -05:00
|
|
|
# Prints footer content for the series of checks executed for this component
|
|
|
|
#
|
|
|
|
# @param [String] component name of the component relative to the checks being executed
|
2017-02-12 18:33:31 -05:00
|
|
|
def finished_checking(component)
|
2017-02-13 03:45:39 -05:00
|
|
|
$stdout.puts ''
|
|
|
|
$stdout.puts "Checking #{component.color(:yellow)} ... #{'Finished'.color(:green)}"
|
|
|
|
$stdout.puts ''
|
2017-02-12 18:33:31 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|