gitlab-license 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/gitlab/license.rb +10 -3
- data/lib/gitlab/license/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b4443c1a2d8d2c828a5be70bcdd91f51809e035f
|
4
|
+
data.tar.gz: 8df685a6f8ba0552e75cea00c0fe47827957caee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 049eedc4ade354fc031b15b7d56b2d1bf0d51c554e1139637ee61e69404c938a2be0fa618307e249b12c1b23c052230dd18769b8269142dcb899134af1d14e88
|
7
|
+
data.tar.gz: 380a1aa9d305d8e0c8f9e0b129b04b8159b09c7ef276d5a961e2ee480c87f19f221a8cd21c09952082edc1eb7114a057147d17740acd87506aadee70f52a5641
|
data/README.md
CHANGED
@@ -48,9 +48,9 @@ license.licensee = {
|
|
48
48
|
"Email" => "douwe@gitlab.com"
|
49
49
|
}
|
50
50
|
|
51
|
-
# The date the license
|
51
|
+
# The date the license starts.
|
52
52
|
# Required.
|
53
|
-
license.
|
53
|
+
license.starts_at = Date.new(2015, 4, 24)
|
54
54
|
# The date the license expires.
|
55
55
|
# Not required, to allow lifetime licenses.
|
56
56
|
license.expires_at = Date.new(2016, 4, 23)
|
data/lib/gitlab/license.rb
CHANGED
@@ -46,17 +46,20 @@ module Gitlab
|
|
46
46
|
end
|
47
47
|
|
48
48
|
attr_reader :version
|
49
|
-
attr_accessor :licensee, :
|
49
|
+
attr_accessor :licensee, :starts_at, :expires_at
|
50
50
|
attr_accessor :notify_admins_at, :notify_users_at, :block_changes_at
|
51
51
|
attr_accessor :restrictions
|
52
52
|
|
53
|
+
alias_method :issued_at, :starts_at
|
54
|
+
alias_method :issued_at=, :starts_at=
|
55
|
+
|
53
56
|
def initialize(attributes = {})
|
54
57
|
load_attributes(attributes)
|
55
58
|
end
|
56
59
|
|
57
60
|
def valid?
|
58
61
|
return false if !licensee || !licensee.is_a?(Hash) || licensee.length == 0
|
59
|
-
return false if !
|
62
|
+
return false if !starts_at || !starts_at.is_a?(Date)
|
60
63
|
return false if expires_at && !expires_at.is_a?(Date)
|
61
64
|
return false if notify_admins_at && !notify_admins_at.is_a?(Date)
|
62
65
|
return false if notify_users_at && !notify_users_at.is_a?(Date)
|
@@ -116,7 +119,9 @@ module Gitlab
|
|
116
119
|
hash["version"] = self.version
|
117
120
|
hash["licensee"] = self.licensee
|
118
121
|
|
119
|
-
|
122
|
+
# `issued_at` is the legacy name for starts_at.
|
123
|
+
# TODO: Move to starts_at in a next version.
|
124
|
+
hash["issued_at"] = self.starts_at
|
120
125
|
hash["expires_at"] = self.expires_at if self.will_expire?
|
121
126
|
|
122
127
|
hash["notify_admins_at"] = self.notify_admins_at if self.will_notify_admins?
|
@@ -152,6 +157,8 @@ module Gitlab
|
|
152
157
|
|
153
158
|
@licensee = attributes["licensee"]
|
154
159
|
|
160
|
+
# `issued_at` is the legacy name for starts_at.
|
161
|
+
# TODO: Move to starts_at in a next version.
|
155
162
|
%w(issued_at expires_at notify_admins_at notify_users_at block_changes_at).each do |attr|
|
156
163
|
value = attributes[attr]
|
157
164
|
value = Date.parse(value) rescue nil if value.is_a?(String)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitlab-license
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Douwe Maan
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|