easol-canvas 4.0.0 → 4.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/canvas/checks/valid_liquid_check.rb +1 -0
- data/lib/canvas/constants.rb +2 -0
- data/lib/canvas/validators/schema_attribute.rb +2 -0
- data/lib/canvas/validators/schema_attributes/date.rb +49 -0
- data/lib/canvas/validators/schema_attributes/package.rb +49 -0
- data/lib/canvas/version.rb +1 -1
- metadata +7 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 337d9ed1f2553df0bf83f182d6c4f2480da0ffcbe55b5f835a421f813a7596a9
|
4
|
+
data.tar.gz: 975e0dcbcb9c30fbb9356342933ab5ad454fdc71c9fe92a96e200c1ebfc0c190
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12584574f5e1b4a4759b1d015b6ce32ed2ac08efbf8e8cf9daa36f833cb96ca5b510a27fd9a002783d207fa7667996e3028e86acb86595c53ca629d2d102afd7
|
7
|
+
data.tar.gz: 69058651bbeb483e56e533765e554f3a6d08e40eb3c2188bcb81b35ec7452120cda358ad4ac053e1016c043a69b5beda74b11c6972ecd9e528993168d7fd6766
|
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.2.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-05-22 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: []
|