Class: Roger::Release::Scm::Git
- Defined in:
- lib/roger/release/scm/git.rb
Overview
The GIT SCM implementation for Roger release
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.find_git_dir(path) ⇒ Object
Find the .git dir in path and all it’s parents.
Instance Method Summary collapse
-
#date ⇒ Object
Date will be Time.now if it can’t be determined from GIT repository.
-
#initialize(config = {}) ⇒ Git
constructor
A new instance of Git.
- #previous ⇒ Object
-
#version ⇒ Object
Version is either: - the tagged version number (first “v” will be stripped) or - the return value of “git describe –tags HEAD” - the short SHA1 if there hasn’t been a previous tag.
Constructor Details
#initialize(config = {}) ⇒ Git
Returns a new instance of Git.
25 26 27 28 |
# File 'lib/roger/release/scm/git.rb', line 25 def initialize(config = {}) super(config) @config[:ref] ||= "HEAD" end |
Class Method Details
.find_git_dir(path) ⇒ Object
Find the .git dir in path and all it’s parents
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/roger/release/scm/git.rb', line 10 def self.find_git_dir(path) path = Pathname.new(path).realpath while path.parent != path && !(path + ".git").directory? path = path.parent end path += ".git" raise "Could not find suitable .git dir in #{path}" unless path.directory? path end |
Instance Method Details
#date ⇒ Object
Date will be Time.now if it can’t be determined from GIT repository
40 41 42 43 |
# File 'lib/roger/release/scm/git.rb', line 40 def date get_scm_data if @_date.nil? @_date end |
#previous ⇒ Object
45 46 47 |
# File 'lib/roger/release/scm/git.rb', line 45 def previous self.class.new(@config.dup.update(ref: get_previous_tag_name)) end |
#version ⇒ Object
Version is either:
-
the tagged version number (first “v” will be stripped) or
-
the return value of “git describe –tags HEAD”
-
the short SHA1 if there hasn’t been a previous tag
34 35 36 37 |
# File 'lib/roger/release/scm/git.rb', line 34 def version get_scm_data if @_version.nil? @_version end |