2018-10-06 23:10:08 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-02-13 08:45:39 +00:00
|
|
|
# Library to perform System Checks
|
|
|
|
#
|
|
|
|
# Every Check is implemented as its own class inherited from SystemCheck::BaseCheck
|
|
|
|
# Execution coordination and boilerplate output is done by the SystemCheck::SimpleExecutor
|
|
|
|
#
|
|
|
|
# This structure decouples checks from Rake tasks and facilitates unit-testing
|
2017-02-12 23:33:31 +00:00
|
|
|
module SystemCheck
|
2017-02-13 08:45:39 +00:00
|
|
|
# Executes a bunch of checks for specified component
|
|
|
|
#
|
|
|
|
# @param [String] component name of the component relative to the checks being executed
|
|
|
|
# @param [Array<BaseCheck>] checks classes of corresponding checks to be executed in the same order
|
2017-05-30 17:06:58 +00:00
|
|
|
def self.run(component, checks = [])
|
|
|
|
executor = SimpleExecutor.new(component)
|
2017-02-13 11:21:12 +00:00
|
|
|
|
2017-02-13 08:45:39 +00:00
|
|
|
checks.each do |check|
|
|
|
|
executor << check
|
2017-02-12 23:33:31 +00:00
|
|
|
end
|
2017-02-13 11:21:12 +00:00
|
|
|
|
2017-05-30 17:06:58 +00:00
|
|
|
executor.execute
|
2017-02-12 23:33:31 +00:00
|
|
|
end
|
|
|
|
end
|