Class: Git::CommandLine::Base Abstract
- Inherits:
-
Object
- Object
- Git::CommandLine::Base
- Defined in:
- lib/git/command_line/base.rb
Overview
Instance Attribute Summary collapse
-
#binary_path ⇒ String
readonly
The path to the command line binary to run.
-
#env ⇒ Hash{String => String, nil}
readonly
Variables to set (or unset) in the git command's environment.
-
#global_opts ⇒ Array<String>
readonly
The global options to pass to git.
-
#logger ⇒ Logger
readonly
The logger to use for logging git commands and results.
Instance Method Summary collapse
-
#initialize(env, binary_path, global_opts, logger) ⇒ Base
constructor
Create a Base (or subclass) object.
-
#run
Execute a git command and return the result.
Constructor Details
#initialize(env, binary_path, global_opts, logger) ⇒ Base
Create a Base (or subclass) object
40 41 42 43 44 45 |
# File 'lib/git/command_line/base.rb', line 40 def initialize(env, binary_path, global_opts, logger) @env = env @binary_path = binary_path @global_opts = global_opts @logger = logger end |
Instance Attribute Details
#binary_path ⇒ String (readonly)
The path to the command line binary to run
83 84 85 |
# File 'lib/git/command_line/base.rb', line 83 def binary_path @binary_path end |
#env ⇒ Hash{String => String, nil} (readonly)
Variables to set (or unset) in the git command's environment
71 72 73 |
# File 'lib/git/command_line/base.rb', line 71 def env @env end |
#global_opts ⇒ Array<String> (readonly)
The global options to pass to git
These are options that are passed to git before the command name and
arguments. For example, in git --git-dir /path/to/git/dir version, the
global options are %w[--git-dir /path/to/git/dir].
100 101 102 |
# File 'lib/git/command_line/base.rb', line 100 def global_opts @global_opts end |
#logger ⇒ Logger (readonly)
The logger to use for logging git commands and results
113 114 115 |
# File 'lib/git/command_line/base.rb', line 113 def logger @logger end |
Instance Method Details
#run
Execute a git command and return the result
Concrete subclasses must override this method.
53 54 55 |
# File 'lib/git/command_line/base.rb', line 53 def run(*) raise NotImplementedError, "#{self.class}#run is not implemented" end |