Skip to content

Commit

Permalink
Merge pull request #8 from HerveMARTIN/master
Browse files Browse the repository at this point in the history
Add numeric tag convention support
  • Loading branch information
tampakrap authored Apr 27, 2017
2 parents 9f60818 + f7708ca commit 3f6cecd
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/ra10ke.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,14 @@ def initialize(*args)
when 'sha'
latest_ref = remote_refs['head'][:sha]
when 'tag'
# we have to be opinionated here, due to multiple conventions only one can reign suppreme
# as such tag v#.#.# is what will pick.
if ref.match(/^[vV]\d/)
# we have to be opinionated here, due to multiple conventions only the two main will be accepted
# v#.#.# or #.#.# is what we will pick.
if ref.match(/^[vV]?\d[\.\d]*/)
tags = remote_refs['tags']
version_tags = tags.select { |f| /^[vV]\d/.match(f) }
version_tags = tags.select { |f| /^[vV]?\d[\.\d]*/.match(f) }
latest_ref = version_tags.keys.sort.last
else
latest_ref = "undef (tags don't match v#.#.# or #.#.#)"
end
else
raise "Unable to determine ref_type for #{puppet_module.title}"
Expand Down

0 comments on commit 3f6cecd

Please sign in to comment.