gitlab-releases 1.0.1 → 1.1.1

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: dfa23ec3875d0be0aeb533880699472b519f9b79979f72abf8dec908211a54b3
4
+ data.tar.gz: 9ea6daf479a604784862880a253825b5cb2e45e0402a0be7314695f4072c16f8
5
5
  SHA512:
6
- metadata.gz: 8ebfea495dd73367f14066c7d21dfec3c68f43c7d3588941793c39d0099b87ba9d73a6c1d1b7b8ea50bc11eb22705f0fc47cde223b100baa38864bbc51b26a78
7
- data.tar.gz: a1f42624bc33734f2cd698cdf7a0ac7f22f937ff05da355dda48f3e3154fe404e2d3c8ff62ce214455f4ad4eaadcff6957487cb06548f87af5143b9519b8330e
6
+ metadata.gz: 4cdac277270ff3628ab6b2ee3d27ba94b5a8bddc2a46b507fa3d0610d7ad15a373ad501232f32dc3c84d94bab83474b34e76518a397d22a875fe11b2554dee61
7
+ data.tar.gz: 23f09c9c98ed1d3bf0fe998bb8b504eda5b09d6842735149b5c6d92822e58cce573e4654e7fbaa097d20a4c2b0bdc1ada7ce42c0d8397640754f93c4a3b7abc1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.1.1] - 2025-05-19
4
+
5
+ - Fix bug in `next_patch_release_date` - https://gitlab.com/gitlab-org/ruby/gems/gitlab-releases/-/merge_requests/49
6
+
7
+ ## [1.1.0] - 2025-03-04
8
+
9
+ - Add `latest_patch_for_version` method to retrieve the latest patch for a given minor version
10
+
3
11
  ## [1.0.1] - 2024-11-20
4
12
 
5
13
  - 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.1)
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.1'
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
@@ -10,6 +10,7 @@ require 'active_support/all'
10
10
  class PatchDateCalculator
11
11
  def initialize
12
12
  @next_release_date = ReleaseVersions.upcoming_release_date
13
+ @previous_release_date = ReleaseVersions.previous_release_date
13
14
  end
14
15
 
15
16
  def execute
@@ -18,13 +19,15 @@ class PatchDateCalculator
18
19
 
19
20
  private
20
21
 
21
- attr_reader :next_release_date
22
+ attr_reader :next_release_date, :previous_release_date
22
23
 
23
24
  def next_patch_date
24
- if current_date >= prev_wednesday
25
- next_wednesday
25
+ if current_date < prev_release_next_wednesday
26
+ prev_release_next_wednesday
27
+ elsif current_date < next_release_prev_wednesday
28
+ next_release_prev_wednesday
26
29
  else
27
- prev_wednesday
30
+ next_release_next_wednesday
28
31
  end
29
32
  end
30
33
 
@@ -32,11 +35,15 @@ class PatchDateCalculator
32
35
  Date.today
33
36
  end
34
37
 
35
- def prev_wednesday
38
+ def prev_release_next_wednesday
39
+ previous_release_date.next_week(:wednesday)
40
+ end
41
+
42
+ def next_release_prev_wednesday
36
43
  next_release_date.prev_week(:wednesday)
37
44
  end
38
45
 
39
- def next_wednesday
46
+ def next_release_next_wednesday
40
47
  next_release_date.next_week(:wednesday)
41
48
  end
42
49
  end
@@ -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.1"
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.1
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-05-20 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: []