Class: Deployed::RepoData
- Inherits:
-
Object
- Object
- Deployed::RepoData
- Defined in:
- lib/deployed_version.rb
Overview
RepoData
Instance Method Summary collapse
- #branch ⇒ Object
- #extra ⇒ Object
- #label ⇒ Object
- #major ⇒ Object
- #minor ⇒ Object
- #patch ⇒ Object
- #release ⇒ Object
- #release_url ⇒ Object
- #revision ⇒ Object
- #revision_short ⇒ Object
- #tag ⇒ Object
- #version_hash ⇒ Object
- #version_label ⇒ Object
Instance Method Details
#branch ⇒ Object
17 18 19 |
# File 'lib/deployed_version.rb', line 17 def branch @branch ||= git_branch || read_file('BRANCH').strip.presence end |
#extra ⇒ Object
49 50 51 |
# File 'lib/deployed_version.rb', line 49 def extra @extra ||= version(:extra) end |
#label ⇒ Object
33 34 35 |
# File 'lib/deployed_version.rb', line 33 def label tag.presence || branch end |
#major ⇒ Object
37 38 39 |
# File 'lib/deployed_version.rb', line 37 def major @major ||= version(:major) end |
#minor ⇒ Object
41 42 43 |
# File 'lib/deployed_version.rb', line 41 def minor @minor ||= version(:minor) end |
#patch ⇒ Object
45 46 47 |
# File 'lib/deployed_version.rb', line 45 def patch @patch ||= version(:patch) end |
#release ⇒ Object
21 22 23 |
# File 'lib/deployed_version.rb', line 21 def release @release ||= read_file('RELEASE').strip end |
#release_url ⇒ Object
25 26 27 |
# File 'lib/deployed_version.rb', line 25 def release_url @release_url ||= read_file('REPO').strip end |
#revision ⇒ Object
13 14 15 |
# File 'lib/deployed_version.rb', line 13 def revision @revision ||= git_rev || read_file('REVISION').strip.presence end |
#revision_short ⇒ Object
29 30 31 |
# File 'lib/deployed_version.rb', line 29 def revision_short @revision_short ||= revision&.slice 0..6 end |
#tag ⇒ Object
9 10 11 |
# File 'lib/deployed_version.rb', line 9 def tag @tag ||= git_tag || read_file('TAG').strip.presence end |
#version_hash ⇒ Object
53 54 55 |
# File 'lib/deployed_version.rb', line 53 def version_hash @version_hash ||= /\Av(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)(?<extra>\S*)/.match(label) end |
#version_label ⇒ Object
57 58 59 |
# File 'lib/deployed_version.rb', line 57 def version_label major == 0 && minor == 0 && patch == 0 ? 'WIP' : "#{major}.#{minor}.#{patch}" end |