easol-canvas 2.2.0 → 3.0.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: 988493985d369b518ca9bb2b802c8d2bc639e7a632090434b9c558e3fc5d6256
4
- data.tar.gz: 3d9d3df30a6d5a6db096e570d3cba97fc9e4d26284d7b4596b535bf57080991f
3
+ metadata.gz: e3e459457eae0524f0281bb9ecf65bd3070bb1673d43f5db5c310312a2117df4
4
+ data.tar.gz: 1f50ab28d983d59c985295fa5899ea7b19e5d8d202a5595f0828aca562ad0830
5
5
  SHA512:
6
- metadata.gz: de8eb335498a0fd7dea007d77ac4cd25503ee85da121dfd9fa9c0eec96932294f532194abecbc57a40e1411449f14baecfda8006f3ce4a09aff6c52bc2afb03d
7
- data.tar.gz: 55c0d63a5758238e008f9a88642c8e77df735192b67c0fa32d35f7e6562001d19dbd082fdada888f7fb679286f864275bc7c50aeb129bbc65ca16ae0e24e7f8d
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
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "sassc"
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
- SassC::Engine.new(@file, style: :compressed).render
18
+ DartSass.new(@file, style: :compressed).render
19
19
  true
20
- rescue SassC::SyntaxError => e
20
+ rescue DartSass::Error => e
21
21
  @errors = [e.message]
22
22
  false
23
23
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Canvas
4
- VERSION = "2.2.0"
4
+ VERSION = "3.0.0"
5
5
  end
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: 2.2.0
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: 2022-08-17 00:00:00.000000000 Z
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: sassc
71
+ name: dartsass-rails
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - "~>"
75
75
  - !ruby/object:Gem::Version
76
- version: '2.4'
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: '2.4'
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.0.3.1
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: []