Class: Git::CommandLine::Base Abstract Private
- Inherits:
-
Object
- Object
- Git::CommandLine::Base
- Defined in:
- lib/git/command_line/base.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Subclass and implement #run
Abstract base class for git command-line execution strategies
Concrete subclasses must implement #run to execute a git command and return a Result. Two implementations are provided:
Instance Attribute Summary collapse
-
#binary_path ⇒ String
readonly
private
The path to the command line binary to run.
-
#env ⇒ Hash{String => String, nil}
readonly
private
Variables to set (or unset) in the git command's environment.
-
#global_opts ⇒ Array<String>
readonly
private
The global options to pass to git.
-
#logger ⇒ Logger
readonly
private
The logger to use for logging git commands and results.
Instance Method Summary collapse
-
#initialize(env, binary_path, global_opts, logger) ⇒ Base
constructor
private
Create a Base (or subclass) object.
-
#run
private
Execute a git command and return the result.
Constructor Details
#initialize(env, binary_path, global_opts, logger) ⇒ Base
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a Base (or subclass) object
41 42 43 44 45 46 |
# File 'lib/git/command_line/base.rb', line 41 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)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The path to the command line binary to run
80 81 82 |
# File 'lib/git/command_line/base.rb', line 80 def binary_path @binary_path end |
#env ⇒ Hash{String => String, nil} (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Variables to set (or unset) in the git command's environment
70 71 72 |
# File 'lib/git/command_line/base.rb', line 70 def env @env end |
#global_opts ⇒ Array<String> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
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].
95 96 97 |
# File 'lib/git/command_line/base.rb', line 95 def global_opts @global_opts end |
#logger ⇒ Logger (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The logger to use for logging git commands and results
106 107 108 |
# File 'lib/git/command_line/base.rb', line 106 def logger @logger end |
Instance Method Details
#run
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Execute a git command and return the result
Concrete subclasses must override this method.
54 55 56 |
# File 'lib/git/command_line/base.rb', line 54 def run(*) raise NotImplementedError, "#{self.class}#run is not implemented" end |