gitlab-license 2.3.0 → 2.5.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 +4 -4
- data/.gitlab-ci.yml +25 -0
- data/.rubocop.yml +2 -0
- data/.rubocop_todo.yml +14 -8
- data/README.md +7 -1
- data/lib/gitlab/license/version.rb +1 -1
- data/lib/gitlab/license.rb +20 -8
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0967643c1140cd610c6e7784d44578c6b96881580029451268d040f910460f35'
|
4
|
+
data.tar.gz: 81e1e985e0803b25b23ac1f4852ba98640e2f318ccb23cbe796d1664e2b56080
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c66cfd23e231099db7d1de6e09cbd087700653cf51bf492e537d9f413806ccf4a35b5e224037a4d113ec403fa1517a3f60bc09b1f96497d7d6f827f6751937eb
|
7
|
+
data.tar.gz: f197edefd9b05fa5f9a268839eefcaea9e38832ef526e54b19680ec7a3cb4482f812ee6eb77fc84af71df248e7ce37fa1e2a462fd02a71fc79c98689f6b9e608
|
data/.gitlab-ci.yml
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
default:
|
2
|
+
image: "ruby:${RUBY_VERSION}"
|
3
|
+
|
4
|
+
cache:
|
5
|
+
key: "${CI_JOB_IMAGE}"
|
6
|
+
paths:
|
7
|
+
- vendor/ruby
|
8
|
+
|
9
|
+
before_script:
|
10
|
+
- ruby -v
|
11
|
+
- gem update --system --no-document
|
12
|
+
- bundle install -j $(nproc) --path vendor
|
13
|
+
|
14
|
+
test:
|
15
|
+
script:
|
16
|
+
- bundle exec rspec
|
17
|
+
parallel:
|
18
|
+
matrix:
|
19
|
+
- RUBY_VERSION: [ "3.0", "3.1", "3.2" ]
|
20
|
+
|
21
|
+
rubocop:
|
22
|
+
script:
|
23
|
+
- bundle exec rubocop
|
24
|
+
variables:
|
25
|
+
RUBY_VERSION: "3.0"
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2023-12-21 18:05:17 -0500 using RuboCop version 0.80.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
@@ -8,25 +8,31 @@
|
|
8
8
|
|
9
9
|
# Offense count: 6
|
10
10
|
Metrics/AbcSize:
|
11
|
-
Max:
|
11
|
+
Max: 60
|
12
|
+
|
13
|
+
# Offense count: 1
|
14
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
15
|
+
# ExcludedMethods: refine
|
16
|
+
Metrics/BlockLength:
|
17
|
+
Max: 26
|
12
18
|
|
13
19
|
# Offense count: 1
|
14
20
|
# Configuration parameters: CountComments.
|
15
21
|
Metrics/ClassLength:
|
16
|
-
Max:
|
22
|
+
Max: 223
|
17
23
|
|
18
24
|
# Offense count: 3
|
19
25
|
Metrics/CyclomaticComplexity:
|
20
|
-
Max:
|
26
|
+
Max: 27
|
21
27
|
|
22
|
-
# Offense count:
|
28
|
+
# Offense count: 6
|
23
29
|
# Configuration parameters: CountComments, ExcludedMethods.
|
24
30
|
Metrics/MethodLength:
|
25
|
-
Max:
|
31
|
+
Max: 36
|
26
32
|
|
27
33
|
# Offense count: 3
|
28
34
|
Metrics/PerceivedComplexity:
|
29
|
-
Max:
|
35
|
+
Max: 28
|
30
36
|
|
31
37
|
# Offense count: 3
|
32
38
|
Style/Documentation:
|
@@ -76,7 +82,7 @@ Style/RescueModifier:
|
|
76
82
|
Exclude:
|
77
83
|
- 'lib/gitlab/license.rb'
|
78
84
|
|
79
|
-
# Offense count:
|
85
|
+
# Offense count: 28
|
80
86
|
# Cop supports --auto-correct.
|
81
87
|
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
82
88
|
# URISchemes: http, https
|
data/README.md
CHANGED
@@ -27,7 +27,9 @@ To release a new version of this gem, follow these steps:
|
|
27
27
|
1. [Build the gem](https://guides.rubygems.org/command-reference/#gem-build) to be published: `gem build gitlab-license.gemspec`
|
28
28
|
1. [Publish the gem](https://guides.rubygems.org/publishing) to Rubygems: `gem push gitlab-license-2.1.0.gem`
|
29
29
|
- Note you will need to be added as an owner in Rubygems in order to publish.
|
30
|
-
|
30
|
+
1. Once published, the new version of the gem can be installed in projects that depend on `gitlab-license` like [CustomersDot](https://gitlab.com/gitlab-org/customers-gitlab-com) and [GitLab](https://gitlab.com/gitlab-org/gitlab).
|
31
|
+
- It is recommended to install the new version in both GitLab and CustomersDot to keep the versions aligned.
|
32
|
+
- This can be installed via bundler or using `gem install` directly.
|
31
33
|
|
32
34
|
## Usage
|
33
35
|
|
@@ -82,6 +84,10 @@ license.notify_users_at = Date.new(2016, 4, 23)
|
|
82
84
|
# Not required.
|
83
85
|
license.block_changes_at = Date.new(2016, 5, 7)
|
84
86
|
|
87
|
+
# If this license was created due to a subscription cancellation
|
88
|
+
# Not required.
|
89
|
+
license.generated_from_cancellation? = false
|
90
|
+
|
85
91
|
# Restrictions bundled with this license.
|
86
92
|
# Not required, to allow unlimited-user licenses for things like educational organizations.
|
87
93
|
license.restrictions = {
|
data/lib/gitlab/license.rb
CHANGED
@@ -8,7 +8,7 @@ require 'gitlab/license/encryptor'
|
|
8
8
|
require 'gitlab/license/boundary'
|
9
9
|
|
10
10
|
module Gitlab
|
11
|
-
class License
|
11
|
+
class License # rubocop:disable Metrics/ClassLength
|
12
12
|
class Error < StandardError; end
|
13
13
|
class ImportError < Error; end
|
14
14
|
class ValidationError < Error; end
|
@@ -63,12 +63,10 @@ module Gitlab
|
|
63
63
|
keys_to_try += fallback_decryption_keys if fallback_decryption_keys
|
64
64
|
|
65
65
|
keys_to_try.each do |decryption_key|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
next
|
71
|
-
end
|
66
|
+
decryptor = Encryptor.new(decryption_key)
|
67
|
+
return decryptor.decrypt(data)
|
68
|
+
rescue Encryptor::Error
|
69
|
+
next
|
72
70
|
end
|
73
71
|
|
74
72
|
raise ImportError, 'License data could not be decrypted.'
|
@@ -80,7 +78,8 @@ module Gitlab
|
|
80
78
|
:notify_users_at, :block_changes_at, :last_synced_at, :next_sync_at,
|
81
79
|
:activated_at, :restrictions, :cloud_licensing_enabled,
|
82
80
|
:offline_cloud_licensing_enabled, :auto_renew_enabled, :seat_reconciliation_enabled,
|
83
|
-
:operational_metrics_enabled, :generated_from_customers_dot
|
81
|
+
:operational_metrics_enabled, :generated_from_customers_dot,
|
82
|
+
:generated_from_cancellation, :temporary_extension
|
84
83
|
|
85
84
|
alias_method :issued_at, :starts_at
|
86
85
|
alias_method :issued_at=, :starts_at=
|
@@ -187,6 +186,10 @@ module Gitlab
|
|
187
186
|
generated_from_customers_dot == true
|
188
187
|
end
|
189
188
|
|
189
|
+
def generated_from_cancellation?
|
190
|
+
generated_from_cancellation == true
|
191
|
+
end
|
192
|
+
|
190
193
|
def gl_team_license?
|
191
194
|
licensee['Company'].to_s.match?(/GitLab/i) && licensee['Email'].to_s.end_with?('@gitlab.com')
|
192
195
|
end
|
@@ -195,6 +198,10 @@ module Gitlab
|
|
195
198
|
licensee['Company'].to_s.match?(/GitLab/i) && licensee['Email'].to_s.end_with?('@jihulab.com')
|
196
199
|
end
|
197
200
|
|
201
|
+
def temporary_extension?
|
202
|
+
temporary_extension == true
|
203
|
+
end
|
204
|
+
|
198
205
|
def restricted?(key = nil)
|
199
206
|
if key
|
200
207
|
restricted? && restrictions.has_key?(key)
|
@@ -229,6 +236,9 @@ module Gitlab
|
|
229
236
|
hash['operational_metrics_enabled'] = operational_metrics?
|
230
237
|
|
231
238
|
hash['generated_from_customers_dot'] = generated_from_customers_dot?
|
239
|
+
hash['generated_from_cancellation'] = generated_from_cancellation?
|
240
|
+
|
241
|
+
hash['temporary_extension'] = temporary_extension?
|
232
242
|
|
233
243
|
hash['restrictions'] = restrictions if restricted?
|
234
244
|
|
@@ -278,6 +288,8 @@ module Gitlab
|
|
278
288
|
seat_reconciliation_enabled
|
279
289
|
operational_metrics_enabled
|
280
290
|
generated_from_customers_dot
|
291
|
+
generated_from_cancellation
|
292
|
+
temporary_extension
|
281
293
|
].each do |attr_name|
|
282
294
|
public_send("#{attr_name}=", attributes[attr_name] == true)
|
283
295
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-license
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Douwe Maan
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: exe
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2024-06-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -106,6 +106,7 @@ extensions: []
|
|
106
106
|
extra_rdoc_files: []
|
107
107
|
files:
|
108
108
|
- ".gitignore"
|
109
|
+
- ".gitlab-ci.yml"
|
109
110
|
- ".rspec"
|
110
111
|
- ".rubocop.yml"
|
111
112
|
- ".rubocop_todo.yml"
|