easol-canvas 3.2.1 → 3.3.1

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: 726899d9c85d1468a3aacd62a4487814bb7e0e030b2b583b41602638dfdbc990
4
- data.tar.gz: 520828b9f285fe794d310a713b9ac3997d67d6b4a2a13df05315629d64ca99c9
3
+ metadata.gz: 76b5e740ec1e4c86868924b010cbd13101ebd86b46a49bb719ed289bce268e8c
4
+ data.tar.gz: 5d79fe71368fb9bdd0f76c85803957291f34c9fd66c68904c68a7cbfede36680
5
5
  SHA512:
6
- metadata.gz: d5cf148c156c0af19f9004cf9828f506b4951387e037252dadd8a0a0c11cc8abf62b5861f3a33331bbad22ceb32a1dfd9332576e4244cc12d0ef036bb1491e4f
7
- data.tar.gz: 517b2b9519e7ecb3e0bdfcb4e23d906cfb4d3d4b1a712601464beba36680f3502480c2b8cfa74b8aee24376c77479dd66f13b532875f1d32759e5e17e2181ca5
6
+ metadata.gz: bbde53fa9c5acbc400c899573b823913e39b732693122925eaa553f6e045bbeba3ad67eac2b20cfec69c9b767259fa3a9b7d947f97e62bf9b34d42ea13d4c8bd
7
+ data.tar.gz: c7d11808b5dc2b9eb70f8b22b2a89058bd38cb3cde27389a258cc9abcc27c5e3197a1eb2e58d92fc370683b590e59ba79ab5cbc835427b3112f23288b63fe526
@@ -7,10 +7,12 @@ module Canvas
7
7
  # Attribute validations specific to product-type variables.
8
8
  class Product < Base
9
9
  ALLOWED_DEFAULT_VALUES = %w[random].freeze
10
+ ALLOWED_RESTRICTIONS = %w[experiences accommodations].freeze
10
11
 
11
12
  def validate
12
13
  super &&
13
- ensure_default_values_are_valid
14
+ ensure_default_values_are_valid &&
15
+ ensure_only_values_are_valid
14
16
  end
15
17
 
16
18
  private
@@ -23,6 +25,10 @@ module Canvas
23
25
  end
24
26
  end
25
27
 
28
+ def optional_keys
29
+ super.merge("only" => Array)
30
+ end
31
+
26
32
  def ensure_default_values_are_valid
27
33
  return true unless attribute.key?("default")
28
34
 
@@ -33,11 +39,27 @@ module Canvas
33
39
  end
34
40
  end
35
41
 
42
+ def ensure_only_values_are_valid
43
+ return true unless attribute.key?("only")
44
+
45
+ if attribute["only"].empty?
46
+ @errors << %["only" cannot be empty]
47
+ return false
48
+ end
49
+
50
+ unsupported_entries = attribute["only"] - ALLOWED_RESTRICTIONS
51
+ if unsupported_entries.any?
52
+ @errors << %["only" for product-type variables must be one of: #{ALLOWED_RESTRICTIONS.join(', ')}]
53
+ return false
54
+ end
55
+
56
+ true
57
+ end
58
+
36
59
  def default_value_is_valid?(value)
37
60
  value = value.downcase
38
61
  if !ALLOWED_DEFAULT_VALUES.include?(value)
39
- @errors << "\"default\" for product-type variables must be "\
40
- "one of: #{ALLOWED_DEFAULT_VALUES.join(', ')}"
62
+ @errors << %["default" for product-type variables must be one of: #{ALLOWED_DEFAULT_VALUES.join(', ')}]
41
63
  false
42
64
  else
43
65
  true
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Canvas
4
- VERSION = "3.2.1"
4
+ VERSION = "3.3.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easol-canvas
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Byrne
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-01-06 00:00:00.000000000 Z
12
+ date: 2023-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -98,7 +98,7 @@ dependencies:
98
98
  description: |
99
99
  Canvas is a command line tool to help with building themes for Easol.
100
100
  It provides tooling to check theme directories for errors and to make sure
101
- they confirm with the Easol theme spec.
101
+ they conform with the Easol theme spec.
102
102
  email: developers@easol.com
103
103
  executables:
104
104
  - canvas
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0'
173
173
  requirements: []
174
- rubygems_version: 3.3.7
174
+ rubygems_version: 3.3.26
175
175
  signing_key:
176
176
  specification_version: 4
177
177
  summary: CLI to help with building themes for Easol