gitlab-license 2.3.0 → 2.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7446407f434ff04d36c14ef4ee97be748000280b8abf6e23b83ca6a78a6f1ce5
4
- data.tar.gz: 8604082fe40f6684eeec09a90f6c7fccc25a0e8df672637889d39894b92efc1d
3
+ metadata.gz: c15aba535f2359601fa9cf8e50b45e1a5e7671717c08845f047b0eae35fb69a3
4
+ data.tar.gz: e44fb5a0cc537fb0c12fd49c82f72ca7092d6f04d42c76bd7ef57803c87ea345
5
5
  SHA512:
6
- metadata.gz: 05e748a228c17e433a5b725835e79e66b564fe82fb3ebb922e80e9b892c61e27caf4dd518a9ea6d1f086d16d1bd405bb36ee8c4fc1ccf73db1110d3f49d0e44b
7
- data.tar.gz: ba3caed401ef9783d01c1fe16c7e8cf1807e21c35b61ea99d0be3b127d9f6c815a9b28c56c32e28eac6b4b4bad5d60ffee4ea58a198b1ca23649e08e1503d946
6
+ metadata.gz: b43de2bf8c651358b253ab5dfb86d71349a56344adb2129bdb8fbd33bf9d202bc079d1b0054144b59a472e3e350a88b4aabb53f12850b6778f79acaad2eb9a52
7
+ data.tar.gz: 570d1d302a389fb4c34071d29161fdc9e3a2122813610af1e0da9e573b49db8e5342c931584f74508896e0517d082174dbb5316a5dc7d1eaaeda528a8cc6cc6b
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
@@ -1,6 +1,8 @@
1
1
  inherit_from: .rubocop_todo.yml
2
2
 
3
3
  require: rubocop-rspec
4
+ AllCops:
5
+ TargetRubyVersion: 2.7
4
6
 
5
7
  Metrics/BlockLength:
6
8
  ExcludedMethods: ['describe', 'context']
data/.rubocop_todo.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-03-02 14:37:54 -0500 using RuboCop version 0.80.1.
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: 36
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: 129
22
+ Max: 223
17
23
 
18
24
  # Offense count: 3
19
25
  Metrics/CyclomaticComplexity:
20
- Max: 16
26
+ Max: 27
21
27
 
22
- # Offense count: 5
28
+ # Offense count: 6
23
29
  # Configuration parameters: CountComments, ExcludedMethods.
24
30
  Metrics/MethodLength:
25
- Max: 38
31
+ Max: 36
26
32
 
27
33
  # Offense count: 3
28
34
  Metrics/PerceivedComplexity:
29
- Max: 16
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: 14
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
@@ -82,6 +82,10 @@ license.notify_users_at = Date.new(2016, 4, 23)
82
82
  # Not required.
83
83
  license.block_changes_at = Date.new(2016, 5, 7)
84
84
 
85
+ # If this license was created due to a subscription cancellation
86
+ # Not required.
87
+ license.generated_from_cancellation? = false
88
+
85
89
  # Restrictions bundled with this license.
86
90
  # Not required, to allow unlimited-user licenses for things like educational organizations.
87
91
  license.restrictions = {
@@ -1,5 +1,5 @@
1
1
  module Gitlab
2
2
  class License
3
- VERSION = '2.3.0'.freeze
3
+ VERSION = '2.4.0'.freeze
4
4
  end
5
5
  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
- begin
67
- decryptor = Encryptor.new(decryption_key)
68
- return decryptor.decrypt(data)
69
- rescue Encryptor::Error
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
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
@@ -229,6 +232,7 @@ module Gitlab
229
232
  hash['operational_metrics_enabled'] = operational_metrics?
230
233
 
231
234
  hash['generated_from_customers_dot'] = generated_from_customers_dot?
235
+ hash['generated_from_cancellation'] = generated_from_cancellation?
232
236
 
233
237
  hash['restrictions'] = restrictions if restricted?
234
238
 
@@ -278,6 +282,7 @@ module Gitlab
278
282
  seat_reconciliation_enabled
279
283
  operational_metrics_enabled
280
284
  generated_from_customers_dot
285
+ generated_from_cancellation
281
286
  ].each do |attr_name|
282
287
  public_send("#{attr_name}=", attributes[attr_name] == true)
283
288
  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.3.0
4
+ version: 2.4.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: 2023-06-07 00:00:00.000000000 Z
13
+ date: 2023-12-22 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"