gitlab-releases 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e51c4e22adebcd75c05415b56213905d1f78dc1f72f15da5da2d82224d83922
4
- data.tar.gz: 40eb75af8a217fe84e32bca60da04397f8ef9cc326eb4485ac74775bd6ee3413
3
+ metadata.gz: 1f9a73b90b46892ca18e3a95eba76136dd3d1f55e8c0eec56a39068076b1e4b3
4
+ data.tar.gz: d82099b7bf7cd5d0761e8c5b538df4628d8e754127858a8e18d03d94fb03dbcc
5
5
  SHA512:
6
- metadata.gz: 8ebfea495dd73367f14066c7d21dfec3c68f43c7d3588941793c39d0099b87ba9d73a6c1d1b7b8ea50bc11eb22705f0fc47cde223b100baa38864bbc51b26a78
7
- data.tar.gz: a1f42624bc33734f2cd698cdf7a0ac7f22f937ff05da355dda48f3e3154fe404e2d3c8ff62ce214455f4ad4eaadcff6957487cb06548f87af5143b9519b8330e
6
+ metadata.gz: aefa80ca4044fee1975419c938eb174c326c0bbfd7b662c89af5f2d6695ad4affb94391fba49e74f90d375e68d26bb6878425e133b2837258f09d88ce09472a3
7
+ data.tar.gz: 8d13eaea034f5682daba9d8de01ca5d42bcdd921fdc93ca64b23b9037bb3c41fae759aaf7da3be4c7f58283c8657bf603fca34b066f0f5b70d12b3a589b77978
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.1.0] - 2025-03-04
4
+
5
+ - Add `latest_patch_for_version` method to retrieve the latest patch for a given minor version
6
+
3
7
  ## [1.0.1] - 2024-11-20
4
8
 
5
9
  - Upgrade gitlab gem to 5.1
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-releases (1.0.1)
4
+ gitlab-releases (1.1.0)
5
5
  activesupport (~> 8.0)
6
6
  gitlab (~> 5.1)
7
7
  http (~> 5.2.0, ~> 5.2)
data/README.md CHANGED
@@ -12,7 +12,7 @@ Library to interact with GitLab releases and versions. The information is fetche
12
12
  Gemfile:
13
13
 
14
14
  ```
15
- gem 'gitlab-releases', '~> 1.0.1'
15
+ gem 'gitlab-releases', '~> 1.1.0'
16
16
  ```
17
17
 
18
18
  Install:
@@ -35,11 +35,12 @@ There are different methods available:
35
35
  * `active_version` - Returns the active GitLab version.
36
36
  * `current_version` - Returns the current GitLab minor version.
37
37
  * `next_versions` - Returns the next GitLab patch versions (for patch and security releases).
38
- * `previous_version` - Returns the return the latest patch of the previous minor version.
38
+ * `previous_version` - Returns the latest patch of the previous minor version.
39
39
  * `version_for_date` - Returns the active GitLab version for the given date
40
40
  * `current_minor_for_date` - Returns the current GitLab minor for the given date
41
41
  * `previous_minors` - Returns the previous minors for the given version
42
42
  * `next_patch_release_date` - Calculates the next best effort date for a GitLab patch release.
43
+ * `latest_patch_for_version` - Returns the latest patch for the given minor version
43
44
 
44
45
  To make use of it:
45
46
 
@@ -83,6 +84,8 @@ To make use of it:
83
84
  => ["16.6", "16.5", "16.4"]
84
85
  > GitlabReleases.next_patch_release_date
85
86
  => "2024-03-13"
87
+ > GitlabReleases.latest_patch_for_version('16.6')
88
+ => "16.6.10"
86
89
 
87
90
  ```
88
91
 
@@ -103,4 +106,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
103
106
  Everyone interacting in the Releases project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://gitlab.com/gitlab-org/ruby/gems/gitlab-releases/-/blob/main/CODE_OF_CONDUCT.md).
104
107
 
105
108
  [Delivery team tracker]: https://gitlab.com/gitlab-com/gl-infra/delivery
106
- [Releases documentation]: https://gitlab.com/gitlab-org/ruby/gems/gitlab-releases/-/blob/master/docs/releases.md
109
+ [Releases documentation]: https://gitlab.com/gitlab-org/ruby/gems/gitlab-releases/-/blob/main/docs/releases.md
@@ -155,6 +155,19 @@ class ReleaseVersions
155
155
  next_versions.second.previous_patch
156
156
  end
157
157
 
158
+ # Returns the latest patch for a given minor version
159
+ #
160
+ # For example:
161
+ # - If the given version is 16.7 and available versions include 16.7.0, 16.7.1, 16.7.2
162
+ # it will return 16.7.2
163
+ # - If the given version is 16.5 and available versions include 16.5.0, 16.5.1
164
+ # it will return 16.5.1
165
+ def self.latest_patch_for_version(version)
166
+ minor_version = ReleaseVersion.new(version).to_minor
167
+
168
+ available_versions.find { |v| v.start_with?("#{minor_version}.") }
169
+ end
170
+
158
171
  def self.sort(versions)
159
172
  ::VersionSorter.sort(versions).uniq
160
173
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitlabReleases
4
- VERSION = "1.0.1"
4
+ VERSION = "1.1.0"
5
5
  end
@@ -54,5 +54,9 @@ module GitlabReleases
54
54
  ReleaseVersions.previous_release_date
55
55
  end
56
56
 
57
+ def self.latest_patch_for_version(version)
58
+ ReleaseVersions.latest_patch_for_version(version)
59
+ end
60
+
57
61
  private_class_method :release_date
58
62
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-releases
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mayra Cabrera
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-11-22 00:00:00.000000000 Z
11
+ date: 2025-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -86,7 +86,7 @@ dependencies:
86
86
  - - "~>"
87
87
  - !ruby/object:Gem::Version
88
88
  version: 2.3.0
89
- description:
89
+ description:
90
90
  email:
91
91
  - mcabrera@gitlab.com
92
92
  executables: []
@@ -121,7 +121,7 @@ metadata:
121
121
  homepage_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab-releases
122
122
  source_code_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab-releases
123
123
  changelog_uri: https://gitlab.com/gitlab-org/ruby/gems/gitlab-releases/-/blob/main/CHANGELOG.md
124
- post_install_message:
124
+ post_install_message:
125
125
  rdoc_options: []
126
126
  require_paths:
127
127
  - lib
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
137
  version: '0'
138
138
  requirements: []
139
139
  rubygems_version: 3.5.9
140
- signing_key:
140
+ signing_key:
141
141
  specification_version: 4
142
142
  summary: Utilities for GitLab releases and versions
143
143
  test_files: []