Class: ReleaseVersion
- Inherits:
-
String
- Object
- String
- ReleaseVersion
- Defined in:
- lib/gitlab_releases/release_version.rb
Constant Summary collapse
- VERSION_REGEX =
/ \A(?<major>\d+) \.(?<minor>\d+) (\.(?<patch>\d+))? (-(?<rc>rc(?<rc_number>\d*)))? (-\h+\.\h+)? (-ee|\.ee\.\d+)?\z /x
Instance Method Summary collapse
- #ee? ⇒ Boolean
- #major ⇒ Object
- #minor ⇒ Object
- #next_major ⇒ Object
- #next_minor ⇒ Object
- #next_patch ⇒ Object
- #patch ⇒ Object
- #patch? ⇒ Boolean
- #previous_minor ⇒ Object
- #previous_patch ⇒ Object
- #to_ee ⇒ Object
- #to_minor ⇒ Object
Instance Method Details
#ee? ⇒ Boolean
55 56 57 |
# File 'lib/gitlab_releases/release_version.rb', line 55 def ee? end_with?('-ee') end |
#major ⇒ Object
13 14 15 |
# File 'lib/gitlab_releases/release_version.rb', line 13 def major @major ||= extract_from_version(:major).to_i end |
#minor ⇒ Object
17 18 19 |
# File 'lib/gitlab_releases/release_version.rb', line 17 def minor @minor ||= extract_from_version(:minor).to_i end |
#next_major ⇒ Object
29 30 31 |
# File 'lib/gitlab_releases/release_version.rb', line 29 def next_major "#{major + 1}.0" end |
#next_minor ⇒ Object
25 26 27 |
# File 'lib/gitlab_releases/release_version.rb', line 25 def next_minor "#{major}.#{minor + 1}" end |
#next_patch ⇒ Object
49 50 51 52 53 |
# File 'lib/gitlab_releases/release_version.rb', line 49 def next_patch new_patch = self.class.new("#{major}.#{minor}.#{patch + 1}") ee? ? new_patch.to_ee : new_patch end |
#patch ⇒ Object
21 22 23 |
# File 'lib/gitlab_releases/release_version.rb', line 21 def patch @patch ||= extract_from_version(:patch).to_i end |
#patch? ⇒ Boolean
59 60 61 |
# File 'lib/gitlab_releases/release_version.rb', line 59 def patch? patch.positive? end |
#previous_minor ⇒ Object
37 38 39 |
# File 'lib/gitlab_releases/release_version.rb', line 37 def previous_minor "#{major}.#{minor - 1}" end |
#previous_patch ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/gitlab_releases/release_version.rb', line 41 def previous_patch return unless patch? new_patch = self.class.new("#{major}.#{minor}.#{patch - 1}") ee? ? new_patch.to_ee : new_patch end |
#to_ee ⇒ Object
63 64 65 66 67 |
# File 'lib/gitlab_releases/release_version.rb', line 63 def to_ee return self if ee? self.class.new("#{self}-ee") end |
#to_minor ⇒ Object
33 34 35 |
# File 'lib/gitlab_releases/release_version.rb', line 33 def to_minor "#{major}.#{minor}" end |