easol-canvas 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98be4111cd6e37ca2bae396a4c47cbb0fb66c6c55a744f192190d22dc1aa34db
|
4
|
+
data.tar.gz: f2314e25d61f17907613648fbfd75df92757194e11647e92cf382a735b1b5e0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bc304a86f54c1ef6f9733e10832eaecfb5f1b0d83fc4f0672d86c8a7b8fe91575c2c6a4bdfba1395806bd4017b9e6d642fb6521b5f83583455556ba1587b292
|
7
|
+
data.tar.gz: c40196d8e6c98ef8015ec1f3aea9f604aa9d9a15ae0a4ef97aa091055502cfb311a3d92805de9208bcf9617fe7d86677ffb038360bcd289efc8e2e54624c007e
|
data/lib/canvas/constants.rb
CHANGED
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Canvas
|
4
|
+
module Validator
|
5
|
+
class SchemaAttribute
|
6
|
+
# :documented:
|
7
|
+
# Attribute validations specific to package-type variables.
|
8
|
+
class Date < Base
|
9
|
+
ALLOWED_DEFAULT_VALUES = %w[today].freeze
|
10
|
+
|
11
|
+
def validate
|
12
|
+
super &&
|
13
|
+
ensure_default_values_are_valid
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def permitted_values_for_default_key
|
19
|
+
if attribute["array"]
|
20
|
+
Array
|
21
|
+
else
|
22
|
+
String
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def ensure_default_values_are_valid
|
27
|
+
return true unless attribute.key?("default")
|
28
|
+
|
29
|
+
if attribute["array"]
|
30
|
+
attribute["default"].all? { |value| default_value_is_valid?(value) }
|
31
|
+
else
|
32
|
+
default_value_is_valid?(attribute["default"])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def default_value_is_valid?(value)
|
37
|
+
value = value.downcase
|
38
|
+
if !ALLOWED_DEFAULT_VALUES.include?(value)
|
39
|
+
@errors << "\"default\" for date-type variables must be "\
|
40
|
+
"one of: #{ALLOWED_DEFAULT_VALUES.join(', ')}"
|
41
|
+
false
|
42
|
+
else
|
43
|
+
true
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Canvas
|
4
|
+
module Validator
|
5
|
+
class SchemaAttribute
|
6
|
+
# :documented:
|
7
|
+
# Attribute validations specific to package-type variables.
|
8
|
+
class Package < Base
|
9
|
+
ALLOWED_DEFAULT_VALUES = %w[random].freeze
|
10
|
+
|
11
|
+
def validate
|
12
|
+
super &&
|
13
|
+
ensure_default_values_are_valid
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def permitted_values_for_default_key
|
19
|
+
if attribute["array"]
|
20
|
+
Array
|
21
|
+
else
|
22
|
+
String
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def ensure_default_values_are_valid
|
27
|
+
return true unless attribute.key?("default")
|
28
|
+
|
29
|
+
if attribute["array"]
|
30
|
+
attribute["default"].all? { |value| default_value_is_valid?(value) }
|
31
|
+
else
|
32
|
+
default_value_is_valid?(attribute["default"])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def default_value_is_valid?(value)
|
37
|
+
value = value.downcase
|
38
|
+
if !ALLOWED_DEFAULT_VALUES.include?(value)
|
39
|
+
@errors << "\"default\" for package-type variables must be "\
|
40
|
+
"one of: #{ALLOWED_DEFAULT_VALUES.join(', ')}"
|
41
|
+
false
|
42
|
+
else
|
43
|
+
true
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/canvas/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easol-canvas
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kyle Byrne
|
8
8
|
- Ian Mooney
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-
|
12
|
+
date: 2023-04-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -139,9 +139,11 @@ files:
|
|
139
139
|
- lib/canvas/validators/schema_attribute.rb
|
140
140
|
- lib/canvas/validators/schema_attributes/base.rb
|
141
141
|
- lib/canvas/validators/schema_attributes/color.rb
|
142
|
+
- lib/canvas/validators/schema_attributes/date.rb
|
142
143
|
- lib/canvas/validators/schema_attributes/image.rb
|
143
144
|
- lib/canvas/validators/schema_attributes/link.rb
|
144
145
|
- lib/canvas/validators/schema_attributes/number.rb
|
146
|
+
- lib/canvas/validators/schema_attributes/package.rb
|
145
147
|
- lib/canvas/validators/schema_attributes/page.rb
|
146
148
|
- lib/canvas/validators/schema_attributes/post.rb
|
147
149
|
- lib/canvas/validators/schema_attributes/product.rb
|
@@ -156,7 +158,7 @@ homepage: https://rubygems.org/gems/easol-canvas
|
|
156
158
|
licenses:
|
157
159
|
- MIT
|
158
160
|
metadata: {}
|
159
|
-
post_install_message:
|
161
|
+
post_install_message:
|
160
162
|
rdoc_options: []
|
161
163
|
require_paths:
|
162
164
|
- lib
|
@@ -172,7 +174,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
172
174
|
version: '0'
|
173
175
|
requirements: []
|
174
176
|
rubygems_version: 3.3.26
|
175
|
-
signing_key:
|
177
|
+
signing_key:
|
176
178
|
specification_version: 4
|
177
179
|
summary: CLI to help with building themes for Easol
|
178
180
|
test_files: []
|