gitlab-releases 0.2.4 → 0.2.6

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: 96b0b12edaa3ab669ff5b01e2a3ad8a699321aaec1fe1d8ba52be69db6de9e59
4
- data.tar.gz: b4e78d554defe39d5a06d4d10d92b4d48e55ef9371ffe7823a7090620a9f6a5f
3
+ metadata.gz: e2128d5d1e5b1c5d79f06479831fcac6c60e00cc490a65baf93c4d8066154a47
4
+ data.tar.gz: 60fdbd787c8ad353e52d442c6830ac56428622f5d65b36fb7e6cccaa2de8923a
5
5
  SHA512:
6
- metadata.gz: 6e52f6976faa23b62f28edefe9fa660f138e7eb8bbd9e3b0b143152c1e727da934c73234ece5edf112151caf9020ae1da806fae5f5f64a5dbbe6a4f16fa9ca85
7
- data.tar.gz: 404e69849913a99274acbfc016af7f0f4beca48b5cd176f8bc9fd6d2d7c9fc7147c6fc3d1c542a5cc46ec5c63530bf467c4a2eae167b1fe4073347094ba4c5a7
6
+ metadata.gz: ffb780317bd4ada84fdb7312380049ac5e3baee5662742ca1efdeb74cfd613932c76025b26c7c767e5709ead7f07a89100d39d7c0e16b3657dce682ad50d2369
7
+ data.tar.gz: 35f7c73a835b18097568b403f8a3232a302d3714c12d121d1760dc642fe45ed92e4b67566994b10e2b063a92188afc7e13dc49033906a01aa093874ff88184b7
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.0.0
data/CHANGELOG.md CHANGED
@@ -36,3 +36,11 @@
36
36
  ## [0.2.4] - 2023-11-03
37
37
 
38
38
  - Remove logic for static release date. All release dates will be calculated based on the third Thursday of the month.
39
+
40
+ ## [0.2.5] - 2023-11-23
41
+
42
+ - Add methods to calculate the current version of a given date (`#current_minor_for_date`) and the previous minors for a specific version (`#previous_minors`)
43
+
44
+ ## [0.2.6] - 2024-02-22
45
+
46
+ - Add `available_versions` method to return the available GitLab versions (sorted by most recent)
data/Gemfile CHANGED
@@ -7,7 +7,7 @@ gemspec
7
7
 
8
8
  gem 'activesupport', '~> 7.1'
9
9
  gem 'gitlab', '~> 4.19.0'
10
- gem 'http', '~> 5.1.0'
10
+ gem 'http', '~> 5.1.1'
11
11
  gem 'rake', '~> 13.0'
12
12
  gem 'retriable', '~> 3.1.2'
13
13
  gem 'version_sorter', '~> 2.3.0'
data/Gemfile.lock CHANGED
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gitlab-releases (0.2.3)
4
+ gitlab-releases (0.2.6)
5
5
  activesupport (~> 7.1)
6
6
  gitlab (~> 4.19.0)
7
- http (~> 5.1.0)
7
+ http (~> 5.1.1, ~> 5.1)
8
8
  retriable (~> 3.1.2)
9
9
  version_sorter (~> 2.3.0)
10
10
 
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activesupport (7.1.0)
14
+ activesupport (7.1.3.2)
15
15
  base64
16
16
  bigdecimal
17
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -21,32 +21,32 @@ GEM
21
21
  minitest (>= 5.1)
22
22
  mutex_m
23
23
  tzinfo (~> 2.0)
24
- addressable (2.8.5)
24
+ addressable (2.8.6)
25
25
  public_suffix (>= 2.0.2, < 6.0)
26
26
  ast (2.4.2)
27
- base64 (0.1.1)
28
- bigdecimal (3.1.4)
27
+ base64 (0.2.0)
28
+ bigdecimal (3.1.6)
29
29
  binding_of_caller (1.0.0)
30
30
  debug_inspector (>= 0.0.1)
31
31
  coderay (1.1.3)
32
- concurrent-ruby (1.2.2)
32
+ concurrent-ruby (1.2.3)
33
33
  connection_pool (2.4.1)
34
- crack (0.4.5)
34
+ crack (1.0.0)
35
+ bigdecimal
35
36
  rexml
36
- debug_inspector (1.1.0)
37
- diff-lcs (1.5.0)
38
- domain_name (0.5.20190701)
39
- unf (>= 0.0.5, < 1.0.0)
40
- drb (2.1.1)
37
+ debug_inspector (1.2.0)
38
+ diff-lcs (1.5.1)
39
+ domain_name (0.6.20240107)
40
+ drb (2.2.0)
41
41
  ruby2_keywords
