Class: Toys::Helpers::Exec::Utils
- Inherits:
-
Object
- Object
- Toys::Helpers::Exec::Utils
- Defined in:
- lib/toys/helpers/exec.rb
Instance Method Summary collapse
- #handle_status(status) ⇒ Object
-
#initialize(context, opts, config) ⇒ Utils
constructor
A new instance of Utils.
- #log(cmd) ⇒ Object
Constructor Details
#initialize(context, opts, config) ⇒ Utils
Returns a new instance of Utils.
30 31 32 33 |
# File 'lib/toys/helpers/exec.rb', line 30 def initialize(context, opts, config) @context = context @config = config ? config.merge(opts) : opts end |
Instance Method Details
#handle_status(status) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/toys/helpers/exec.rb', line 41 def handle_status(status) if status != 0 && @config[:report_subprocess_errors] @context.exit_with_code(status) end status end |
#log(cmd) ⇒ Object
35 36 37 38 39 |
# File 'lib/toys/helpers/exec.rb', line 35 def log(cmd) unless @config[:log_level] == false @context.logger.add(@config[:log_level] || Logger::INFO, cmd) end end |