Class: Reviewer::Batch
- Inherits:
-
Object
- Object
- Reviewer::Batch
- Defined in:
- lib/reviewer/batch.rb
Overview
Provides a structure for running commands for a given set of tools
Defined Under Namespace
Classes: UnrecognizedCommandError
Instance Attribute Summary collapse
-
#command_type ⇒ Object
readonly
Returns the value of attribute command_type.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#tools ⇒ Object
readonly
Returns the value of attribute tools.
Instance Method Summary collapse
-
#initialize(command_type, tools, output: Reviewer.output) ⇒ self
constructor
Generates an instance of Batch for running multiple tools together.
-
#run ⇒ Results
Iterates over the tools in the batch to successfully run the commands.
Constructor Details
#initialize(command_type, tools, output: Reviewer.output) ⇒ self
Generates an instance of Batch for running multiple tools together
16 17 18 19 20 21 |
# File 'lib/reviewer/batch.rb', line 16 def initialize(command_type, tools, output: Reviewer.output) @command_type = command_type @tools = tools @output = output @results = {} end |
Instance Attribute Details
#command_type ⇒ Object (readonly)
Returns the value of attribute command_type.
8 9 10 |
# File 'lib/reviewer/batch.rb', line 8 def command_type @command_type end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
8 9 10 |
# File 'lib/reviewer/batch.rb', line 8 def output @output end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
8 9 10 |
# File 'lib/reviewer/batch.rb', line 8 def results @results end |
#tools ⇒ Object (readonly)
Returns the value of attribute tools.
8 9 10 |
# File 'lib/reviewer/batch.rb', line 8 def tools @tools end |
Instance Method Details
#run ⇒ Results
Iterates over the tools in the batch to successfully run the commands. Also times the entire
batch in order to provide a total execution time.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/reviewer/batch.rb', line 27 def run benchmark_batch do matching_tools.each do |tool| # Create and execute a runner for the given tool, command type, and strategy runner = Runner.new(tool, command_type, strategy) runner.run # Record the exit status for this tool record_exit_status(runner) # If the tool fails, stop running other tools break unless runner.success? end end results end |