easol-canvas 2.0.0 → 3.0.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/canvas/dartsass.rb +47 -0
- data/lib/canvas/validators/layout_schema.rb +16 -0
- data/lib/canvas/validators/sass.rb +3 -3
- data/lib/canvas/validators/schema_attributes/link.rb +2 -2
- data/lib/canvas/version.rb +1 -1
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3e459457eae0524f0281bb9ecf65bd3070bb1673d43f5db5c310312a2117df4
|
4
|
+
data.tar.gz: 1f50ab28d983d59c985295fa5899ea7b19e5d8d202a5595f0828aca562ad0830
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f9d688d4ac0f97731d8ec38e548dc5f69a6c29546a029ee9825e9e5e30f58c4dba0d1a8331846e2f8f5166f735ab3a88cb5063d8ae59a95fb1904886e27a85a
|
7
|
+
data.tar.gz: c0c3977a8d4ad41df4ed9b43e53e4699e555db5d4c0596605d990e722de927108a9ecfbccfce02d8aae0da58b0f9c10a7ed604a099b24db6f831be6116750814
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "open3"
|
4
|
+
|
5
|
+
module Canvas
|
6
|
+
# This is a thin wrapper around the dartsass binary as provided by
|
7
|
+
# dartsass-rails.
|
8
|
+
#
|
9
|
+
# It is compatible with SassC::Engine as much as we were using it, but 100%
|
10
|
+
# compatability is not a goal.
|
11
|
+
class DartSass
|
12
|
+
Error = Class.new(StandardError)
|
13
|
+
|
14
|
+
def initialize(css, config)
|
15
|
+
@css = css
|
16
|
+
@config = config
|
17
|
+
end
|
18
|
+
|
19
|
+
def render
|
20
|
+
stdout, stderr, status = Open3.capture3(*command, stdin_data: @css)
|
21
|
+
|
22
|
+
if status == 0
|
23
|
+
stdout
|
24
|
+
else
|
25
|
+
raise Error.new(stderr)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def command
|
32
|
+
[dartsass, "--stdin", style, *load_paths].compact
|
33
|
+
end
|
34
|
+
|
35
|
+
def dartsass
|
36
|
+
Gem.bin_path("dartsass-rails", "dartsass").shellescape
|
37
|
+
end
|
38
|
+
|
39
|
+
def style
|
40
|
+
(s = @config[:style]) && "--style=#{s.to_s.shellescape}"
|
41
|
+
end
|
42
|
+
|
43
|
+
def load_paths
|
44
|
+
Array(@config[:load_paths]).map { "--load-path=#{_1.shellescape}" }
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -57,6 +57,7 @@ module Canvas
|
|
57
57
|
ensure_no_unrecognized_keys
|
58
58
|
ensure_no_duplicate_keys
|
59
59
|
ensure_accordion_toggles_are_valid
|
60
|
+
ensure_unique_tabs
|
60
61
|
end
|
61
62
|
|
62
63
|
@errors.empty?
|
@@ -66,6 +67,21 @@ module Canvas
|
|
66
67
|
|
67
68
|
attr_reader :schema
|
68
69
|
|
70
|
+
def ensure_unique_tabs
|
71
|
+
tabs = fetch_elements_of_type("tab")
|
72
|
+
duplicates =
|
73
|
+
tabs
|
74
|
+
.map { |item| [item[0]["label"], item[1]] }
|
75
|
+
.group_by { |(key, _)| key }
|
76
|
+
.filter { |key, usage| usage.size > 1 }
|
77
|
+
|
78
|
+
unless duplicates.empty?
|
79
|
+
duplicates.each do |tab, usage|
|
80
|
+
@errors << "Duplicated tab label `#{tab}` found. Location: #{usage.map { |(_, location)| location }.join(", ")}"
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
69
85
|
def ensure_no_duplicate_keys
|
70
86
|
attributes = fetch_all_attribute_names
|
71
87
|
duplicates =
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "canvas/dartsass"
|
4
4
|
|
5
5
|
module Canvas
|
6
6
|
module Validator
|
@@ -15,9 +15,9 @@ module Canvas
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def validate
|
18
|
-
|
18
|
+
DartSass.new(@file, style: :compressed).render
|
19
19
|
true
|
20
|
-
rescue
|
20
|
+
rescue DartSass::Error => e
|
21
21
|
@errors = [e.message]
|
22
22
|
false
|
23
23
|
end
|
@@ -6,9 +6,9 @@ module Canvas
|
|
6
6
|
# :documented:
|
7
7
|
# Attribute validations specific to link-type variables.
|
8
8
|
class Link < Base
|
9
|
-
ALLOWED_DEFAULT_KEYS = %w[url page post
|
9
|
+
ALLOWED_DEFAULT_KEYS = %w[url page post experience accommodation].freeze
|
10
10
|
INVALID_DEFAULT_ERROR = "\"default\" for link-type variables must include "\
|
11
|
-
"a single url, page, post or
|
11
|
+
"a single url, page, post, experience or accommodation value"
|
12
12
|
|
13
13
|
def validate
|
14
14
|
super &&
|
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
|
+
version: 3.0.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:
|
12
|
+
date: 1980-01-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
@@ -68,19 +68,19 @@ dependencies:
|
|
68
68
|
- !ruby/object:Gem::Version
|
69
69
|
version: '5.3'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
|
-
name:
|
71
|
+
name: dartsass-rails
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
74
|
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: 0.4.0
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
81
|
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: 0.4.0
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: json-schema
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -121,6 +121,7 @@ files:
|
|
121
121
|
- lib/canvas/checks/valid_sass_check.rb
|
122
122
|
- lib/canvas/cli.rb
|
123
123
|
- lib/canvas/constants.rb
|
124
|
+
- lib/canvas/dartsass.rb
|
124
125
|
- lib/canvas/lint.rb
|
125
126
|
- lib/canvas/offense.rb
|
126
127
|
- lib/canvas/services/expand_attributes.rb
|
@@ -155,7 +156,7 @@ homepage: https://rubygems.org/gems/easol-canvas
|
|
155
156
|
licenses:
|
156
157
|
- MIT
|
157
158
|
metadata: {}
|
158
|
-
post_install_message:
|
159
|
+
post_install_message:
|
159
160
|
rdoc_options: []
|
160
161
|
require_paths:
|
161
162
|
- lib
|
@@ -170,8 +171,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
171
|
- !ruby/object:Gem::Version
|
171
172
|
version: '0'
|
172
173
|
requirements: []
|
173
|
-
rubygems_version: 3.
|
174
|
-
signing_key:
|
174
|
+
rubygems_version: 3.2.26
|
175
|
+
signing_key:
|
175
176
|
specification_version: 4
|
176
177
|
summary: CLI to help with building themes for Easol
|
177
178
|
test_files: []
|