Class: Reviewer::Runner::Strategies::Passthrough
- Inherits:
-
Object
- Object
- Reviewer::Runner::Strategies::Passthrough
- Defined in:
- lib/reviewer/runner/strategies/passthrough.rb
Overview
Execution strategy for a runner to run a command transparently-displaying the command’s
output in realtime as it runs (as opposed to capturing and suppressing the output unless
the command fails)
Instance Attribute Summary collapse
-
#runner ⇒ Runner
readonly
the instance of the runner that will be executed with this strategy.
Instance Method Summary collapse
-
#initialize(runner) ⇒ self
constructor
Create an instance of the passthrough strategy for a command runner.
-
#prepare ⇒ void
The prepare command strategy when running a command transparently.
-
#run ⇒ void
The run command strategy when running a command transparently.
Constructor Details
permalink #initialize(runner) ⇒ self
Create an instance of the passthrough strategy for a command runner. This strategy ensures that when a command is run, the output isn’t suppressed. Essentially, it’s a transparent wrapper for running a command and displaying the results realtime.
19 20 21 |
# File 'lib/reviewer/runner/strategies/passthrough.rb', line 19 def initialize(runner) @runner = runner end |
Instance Attribute Details
Instance Method Details
permalink #prepare ⇒ void
This method returns an undefined value.
The prepare command strategy when running a command transparently
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/reviewer/runner/strategies/passthrough.rb', line 26 def prepare # Running the prepare command, so make sure the timestamp is updated runner.update_last_prepared_at # Display the exact command syntax that's being run. This can come in handy if there's an # issue and the command can be copied/pasted or if the generated command somehow has some # incorrect syntax or options that need to be corrected. runner.output.current_command(runner.prepare_command) # Add a divider to visually delineate the results runner.output.divider # Run the command through the shell directly so no output is suppressed runner.shell.direct(runner.prepare_command) end |
permalink #run ⇒ void
This method returns an undefined value.
The run command strategy when running a command transparently
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/reviewer/runner/strategies/passthrough.rb', line 45 def run # Display the exact command syntax that's being run. This can come in handy if there's an # issue and the command can be copied/pasted or if the generated command somehow has some # incorrect syntax or options that need to be corrected. runner.output.current_command(runner.command) # Add a divider to visually delineate the results runner.output.divider # Run the command through the shell directly so no output is suppressed runner.shell.direct(runner.command) # Add a final divider to visually delineate the results runner.output.divider end |