42
- ffi (1.15.5)
42
+ ffi (1.16.3)
43
43
  ffi-compiler (1.0.1)
44
44
  ffi (>= 1.0.0)
45
45
  rake
46
46
  gitlab (4.19.0)
47
47
  httparty (~> 0.20)
48
48
  terminal-table (>= 1.5.1)
49
- hashdiff (1.0.1)
49
+ hashdiff (1.1.0)
50
50
  http (5.1.1)
51
51
  addressable (~> 2.8)
52
52
  http-cookie (~> 1.0)
@@ -60,18 +60,18 @@ GEM
60
60
  multi_xml (>= 0.5.2)
61
61
  i18n (1.14.1)
62
62
  concurrent-ruby (~> 1.0)
63
- json (2.6.3)
63
+ json (2.7.1)
64
64
  language_server-protocol (3.17.0.3)
65
65
  llhttp-ffi (0.4.0)
66
66
  ffi-compiler (~> 1.0)
67
67
  rake (~> 13.0)
68
68
  method_source (1.0.0)
69
- mini_mime (1.1.2)
70
- minitest (5.20.0)
69
+ mini_mime (1.1.5)
70
+ minitest (5.22.2)
71
71
  multi_xml (0.6.0)
72
- mutex_m (0.1.2)
73
- parallel (1.23.0)
74
- parser (3.2.2.3)
72
+ mutex_m (0.2.0)
73
+ parallel (1.24.0)
74
+ parser (3.3.0.5)
75
75
  ast (~> 2.4.1)
76
76
  racc
77
77
  proc_to_ast (0.1.0)
@@ -81,25 +81,25 @@ GEM
81
81
  pry (0.14.2)
82
82
  coderay (~> 1.1)
83
83
  method_source (~> 1.0)
84
- public_suffix (5.0.3)
85
- racc (1.7.1)
84
+ public_suffix (5.0.4)
85
+ racc (1.7.3)
86
86
  rainbow (3.1.1)
87
- rake (13.0.6)
88
- regexp_parser (2.8.1)
87
+ rake (13.1.0)
88
+ regexp_parser (2.9.0)
89
89
  retriable (3.1.2)
90
90
  rexml (3.2.6)
91
- rspec (3.12.0)
92
- rspec-core (~> 3.12.0)
93
- rspec-expectations (~> 3.12.0)
94
- rspec-mocks (~> 3.12.0)
95
- rspec-core (3.12.2)
96
- rspec-support (~> 3.12.0)
97
- rspec-expectations (3.12.3)
91
+ rspec (3.13.0)
92
+ rspec-core (~> 3.13.0)
93
+ rspec-expectations (~> 3.13.0)
94
+ rspec-mocks (~> 3.13.0)
95
+ rspec-core (3.13.0)
96
+ rspec-support (~> 3.13.0)
97
+ rspec-expectations (3.13.0)
98
98
  diff-lcs (>= 1.2.0, < 2.0)
99
- rspec-support (~> 3.12.0)
100
- rspec-mocks (3.12.6)
99
+ rspec-support (~> 3.13.0)
100
+ rspec-mocks (3.13.0)
101
101
  diff-lcs (>= 1.2.0, < 2.0)
102
- rspec-support (~> 3.12.0)
102
+ rspec-support (~> 3.13.0)
103
103
  rspec-parameterized (1.0.0)
104
104
  rspec-parameterized-core (< 2)
105
105
  rspec-parameterized-table_syntax (< 2)
@@ -108,22 +108,22 @@ GEM
108
108
  proc_to_ast
109
109
  rspec (>= 2.13, < 4)
110
110
  unparser
111
- rspec-parameterized-table_syntax (1.0.0)
111
+ rspec-parameterized-table_syntax (1.0.1)
112
112
  binding_of_caller
113
113
  rspec-parameterized-core (< 2)
114
- rspec-support (3.12.1)
115
- rubocop (1.55.1)
114
+ rspec-support (3.13.1)
115
+ rubocop (1.60.2)
116
116
  json (~> 2.3)
117
117
  language_server-protocol (>= 3.17.0)
118
118
  parallel (~> 1.10)
119
- parser (>= 3.2.2.3)
119
+ parser (>= 3.3.0.2)
120
120
  rainbow (>= 2.2.2, < 4.0)
