Class: Devup::Shell
- Inherits:
-
Object
- Object
- Devup::Shell
- Defined in:
- lib/devup/shell.rb
Defined Under Namespace
Classes: Result
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#pwd ⇒ Object
readonly
Returns the value of attribute pwd.
Instance Method Summary collapse
- #exec(cmd) ⇒ Object
-
#initialize(pwd:, logger:) ⇒ Shell
constructor
A new instance of Shell.
Constructor Details
#initialize(pwd:, logger:) ⇒ Shell
Returns a new instance of Shell.
7 8 9 10 |
# File 'lib/devup/shell.rb', line 7 def initialize(pwd:, logger:) @pwd = pwd @logger = logger end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
5 6 7 |
# File 'lib/devup/shell.rb', line 5 def logger @logger end |
#pwd ⇒ Object (readonly)
Returns the value of attribute pwd.
5 6 7 |
# File 'lib/devup/shell.rb', line 5 def pwd @pwd end |
Instance Method Details
#exec(cmd) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/devup/shell.rb', line 19 def exec(cmd) logger.debug "$ #{cmd}" output, error, status = Open3.capture3(cmd + ";") logger.error(error) unless status.success? Result.new(output, status.success?) end |