Class: Puma::Redeploy::CommandRunner
- Inherits:
-
Object
- Object
- Puma::Redeploy::CommandRunner
- Defined in:
- lib/puma/redeploy/command_runner.rb
Overview
Runs commands before redeploy process
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
-
#runner ⇒ Object
readonly
Returns the value of attribute runner.
Instance Method Summary collapse
-
#initialize(commands:, logger:, runner: Open3) ⇒ CommandRunner
constructor
A new instance of CommandRunner.
- #run ⇒ Object
Constructor Details
#initialize(commands:, logger:, runner: Open3) ⇒ CommandRunner
Returns a new instance of CommandRunner.
11 12 13 14 15 |
# File 'lib/puma/redeploy/command_runner.rb', line 11 def initialize(commands:, logger:, runner: Open3) @logger = logger @commands = commands || [] @runner = runner end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
9 10 11 |
# File 'lib/puma/redeploy/command_runner.rb', line 9 def commands @commands end |
#runner ⇒ Object (readonly)
Returns the value of attribute runner.
9 10 11 |
# File 'lib/puma/redeploy/command_runner.rb', line 9 def runner @runner end |
Instance Method Details
#run ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/puma/redeploy/command_runner.rb', line 17 def run commands.each do |command| @logger.info "running command: #{command}" stdout, stderr, status = runner.capture3(command) @logger.info "command stdout: #{stdout}" @logger.info "command status: #{status.exitstatus}" @logger.error "command stderr: #{stderr}" if status.exitstatus != 0 end end |