Class: BuildTool::VCS::GitConfiguration
- Inherits:
-
BaseConfiguration
- Object
- BaseConfiguration
- BuildTool::VCS::GitConfiguration
- Includes:
- MJ::Mixins::InheritedAttributes
- Defined in:
- lib/build-tool/vcs/git.rb
Overview
Configuration options for the git vcs.
Direct Known Subclasses
Class Attribute Summary collapse
-
.global_config ⇒ Object
The global configuration object.
-
.global_config_checked ⇒ Object
Was the global configuration ($HOME/.gitconfig) already checked?.
Instance Attribute Summary collapse
-
#global_options ⇒ Hash<String,String>
The configured global options.
-
#name ⇒ String
readonly
returns the name of the vcs.
-
#options ⇒ Object
Returns the value of attribute options.
-
#remote ⇒ Object
Returns the value of attribute remote.
- #track ⇒ Object
Attributes inherited from BaseConfiguration
Instance Method Summary collapse
- #copy_configuration(other) ⇒ Object
-
#initialize ⇒ GitConfiguration
constructor
A new instance of GitConfiguration.
- #merged_global_options ⇒ Object
- #merged_options ⇒ Object
- #merged_remote ⇒ Object
-
#track_branch ⇒ String
The branch part of #remote.
-
#track_remote ⇒ String
The remote part of #remote.
- #vcs(mod) ⇒ Object
Methods included from MJ::Mixins::InheritedAttributes
Methods inherited from BaseConfiguration
Constructor Details
#initialize ⇒ GitConfiguration
Returns a new instance of GitConfiguration.
158 159 160 161 162 163 164 165 166 |
# File 'lib/build-tool/vcs/git.rb', line 158 def initialize super @remote = {} @track = nil @options = {} @global_options = {} @already_checked_config = false @already_checked_user_config = false end |
Class Attribute Details
.global_config ⇒ Object
The global configuration object
128 129 130 |
# File 'lib/build-tool/vcs/git.rb', line 128 def global_config @global_config end |
.global_config_checked ⇒ Object
Was the global configuration ($HOME/.gitconfig) already checked?
131 132 133 |
# File 'lib/build-tool/vcs/git.rb', line 131 def global_config_checked @global_config_checked end |
Instance Attribute Details
#global_options ⇒ Hash<String,String>
Returns the configured global options.
150 151 152 |
# File 'lib/build-tool/vcs/git.rb', line 150 def @global_options end |
#name ⇒ String (readonly)
returns the name of the vcs.
117 118 119 |
# File 'lib/build-tool/vcs/git.rb', line 117 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
141 142 143 |
# File 'lib/build-tool/vcs/git.rb', line 141 def @options end |
#remote ⇒ Object
Returns the value of attribute remote.
134 135 136 |
# File 'lib/build-tool/vcs/git.rb', line 134 def remote @remote end |
#track ⇒ Object
177 178 179 180 181 |
# File 'lib/build-tool/vcs/git.rb', line 177 def track return @track if @track # Our track return parent.track if @parent # Out parents track "origin/master" # The default end |
Instance Method Details
#copy_configuration(other) ⇒ Object
205 206 207 208 |
# File 'lib/build-tool/vcs/git.rb', line 205 def copy_configuration( other ) super @remote = {} # Do not copy the remotes end |
#merged_global_options ⇒ Object
152 153 154 155 156 |
# File 'lib/build-tool/vcs/git.rb', line 152 def return @global_options if self == GitConfiguration.global_config return @global_options.merge( GitConfiguration.global_config.instance_variable_get( "@global_options" ) ) if GitConfiguration.global_config return @global_options end |
#merged_options ⇒ Object
142 143 144 145 146 147 |
# File 'lib/build-tool/vcs/git.rb', line 142 def return @options if self == GitConfiguration.global_config # This is the global configuration. return parent..merge( @options ) if @parent # We have a parent. Merge with it return GitConfiguration.global_config..merge( @options ) if GitConfiguration.global_config # No parent. Merge with global return @options # No parent, no global. Just us end |
#merged_remote ⇒ Object
135 136 137 138 |
# File 'lib/build-tool/vcs/git.rb', line 135 def merged_remote return parent.merged_remote.merge( @remote ) if @parent return @remote end |
#track_branch ⇒ String
The branch part of #remote
197 198 199 200 201 202 203 |
# File 'lib/build-tool/vcs/git.rb', line 197 def track_branch rc = track.split('/') # If there is only one string we assume it is the branch name from # origin return rc[0] if rc.length == 1 return rc[1..-1].join( '/' ) end |
#track_remote ⇒ String
The remote part of #remote.
186 187 188 189 190 191 192 |
# File 'lib/build-tool/vcs/git.rb', line 186 def track_remote rc = track.split('/') # If there is only one string we assume it is the branch name from # origin return "origin" if rc.length == 1 return rc[0] end |