121
121
  regexp_parser (>= 1.8, < 3.0)
122
122
  rexml (>= 3.2.5, < 4.0)
123
- rubocop-ast (>= 1.28.1, < 2.0)
123
+ rubocop-ast (>= 1.30.0, < 2.0)
124
124
  ruby-progressbar (~> 1.7)
125
125
  unicode-display_width (>= 2.4.0, < 3.0)
126
- rubocop-ast (1.29.0)
126
+ rubocop-ast (1.30.0)
127
127
  parser (>= 3.2.1.0)
128
128
  ruby-progressbar (1.13.0)
129
129
  ruby2_keywords (0.0.5)
@@ -132,13 +132,10 @@ GEM
132
132
  timecop (0.9.8)
133
133
  tzinfo (2.0.6)
134
134
  concurrent-ruby (~> 1.0)
135
- unf (0.1.4)
136
- unf_ext
137
- unf_ext (0.0.8.2)
138
- unicode-display_width (2.4.2)
139
- unparser (0.6.8)
135
+ unicode-display_width (2.5.0)
136
+ unparser (0.6.13)
140
137
  diff-lcs (~> 1.3)
141
- parser (>= 3.2.0)
138
+ parser (>= 3.3.0)
142
139
  vcr (6.2.0)
143
140
  version_sorter (2.3.0)
144
141
  webmock (3.18.1)
@@ -149,13 +146,16 @@ GEM
149
146
  PLATFORMS
150
147
  arm64-darwin-21
151
148
  arm64-darwin-22
149
+ arm64-darwin-23
150
+ ruby
151
+ x86_64-darwin-20
152
152
  x86_64-darwin-22
153
153
 
154
154
  DEPENDENCIES
155
155
  activesupport (~> 7.1)
156
156
  gitlab (~> 4.19.0)
157
157
  gitlab-releases!
158
- http (~> 5.1.0)
158
+ http (~> 5.1.1)
159
159
  pry (~> 0.14.0)
160
160
  rake (~> 13.0)
161
161
  retriable (~> 3.1.2)
@@ -168,4 +168,4 @@ DEPENDENCIES
168
168
  webmock (~> 3.18.0)
169
169
 
170
170
  BUNDLED WITH
171
- 2.3.25
171
+ 2.5.6
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.4'
15
+ gem 'gitlab-releases', '~> 0.2.5'
16
16
  ```
17
17
 
18
18
  Install:
@@ -36,6 +36,9 @@ There are different methods available:
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
38
  * `previous_version` - Returns the return the latest patch of the previous minor version.
39
+ * `version_for_date` - Returns the active GitLab version for the given date
40
+ * `current_minor_for_date` - Returns the current GitLab minor for the given date
41
+ * `previous_minors` - Returns the previous minors for the given version
39
42
 
40
43
  To make use of it:
41
44
 
@@ -69,6 +72,14 @@ To make use of it:
69
72
  => ["16.5.2", "16.4.3", "16.3.7"]
70
73
  > GitlabReleases.previous_version
71
74
  => "16.4.2"
75
+ > GitlabReleases.available_versions
76
+ => ["16.4.1", "16.4.0", "16.3.5", "16.3.4", ...] # Up to 50 versions
77
+ > GitlabReleases.version_for_date('2023-11-23')
78
+ => "16.7"
79
+ > GitlabReleases.current_minor_for_date('2023-11-23')
80
+ => "16.6"
81
+ > GitlabReleases.previous_minors('16.6')
82
+ => ["16.6", "16.5", "16.4"]
72
83
  ```
73
84
 
74
85
  ## Contributing
@@ -54,6 +54,16 @@ class ReleaseVersions
54
54
  end.take(count)
55
55
  end
56
56
 
57
+ # Returns the available GitLab versions as an Array
58
+ #
59
+ # Example:
60
+ #
61
+ # available_versions
62
+ # => ['1.2.3', '1.1.1', '1.0.0']
63
+ def self.available_versions
64
+ ::VersionSorter.rsort(current_list)
65
+ end
66
+
57
67
  # Returns the current GitLab minor version
58
68
  def self.current_version
59
69
  ReleaseVersion.new(next_versions.first.to_minor)
@@ -75,8 +85,8 @@ class ReleaseVersions
75
85
 
76
86
  # Returns the scheduled major.minor for the given date
77
87
  def self.version_for_date(date)
