gitlab-license 1.0.1 → 1.2.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 +49 -15
- 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: e6aecf2ddad9be921880a1603714f79947534ede972c8f47f8b5121c96d912c1
|
4
|
+
data.tar.gz: 66b55835b29c3c9c2fdd175b31113523d616802e6a8cfa6898a98f080039760b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ca37a34899d853c22871e36f70aac9196e127ea92b6c7ef1cdda167eab9e595c9e092ae072857c343158881dad8961b2430150b3e730d2408facac6b94b1c1e
|
7
|
+
data.tar.gz: 5d77bbd654db4ad8e4e4458748d15720a3092d6085e73e06ac717b4f5fe6594f52ed517dedcc6e4c33398f3a1f419b7573578d37dae61a0f84b3543e2557383d
|
data/lib/gitlab/license.rb
CHANGED
@@ -52,6 +52,7 @@ module Gitlab
|
|
52
52
|
attr_reader :version
|
53
53
|
attr_accessor :licensee, :starts_at, :expires_at
|
54
54
|
attr_accessor :notify_admins_at, :notify_users_at, :block_changes_at
|
55
|
+
attr_accessor :type, :last_synced_at, :next_sync_at, :block_changes_without_sync_at
|
55
56
|
attr_accessor :restrictions
|
56
57
|
|
57
58
|
alias_method :issued_at, :starts_at
|
@@ -62,15 +63,31 @@ module Gitlab
|
|
62
63
|
end
|
63
64
|
|
64
65
|
def valid?
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
66
|
+
if !licensee || !licensee.is_a?(Hash) || licensee.empty?
|
67
|
+
false
|
68
|
+
elsif !starts_at || !starts_at.is_a?(Date)
|
69
|
+
false
|
70
|
+
elsif expires_at && !expires_at.is_a?(Date)
|
71
|
+
false
|
72
|
+
elsif notify_admins_at && !notify_admins_at.is_a?(Date)
|
73
|
+
false
|
74
|
+
elsif notify_users_at && !notify_users_at.is_a?(Date)
|
75
|
+
false
|
76
|
+
elsif block_changes_at && !block_changes_at.is_a?(Date)
|
77
|
+
false
|
78
|
+
elsif last_synced_at && !last_synced_at.is_a?(DateTime)
|
79
|
+
false
|
80
|
+
elsif next_sync_at && !next_sync_at.is_a?(DateTime)
|
81
|
+
false
|
82
|
+
elsif block_changes_without_sync_at && !block_changes_without_sync_at.is_a?(Date)
|
83
|
+
false
|
84
|
+
elsif type && type != 'sync'
|
85
|
+
false
|
86
|
+
elsif restrictions && !restrictions.is_a?(Hash)
|
87
|
+
false
|
88
|
+
else
|
89
|
+
true
|
90
|
+
end
|
74
91
|
end
|
75
92
|
|
76
93
|
def validate!
|
@@ -93,6 +110,14 @@ module Gitlab
|
|
93
110
|
block_changes_at
|
94
111
|
end
|
95
112
|
|
113
|
+
def will_block_changes_without_sync?
|
114
|
+
block_changes_without_sync_at
|
115
|
+
end
|
116
|
+
|
117
|
+
def will_sync?
|
118
|
+
next_sync_at
|
119
|
+
end
|
120
|
+
|
96
121
|
def expired?
|
97
122
|
will_expire? && Date.today >= expires_at
|
98
123
|
end
|
@@ -109,6 +134,10 @@ module Gitlab
|
|
109
134
|
will_block_changes? && Date.today >= block_changes_at
|
110
135
|
end
|
111
136
|
|
137
|
+
def block_changes_without_sync?
|
138
|
+
will_block_changes_without_sync? && Date.today >= block_changes_without_sync_at
|
139
|
+
end
|
140
|
+
|
112
141
|
def restricted?(key = nil)
|
113
142
|
if key
|
114
143
|
restricted? && restrictions.has_key?(key)
|
@@ -120,19 +149,24 @@ module Gitlab
|
|
120
149
|
def attributes
|
121
150
|
hash = {}
|
122
151
|
|
123
|
-
hash['version']
|
124
|
-
hash['licensee']
|
152
|
+
hash['version'] = version
|
153
|
+
hash['licensee'] = licensee
|
125
154
|
|
126
155
|
# `issued_at` is the legacy name for starts_at.
|
127
156
|
# TODO: Move to starts_at in a next version.
|
128
|
-
hash['issued_at']
|
129
|
-
hash['expires_at']
|
157
|
+
hash['issued_at'] = starts_at
|
158
|
+
hash['expires_at'] = expires_at if will_expire?
|
130
159
|
|
131
160
|
hash['notify_admins_at'] = notify_admins_at if will_notify_admins?
|
132
|
-
hash['notify_users_at']
|
161
|
+
hash['notify_users_at'] = notify_users_at if will_notify_users?
|
133
162
|
hash['block_changes_at'] = block_changes_at if will_block_changes?
|
134
163
|
|
135
|
-
hash['
|
164
|
+
hash['block_changes_without_sync_at'] = block_changes_without_sync_at if will_block_changes_without_sync?
|
165
|
+
hash['next_sync_at'] = next_sync_at if will_sync?
|
166
|
+
hash['last_synced_at'] = last_synced_at if will_sync?
|
167
|
+
hash['type'] = type
|
168
|
+
|
169
|
+
hash['restrictions'] = restrictions if restricted?
|
136
170
|
|
137
171
|
hash
|
138
172
|
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: 1.0
|
4
|
+
version: 1.2.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: 2020-
|
13
|
+
date: 2020-11-17 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|