gitlab-license 1.2.0 → 2.0.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/lib/gitlab/license.rb +62 -20
- data/lib/gitlab/license/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 517b48dd59c73e6c06a3141dbbff736b6ac5aec0db0575e81e8eaa9efca214c3
|
4
|
+
data.tar.gz: a3ae2f4b90f8ab04f042e420e81b268bd0250ff76234d29424fa22badd127ff9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c0b2e7c189d8abad15856eea602aefa67eb772a44609278a7600365389c706aa7b0594a51fed2ea7ade3307162ecbe053d5b17ca3bc7ed0054a104988e1d88d
|
7
|
+
data.tar.gz: 4dbaf5ea37ae26de84edd087269b10676879164abc0bee0578c3a6b6af88c832fe0aba70f22ee489de46eeeea2023b33c997ae999b51deeffbb0b05939662d04
|
data/lib/gitlab/license.rb
CHANGED
@@ -50,10 +50,11 @@ module Gitlab
|
|
50
50
|
end
|
51
51
|
|
52
52
|
attr_reader :version
|
53
|
-
attr_accessor :licensee, :starts_at, :expires_at
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
attr_accessor :licensee, :starts_at, :expires_at, :notify_admins_at,
|
54
|
+
:notify_users_at, :block_changes_at, :last_synced_at, :next_sync_at,
|
55
|
+
:activated_at, :restrictions, :cloud_licensing_enabled, :auto_renew_enabled,
|
56
|
+
:seat_reconciliation_enabled, :operational_metrics_enabled,
|
57
|
+
:generated_from_customers_dot
|
57
58
|
|
58
59
|
alias_method :issued_at, :starts_at
|
59
60
|
alias_method :issued_at=, :starts_at=
|
@@ -79,9 +80,7 @@ module Gitlab
|
|
79
80
|
false
|
80
81
|
elsif next_sync_at && !next_sync_at.is_a?(DateTime)
|
81
82
|
false
|
82
|
-
elsif
|
83
|
-
false
|
84
|
-
elsif type && type != 'sync'
|
83
|
+
elsif activated_at && !activated_at.is_a?(DateTime)
|
85
84
|
false
|
86
85
|
elsif restrictions && !restrictions.is_a?(Hash)
|
87
86
|
false
|
@@ -110,14 +109,14 @@ module Gitlab
|
|
110
109
|
block_changes_at
|
111
110
|
end
|
112
111
|
|
113
|
-
def will_block_changes_without_sync?
|
114
|
-
block_changes_without_sync_at
|
115
|
-
end
|
116
|
-
|
117
112
|
def will_sync?
|
118
113
|
next_sync_at
|
119
114
|
end
|
120
115
|
|
116
|
+
def activated?
|
117
|
+
activated_at
|
118
|
+
end
|
119
|
+
|
121
120
|
def expired?
|
122
121
|
will_expire? && Date.today >= expires_at
|
123
122
|
end
|
@@ -134,8 +133,24 @@ module Gitlab
|
|
134
133
|
will_block_changes? && Date.today >= block_changes_at
|
135
134
|
end
|
136
135
|
|
137
|
-
def
|
138
|
-
|
136
|
+
def cloud_licensing?
|
137
|
+
cloud_licensing_enabled == true
|
138
|
+
end
|
139
|
+
|
140
|
+
def auto_renew?
|
141
|
+
auto_renew_enabled == true
|
142
|
+
end
|
143
|
+
|
144
|
+
def seat_reconciliation?
|
145
|
+
seat_reconciliation_enabled == true
|
146
|
+
end
|
147
|
+
|
148
|
+
def operational_metrics?
|
149
|
+
operational_metrics_enabled == true
|
150
|
+
end
|
151
|
+
|
152
|
+
def generated_from_customers_dot?
|
153
|
+
generated_from_customers_dot == true
|
139
154
|
end
|
140
155
|
|
141
156
|
def restricted?(key = nil)
|
@@ -161,10 +176,16 @@ module Gitlab
|
|
161
176
|
hash['notify_users_at'] = notify_users_at if will_notify_users?
|
162
177
|
hash['block_changes_at'] = block_changes_at if will_block_changes?
|
163
178
|
|
164
|
-
hash['block_changes_without_sync_at'] = block_changes_without_sync_at if will_block_changes_without_sync?
|
165
179
|
hash['next_sync_at'] = next_sync_at if will_sync?
|
166
180
|
hash['last_synced_at'] = last_synced_at if will_sync?
|
167
|
-
hash['
|
181
|
+
hash['activated_at'] = activated_at if activated?
|
182
|
+
|
183
|
+
hash['cloud_licensing_enabled'] = cloud_licensing?
|
184
|
+
hash['auto_renew_enabled'] = auto_renew?
|
185
|
+
hash['seat_reconciliation_enabled'] = seat_reconciliation?
|
186
|
+
hash['operational_metrics_enabled'] = operational_metrics?
|
187
|
+
|
188
|
+
hash['generated_from_customers_dot'] = generated_from_customers_dot?
|
168
189
|
|
169
190
|
hash['restrictions'] = restrictions if restricted?
|
170
191
|
|
@@ -199,13 +220,22 @@ module Gitlab
|
|
199
220
|
|
200
221
|
# `issued_at` is the legacy name for starts_at.
|
201
222
|
# TODO: Move to starts_at in a next version.
|
202
|
-
%w[issued_at expires_at notify_admins_at notify_users_at block_changes_at].each do |
|
203
|
-
|
204
|
-
|
223
|
+
%w[issued_at expires_at notify_admins_at notify_users_at block_changes_at].each do |attr_name|
|
224
|
+
set_date_attribute(attr_name, attributes[attr_name])
|
225
|
+
end
|
205
226
|
|
206
|
-
|
227
|
+
%w[last_synced_at next_sync_at activated_at].each do |attr_name|
|
228
|
+
set_datetime_attribute(attr_name, attributes[attr_name])
|
229
|
+
end
|
207
230
|
|
208
|
-
|
231
|
+
%w[
|
232
|
+
cloud_licensing_enabled
|
233
|
+
auto_renew_enabled
|
234
|
+
seat_reconciliation_enabled
|
235
|
+
operational_metrics_enabled
|
236
|
+
generated_from_customers_dot
|
237
|
+
].each do |attr_name|
|
238
|
+
public_send("#{attr_name}=", attributes[attr_name] == true)
|
209
239
|
end
|
210
240
|
|
211
241
|
restrictions = attributes['restrictions']
|
@@ -214,5 +244,17 @@ module Gitlab
|
|
214
244
|
@restrictions = restrictions
|
215
245
|
end
|
216
246
|
end
|
247
|
+
|
248
|
+
def set_date_attribute(attr_name, value, date_class = Date)
|
249
|
+
value = date_class.parse(value) rescue nil if value.is_a?(String)
|
250
|
+
|
251
|
+
return unless value
|
252
|
+
|
253
|
+
public_send("#{attr_name}=", value)
|
254
|
+
end
|
255
|
+
|
256
|
+
def set_datetime_attribute(attr_name, value)
|
257
|
+
set_date_attribute(attr_name, value, DateTime)
|
258
|
+
end
|
217
259
|
end
|
218
260
|
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:
|
4
|
+
version: 2.0.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: 2021-06-23 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|