Class: Hive::DiagnosticRunner
- Inherits:
-
Object
- Object
- Hive::DiagnosticRunner
- Defined in:
- lib/hive/diagnostic_runner.rb
Instance Attribute Summary collapse
-
#diagnostics ⇒ Object
Returns the value of attribute diagnostics.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options, diagnostics_config, platform) ⇒ DiagnosticRunner
constructor
A new instance of DiagnosticRunner.
- #initialize_diagnostics(diagnostics_config) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(options, diagnostics_config, platform) ⇒ DiagnosticRunner
Returns a new instance of DiagnosticRunner.
5 6 7 8 9 |
# File 'lib/hive/diagnostic_runner.rb', line 5 def initialize(, diagnostics_config, platform) @options = @platform = platform @diagnostics = self.initialize_diagnostics(diagnostics_config[@platform]) if diagnostics_config.has_key?(@platform) end |
Instance Attribute Details
#diagnostics ⇒ Object
Returns the value of attribute diagnostics.
3 4 5 |
# File 'lib/hive/diagnostic_runner.rb', line 3 def diagnostics @diagnostics end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/hive/diagnostic_runner.rb', line 3 def @options end |
Instance Method Details
#initialize_diagnostics(diagnostics_config) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/hive/diagnostic_runner.rb', line 11 def initialize_diagnostics(diagnostics_config) if diagnostics_config @diagnostics = diagnostics_config.collect do |component, config| Hive.logger.info("Initializing #{component.capitalize} component for #{@platform.capitalize} diagnostic") require "hive/diagnostic/#{@platform}/#{component}" Object.const_get('Hive').const_get('Diagnostic').const_get(@platform.capitalize).const_get(component.capitalize).new(config, @options) end else Hive.logger.info("No diagnostic specified for #{@platform}") end end |
#run ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/hive/diagnostic_runner.rb', line 23 def run results = @diagnostics.collect do |diagnostic| diagnostic.run end failures = results.select { |r| r.failed? } failures.count == 0 end |