system_check.rb 770 Bytes
Newer Older
1 2
# frozen_string_literal: true

3 4 5 6 7 8
# 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
9
module SystemCheck
10 11 12 13
  # 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
14 15
  def self.run(component, checks = [])
    executor = SimpleExecutor.new(component)
16

17 18
    checks.each do |check|
      executor << check
19
    end
20

21
    executor.execute
22 23
  end
end