gitlab-releases 0.2.6 → 0.2.7

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: ba2a507b7f62c3bca97c047552db82c0fce54aaa86dec916d3a1287ef6876a53
4
+ data.tar.gz: aa4ef249135d59e250253959baabd9de000784c730a1392db5672230dc479457
5
5
  SHA512:
6
- metadata.gz: ffb780317bd4ada84fdb7312380049ac5e3baee5662742ca1efdeb74cfd613932c76025b26c7c767e5709ead7f07a89100d39d7c0e16b3657dce682ad50d2369
7
- data.tar.gz: 35f7c73a835b18097568b403f8a3232a302d3714c12d121d1760dc642fe45ed92e4b67566994b10e2b063a92188afc7e13dc49033906a01aa093874ff88184b7
6
+ metadata.gz: ef1b10c9b7cefbac34aeb42dab2ec5926ae7a8852739a94b41b994e076c703ca7ab6950f03a72df58337cdd95e8fdf3cb67182f4bbc085a2adfc6a1002ae3ce0
7
+ data.tar.gz: 560e30af0ca8b466dfddd70300e29d6c6fda4a4ba2752b9eabf4a15d06339bffa0418c8fb2a67456fcecc136e728ef71905caa1728f6f0f1bf4467a6dfd96d61
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.7'
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
@@ -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.7"
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.7
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-03-06 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