gitlab-releases 0.2.6 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2128d5d1e5b1c5d79f06479831fcac6c60e00cc490a65baf93c4d8066154a47
4
- data.tar.gz: 60fdbd787c8ad353e52d442c6830ac56428622f5d65b36fb7e6cccaa2de8923a
3
+ metadata.gz: 398d982b17a8d628849e352c7ee03f10e61c8c614c832ace28902fd326a5eebb
4
+ data.tar.gz: 69d632509a623cd23dc7498d5a60ec118154c51b98d034bce5e4952210f80355
5
5
  SHA512:
6
- metadata.gz: ffb780317bd4ada84fdb7312380049ac5e3baee5662742ca1efdeb74cfd613932c76025b26c7c767e5709ead7f07a89100d39d7c0e16b3657dce682ad50d2369
7
- data.tar.gz: 35f7c73a835b18097568b403f8a3232a302d3714c12d121d1760dc642fe45ed92e4b67566994b10e2b063a92188afc7e13dc49033906a01aa093874ff88184b7
6
+ metadata.gz: 180fe99859fa9342cda4d121b756a7fc393d4b4579a2d534e9d47b3f3bacbe54408c4c27671ab345a50fffc7c70a32e3c080dfdf94810252414c9318c3a4f27b
7
+ data.tar.gz: 9ab1c1360811f394d8dd00f992fb0253b0fa9d21f545394cd650c1cde8c14ad23a04562f16e6e1b492239d56c1193e415e157a95342cad36c143585dd0ccd4bc
data/CHANGELOG.md CHANGED
@@ -44,3 +44,15 @@
44
44
  ## [0.2.6] - 2024-02-22
45
45
 
46
46
  - Add `available_versions` method to return the available GitLab versions (sorted by most recent)
47
+
48
+ ## [0.2.7] - 2024-03-06
49
+
50
+ - Add `next_patch_release_date` method to return the next best-effort date for patch releases
51
+
52
+ ## [0.2.8]
53
+
54
+ - Yanked version
55
+
56
+ ## [0.2.9] - 2024-04-18
57
+
58
+ - Fixes `ReleaseCalculator` class to consider major milestones.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-releases (0.2.6)
4
+ gitlab-releases (0.2.7)
5
5
  activesupport (~> 7.1)
6
6
  gitlab (~> 4.19.0)
7
7
  http (~> 5.1.1, ~> 5.1)
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', '~> 0.2.5'
15
+ gem 'gitlab-releases', '~> 0.2.9'
16
16
  ```
17
17
 
18
18
  Install:
@@ -39,6 +39,7 @@ There are different methods available:
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
+ * `next_patch_release_date` - Calculates the next best effort date for a GitLab patch release.
42
43
 
43
44
  To make use of it:
44
45
 
@@ -80,6 +81,9 @@ To make use of it:
80
81
  => "16.6"
81
82
  > GitlabReleases.previous_minors('16.6')
82
83
  => ["16.6", "16.5", "16.4"]
84
+ > GitlabReleases.next_patch_release_date
85
+ => "2024-03-13"
86
+
83
87
  ```
84
88
 
85
89
  ## Contributing
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/all'
4
+
5
+ # Calculates the next patch release date. Patch releases are scheduled
6
+ # twice a month based on the monthly release:
7
+ #
8
+ # - On the second Wednesday of the month (the week before the monthly release)
9
+ # - On the fourth Wednesday of the month (the week after the monthly release)
10
+ class PatchDateCalculator
11
+ def initialize
12
+ @next_release_date = ReleaseVersions.upcoming_release_date
13
+ end
14
+
15
+ def execute
16
+ next_patch_date.strftime('%Y-%m-%d')
17
+ end
18
+
19
+ private
20
+
21
+ attr_reader :next_release_date
22
+
23
+ def next_patch_date
24
+ if current_date >= prev_wednesday
25
+ next_wednesday
26
+ else
27
+ prev_wednesday
28
+ end
29
+ end
30
+
31
+ def current_date
32
+ Date.today
33
+ end
34
+
35
+ def prev_wednesday
36
+ next_release_date.prev_week(:wednesday)
37
+ end
38
+
39
+ def next_wednesday
40
+ next_release_date.next_week(:wednesday)
41
+ end
42
+ end
@@ -12,7 +12,7 @@ class ReleaseCalculator
12
12
 
13
13
  def execute
14
14
  @release_dates[current_version] = release_date.strftime('%Y-%m-%d')
15
- next_version = ReleaseVersion.new(current_version.next_minor)
15
+ next_version = calculate_release_version(current_version, release_date)
16
16
 
17
17
  period(release_date, release_date + 1.year).each do |candidate_date|
18
18
  @release_dates[next_version] = calculate_release_date(next_version, candidate_date)
@@ -78,6 +78,13 @@ class ReleaseVersions
78
78
  Date.parse(date)
79
79
  end
80
80
 
81
+ # Returns the release date of the upcoming (active) version
82
+ def self.upcoming_release_date
83
+ releases_yaml
84
+ .find { |release| release['version'] == active_version }
85
+ .fetch('date')
86
+ end
87
+
81
88
  # Returns the active minor GitLab Version
82
89
  def self.active_version
83
90
  version_for_date(DateTime.now)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitlabReleases
4
- VERSION = "0.2.6"
4
+ VERSION = "0.2.9"
5
5
  end
@@ -4,6 +4,7 @@ require_relative 'gitlab_releases/version'
4
4
  require_relative 'gitlab_releases/release_version'
5
5
  require_relative 'gitlab_releases/release_versions'
6
6
  require_relative 'gitlab_releases/release_calculator'
7
+ require_relative 'gitlab_releases/patch_date_calculator'
7
8
 
8
9
  module GitlabReleases
9
10
  def self.upcoming_releases
@@ -45,6 +46,10 @@ module GitlabReleases
45
46
  ReleaseVersions.available_versions
46
47
  end
47
48
 
49
+ def self.next_patch_release_date
50
+ PatchDateCalculator.new.execute
51
+ end
52
+
48
53
  def self.release_date
49
54
  ReleaseVersions.previous_release_date
50
55
  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: 0.2.6
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mayra Cabrera
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-02-24 00:00:00.000000000 Z
11
+ date: 2024-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -105,6 +105,7 @@ files:
105
105
  - Rakefile
106
106
  - lib/gitlab_releases.rb
107
107
  - lib/gitlab_releases/date_calculator.rb
108
+ - lib/gitlab_releases/patch_date_calculator.rb
108
109
  - lib/gitlab_releases/release_calculator.rb
109
110
  - lib/gitlab_releases/release_version.rb
110
111
  - lib/gitlab_releases/release_version_client.rb