Class: Git::Config
- Inherits:
-
Object
- Object
- Git::Config
- Defined in:
- lib/git/config.rb
Overview
The global configuration for this gem
Instance Attribute Summary collapse
-
#binary_path ⇒ String
Returns the git executable path.
-
#git_ssh ⇒ String?
Returns the SSH wrapper path used by git operations.
-
#timeout ⇒ Integer?
Returns the timeout for git operations.
Class Method Summary collapse
-
.instance ⇒ Git::Config
Returns the process-wide singleton Config instance.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
44 45 46 47 48 |
# File 'lib/git/config.rb', line 44 def initialize @binary_path = nil @git_ssh = nil @timeout = nil end |
Instance Attribute Details
#binary_path ⇒ String
Returns the git executable path
Uses an explicitly configured path first, then GIT_PATH, then git.
59 60 61 |
# File 'lib/git/config.rb', line 59 def binary_path @binary_path || (ENV.fetch('GIT_PATH', nil) && File.join(ENV.fetch('GIT_PATH', nil), 'git')) || 'git' end |
#git_ssh ⇒ String?
Returns the SSH wrapper path used by git operations
Uses an explicitly configured wrapper path first, then GIT_SSH.
72 73 74 |
# File 'lib/git/config.rb', line 72 def git_ssh @git_ssh || ENV.fetch('GIT_SSH', nil) end |
#timeout ⇒ Integer?
Returns the timeout for git operations
Uses an explicitly configured timeout first, then GIT_TIMEOUT.
85 86 87 |
# File 'lib/git/config.rb', line 85 def timeout @timeout || (ENV.fetch('GIT_TIMEOUT', nil) && ENV['GIT_TIMEOUT'].to_i) end |
Class Method Details
.instance ⇒ Git::Config
Returns the process-wide singleton Git::Config instance
All calls to Git.configure, Git.config, and the ExecutionContext classes resolve global configuration through this method.
22 23 24 |
# File 'lib/git/config.rb', line 22 def self.instance @instance ||= new end |