Class: GitCommander::System::Command Abstract
- Inherits:
-
Object
- Object
- GitCommander::System::Command
- Defined in:
- lib/git_commander/system.rb
Overview
This class is abstract.
Wraps a system command with logging, stderr, and stdout capture
Instance Attribute Summary collapse
-
#command_with_arguments ⇒ Object
readonly
Returns the value of attribute command_with_arguments.
-
#error ⇒ Object
Returns the value of attribute error.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#output ⇒ Object
Returns the value of attribute output.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(command_with_arguments, options = {}) ⇒ Command
constructor
A new instance of Command.
- #run ⇒ Object
Constructor Details
#initialize(command_with_arguments, options = {}) ⇒ Command
Returns a new instance of Command.
17 18 19 20 21 |
# File 'lib/git_commander/system.rb', line 17 def initialize(command_with_arguments, = {}) @command_with_arguments = command_with_arguments @name = command_with_arguments.split(/\w/i).first = DEFAULT_RUN_OPTIONS.merge() end |
Instance Attribute Details
#command_with_arguments ⇒ Object (readonly)
Returns the value of attribute command_with_arguments.
16 17 18 |
# File 'lib/git_commander/system.rb', line 16 def command_with_arguments @command_with_arguments end |
#error ⇒ Object
Returns the value of attribute error.
15 16 17 |
# File 'lib/git_commander/system.rb', line 15 def error @error end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
16 17 18 |
# File 'lib/git_commander/system.rb', line 16 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
16 17 18 |
# File 'lib/git_commander/system.rb', line 16 def end |
#output ⇒ Object
Returns the value of attribute output.
15 16 17 |
# File 'lib/git_commander/system.rb', line 15 def output @output end |
#status ⇒ Object
Returns the value of attribute status.
15 16 17 |
# File 'lib/git_commander/system.rb', line 15 def status @status end |
Instance Method Details
#run ⇒ Object
23 24 25 26 27 |
# File 'lib/git_commander/system.rb', line 23 def run log_command_initiated @output, @error, @status = Open3.capture3(command_with_arguments) log_command_completed end |