Module: R10K::Git
- Extended by:
- Logging, Settings::Mixin::ClassMethods
- Defined in:
- lib/r10k/git.rb,
lib/r10k/git/errors.rb,
lib/r10k/git/rugged.rb,
lib/r10k/git/shellgit.rb
Defined Under Namespace
Modules: Rugged, ShellGit Classes: Alternates, Cache, GitError, StatefulRepository, UnresolvableRefError
Constant Summary collapse
- NULL_PROVIDER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Mark the current provider as invalid.
If a provider is set to an invalid provider, we need to make sure that the provider doesn’t fall back to the default value, thereby ignoring the explicit value and silently continuing. If the current provider is assigned to this value, no provider will be used until the provider is either reset or assigned a valid provider.
Object.new
- UNSET_PROVIDER =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Mark the current provider as unset.
If the provider has never been set we need to indicate that there is no current value but the default value can be used. If the current provider is assigned to this value and the provider is looked up, the default provider will be looked up and used.
Object.new
Constants included from Logging
Class Method Summary collapse
- .bare_repository ⇒ Object
- .cache ⇒ Object
-
.default_name ⇒ String
Return the first available Git provider.
-
.provider ⇒ Module
The namespace of the first available Git implementation.
-
.provider=(name) ⇒ void
Manually set the Git provider by name.
-
.reset! ⇒ Object
private
Clear the currently set provider.
- .thin_repository ⇒ Object
Methods included from Logging
debug_formatter, default_formatter, default_outputter, logger, logger_name, parse_level
Methods included from Settings::Mixin::ClassMethods
def_setting_attr, defaults, inherited, settings
Class Method Details
.bare_repository ⇒ Object
109 110 111 |
# File 'lib/r10k/git.rb', line 109 def self. provider::BareRepository end |
.cache ⇒ Object
105 106 107 |
# File 'lib/r10k/git.rb', line 105 def self.cache provider::Cache end |
.default_name ⇒ String
Return the first available Git provider.
63 64 65 66 67 68 69 |
# File 'lib/r10k/git.rb', line 63 def self.default_name name, _ = @providers.find { |(_, hash)| R10K::Features.available?(hash[:feature]) } if name.nil? raise R10K::Error, "No Git providers are functional." end name end |
.provider ⇒ Module
Returns The namespace of the first available Git implementation. Implementation classes should be looked up against this returned Module.
95 96 97 98 99 100 101 102 103 |
# File 'lib/r10k/git.rb', line 95 def self.provider case @provider when NULL_PROVIDER raise R10K::Error, "No Git provider set." when UNSET_PROVIDER self.provider = default_name end @provider end |
.provider=(name) ⇒ void
This method returns an undefined value.
Manually set the Git provider by name.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/r10k/git.rb', line 77 def self.provider=(name) _, attrs = @providers.find { |(providername, _)| name == providername } if attrs.nil? @provider = NULL_PROVIDER raise R10K::Error, "No Git provider named '#{name}'." end if !R10K::Features.available?(attrs[:feature]) @provider = NULL_PROVIDER raise R10K::Error, "Git provider '#{name}' is not functional." end if attrs[:on_set] attrs[:on_set].call end @provider = attrs[:module] end |
.reset! ⇒ Object
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.
Clear the currently set provider.
120 121 122 |
# File 'lib/r10k/git.rb', line 120 def self.reset! @provider = UNSET_PROVIDER end |
.thin_repository ⇒ Object
113 114 115 |
# File 'lib/r10k/git.rb', line 113 def self.thin_repository provider::ThinRepository end |