78
- # Returns the release associated with the date by calling `releases_yaml` and fetching the
79
- # release whose date is greater than the given date.
88
+ # Returns the active release associated with the date by calling `releases_yaml` and fetching the
89
+ # release whose date is greater or equal than the given date.
80
90
  #
81
91
  # For example:
82
92
  #
@@ -99,6 +109,34 @@ class ReleaseVersions
99
109
  ReleaseVersion.new(row['version'])
100
110
  end
101
111
 
112
+ # Returns the current major.minor for the given date
113
+ def self.current_minor_for_date(date)
114
+ # Returns the current version associated with the date by calling `releases_yaml`
115
+ # and fetching the version whose release date is less or equal to the given date.
116
+ #
117
+ # For example:
118
+ #
119
+ # | Version | Date |
120
+ # |:--------|:---------------|
121
+ # | 16.3 | August 22nd |
122
+ # | 16.4 | September 22nd |
123
+ # | 16.5 | October 22nd |
124
+ # | 16.6 | November 16th |
125
+ # | 16.7 | December 21st |
126
+ #
127
+ # * For August 21st, the release should be 16.2
128
+ # * For August 22nd, the release should be 16.3
129
+ # * For August 23rd, the release should be 16.3
130
+ # * For November 17th, the release should be 16.6
131
+ return nil if releases_yaml.empty?
132
+
133
+ row = releases_yaml
134
+ .reverse
135
+ .detect { |release| date.to_date >= release['date'] }
136
+
137
+ ReleaseVersion.new(row['version'])
138
+ end
139
+
102
140
  # Returns the last patch of the previous minor version
103
141
  #
104
142
  # For example, if the current version is 16.4, then
@@ -114,6 +152,19 @@ class ReleaseVersions
114
152
  ::VersionSorter.sort(versions).uniq
115
153
  end
116
154
 
155
+ # Returns the previous major.minor versions of the major.minor version based on the
156
+ # releases.yml data
157
+ #
158
+ # For example:
159
+ # - If the current version is 16.7, the previous patch versions are 16.7, 16.6, and 16.5
160
+ # - If the current version is 17.1, the previous patch versions are 17.1, 16.11, and 16.10
161
+ def self.previous_minors(version)
162
+ versions = releases_yaml.map { |release| release['version'] }
163
+ .reverse
164
+
165
+ versions[versions.index(version), 3]
166
+ end
167
+
117
168
  def self.raw_versions
118
169
  ReleaseVersionClient.versions
119
170
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GitlabReleases
4
- VERSION = "0.2.4"
4
+ VERSION = "0.2.6"
5
5
  end
@@ -33,6 +33,18 @@ module GitlabReleases
33
33
  ReleaseVersions.previous_version
34
34
  end
35
35
 
36
+ def self.current_minor_for_date(date)
37
+ ReleaseVersions.current_minor_for_date(date)
38
+ end
39
+
40
+ def self.previous_minors(version)
41
+ ReleaseVersions.previous_minors(version)
42
+ end
43
+
44
+ def self.available_versions
45
+ ReleaseVersions.available_versions
46
+ end
47
+
36
48
  def self.release_date
37
49
  ReleaseVersions.previous_release_date
38
50
  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.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mayra Cabrera
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-03 00:00:00.000000000 Z
11
+ date: 2024-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -44,14 +44,20 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 5.1.0
47
+ version: '5.1'
48
+ - - "~>"
49
+ - !ruby/object:Gem::Version
50
+ version: 5.1.1
48
51
  type: :runtime
49
52
  prerelease: false
50
53
  version_requirements: !ruby/object:Gem::Requirement
51
54
  requirements:
52
55
  - - "~>"
53
56
  - !ruby/object:Gem::Version
54
- version: 5.1.0
57
+ version: '5.1'
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: 5.1.1
55
61
  - !ruby/object:Gem::Dependency
56
62
  name: retriable
57
63
  requirement: !ruby/object:Gem::Requirement
@@ -89,6 +95,7 @@ extra_rdoc_files: []
89
95
  files:
90
96
  - ".rspec"
91
97
  - ".rubocop.yml"
98
+ - ".ruby-version"
92
99
  - CHANGELOG.md
93
100
  - CODE_OF_CONDUCT.md
94
101
  - Gemfile
@@ -127,7 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
134
  - !ruby/object:Gem::Version
128
135
  version: '0'
129
136
  requirements: []
130
- rubygems_version: 3.4.17
137
+ rubygems_version: 3.2.3
131
138
  signing_key:
132
139
  specification_version: 4
133
140
  summary: Utilities for GitLab releases and versions