summaryrefslogtreecommitdiff
path: root/lib/system_check.rb
diff options
context:
space:
mode:
authorGabriel Mazetto <brodock@gmail.com>2017-02-13 09:45:39 +0100
committerGabriel Mazetto <brodock@gmail.com>2017-05-31 14:33:03 +0200
commitf182ea4ea5fe76349a584da12e5d4a9f681a8401 (patch)
tree24ca4703350bd5b7e41152dc5cbfff4fa8c18f9d /lib/system_check.rb
parent500e5227a08bd603a2943c3c7d2efcaf4a40cc15 (diff)
downloadgitlab-ce-f182ea4ea5fe76349a584da12e5d4a9f681a8401.tar.gz
Some code-style fixes and documentation
Diffstat (limited to 'lib/system_check.rb')
-rw-r--r--lib/system_check.rb17
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/system_check.rb b/lib/system_check.rb
index 1d09b57911a..79603dfc7cb 100644
--- a/lib/system_check.rb
+++ b/lib/system_check.rb
@@ -1,12 +1,23 @@
+# 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
module SystemCheck
- def self.run(component, checks = {}, executor_klass = SimpleExecutor)
+ # 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
+ # @param [BaseExecutor] executor_klass optionally specifiy a different executor class
+ def self.run(component, checks = [], executor_klass = SimpleExecutor)
unless executor_klass.is_a? BaseExecutor
raise ArgumentError, 'Invalid executor'
end
executor = executor_klass.new(component)
- executor.checks = checks.map do |check|
- raise ArgumentError unless check.is_a? BaseCheck
+ checks.each do |check|
+ executor << check
end
end
end