diff options
author | Gabriel Mazetto <brodock@gmail.com> | 2017-05-31 20:45:00 +0200 |
---|---|---|
committer | Gabriel Mazetto <brodock@gmail.com> | 2017-05-31 20:45:00 +0200 |
commit | 0d4d9a6a63b2ac60ffeeeaef389295919c3119f4 (patch) | |
tree | e16ced93cbb4c2f41baee6b4900c4810f47cf2ad /lib | |
parent | d219f9a691973708f70d9517765a2ec926d6d903 (diff) | |
download | gitlab-ce-0d4d9a6a63b2ac60ffeeeaef389295919c3119f4.tar.gz |
Refactor and move things around to improve in YAGNI perspective
Diffstat (limited to 'lib')
-rw-r--r-- | lib/system_check/base_executor.rb | 24 | ||||
-rw-r--r-- | lib/system_check/simple_executor.rb | 24 |
2 files changed, 23 insertions, 25 deletions
diff --git a/lib/system_check/base_executor.rb b/lib/system_check/base_executor.rb deleted file mode 100644 index f76f44f3a28..00000000000 --- a/lib/system_check/base_executor.rb +++ /dev/null @@ -1,24 +0,0 @@ -module SystemCheck - # @attr_reader [Array<BaseCheck>] checks classes of corresponding checks to be executed in the same order - # @attr_reader [String] component name of the component relative to the checks being executed - class BaseExecutor - attr_reader :checks - attr_reader :component - - # @param [String] component name of the component relative to the checks being executed - def initialize(component) - raise ArgumentError unless component.is_a? String - - @component = component - @checks = Set.new - end - - # Add a check to be executed - # - # @param [BaseCheck] check class - def <<(check) - raise ArgumentError unless check < BaseCheck - @checks << check - end - end -end diff --git a/lib/system_check/simple_executor.rb b/lib/system_check/simple_executor.rb index c5403693f7a..dc2d4643a01 100644 --- a/lib/system_check/simple_executor.rb +++ b/lib/system_check/simple_executor.rb @@ -4,7 +4,29 @@ module SystemCheck # # There is no concurrency level and the output is progressively # printed into the STDOUT - class SimpleExecutor < BaseExecutor + # + # @attr_reader [Array<BaseCheck>] checks classes of corresponding checks to be executed in the same order + # @attr_reader [String] component name of the component relative to the checks being executed + class SimpleExecutor + attr_reader :checks + attr_reader :component + + # @param [String] component name of the component relative to the checks being executed + def initialize(component) + raise ArgumentError unless component.is_a? String + + @component = component + @checks = Set.new + end + + # Add a check to be executed + # + # @param [BaseCheck] check class + def <<(check) + raise ArgumentError unless check < BaseCheck + @checks << check + end + # Executes defined checks in the specified order and outputs confirmation or error information def execute start_checking(component) |