Class: Gitlab::QA::Support::GitlabVersionInfo
- Inherits:
-
Object
- Object
- Gitlab::QA::Support::GitlabVersionInfo
- Defined in:
- lib/gitlab/qa/support/gitlab_version_info.rb
Constant Summary collapse
- VERSION_PATTERN =
/^(?<version>\d+\.\d+\.\d+)/.freeze
- COMPONENT_PATTERN =
/^(?<major>\d+)\.(?<minor>\d+)\.(?<patch>\d+)/.freeze
Instance Method Summary collapse
-
#initialize(current_version, edition) ⇒ GitlabVersionInfo
constructor
Get previous gitlab version.
-
#latest_patch(version) ⇒ String
Get latest patch for specific version number.
-
#previous_version(semver_component) ⇒ Gem::Version
Get N - 1 version number.
Constructor Details
#initialize(current_version, edition) ⇒ GitlabVersionInfo
Get previous gitlab version
14 15 16 17 18 |
# File 'lib/gitlab/qa/support/gitlab_version_info.rb', line 14 def initialize(current_version, edition) @current_version = current_version @edition = edition @logger = Runtime::Logger.logger end |
Instance Method Details
#latest_patch(version) ⇒ String
Get latest patch for specific version number
latest_patch(Gem::Version.new(“14.10”)) => “14.10.5”
44 45 46 |
# File 'lib/gitlab/qa/support/gitlab_version_info.rb', line 44 def latest_patch(version) versions.find { |ver| ver.to_s.match?(/^#{version}/) } end |
#previous_version(semver_component) ⇒ Gem::Version
Get N - 1 version number
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/gitlab/qa/support/gitlab_version_info.rb', line 24 def previous_version(semver_component) case semver_component when "major" previous_major when "minor" previous_minor when "patch" previous_patch else raise("Unsupported semver component, must be major|minor|patch") end end |