sass-embedded 1.0.1 → 1.0.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5f5ecc805dbe549bd19b1e5777bd16500bcd71fc56def8fe364f542c7bb731e0
4
- data.tar.gz: 14c15309ebc1aff54a5b9df78cbd5a66e7321c22e4229357724945aa2a0d3647
3
+ metadata.gz: 5c43ad7fb335b99c12bdc65c8a37af7a239a737f4c8655590ce35ea6be51ca3d
4
+ data.tar.gz: cbc99b11c3330928a9582cb8befba681fd49db77868e0acdbadde4c7ba14a6ec
5
5
  SHA512:
6
- metadata.gz: e4d372b8b307ff60d2f21c6b6bf1674833587c0945ff13e6435dae761fb4bfa0e75233f5dfe88aa47d97b7d4cea483ffdc55e71df92ae9d472d29a94c4eb4f21
7
- data.tar.gz: 4ecd5d19ca66c2697e0a2cdbfccbb550ab0cb414829d542e71b7f28c77122973f5dc508e2aec3c214aaad777c674cc72a1a8a0b5b90b256728ef20623e16df53
6
+ metadata.gz: a77c23cd962c9936b9474f9ea0402095b2c65d0e4fca6bc848364d17211f37947e87ccfdf0db3dfff14477bcf6d3a2dadbf1dcc6ed127b6c1424e33b80cb3920
7
+ data.tar.gz: 64bb51ebf0b1d6dadd39ceb73be714ed1090478dcafa43a34a465032a189a3ac6389aa035d3d0420cd9a243f2b2164d1e9e4b122d5e7f67c8bdd877b455aa1f1
data/ext/sass/Makefile CHANGED
@@ -6,18 +6,18 @@ endif
6
6
  EXTCONF = ruby -- extconf.rb
7
7
 
8
8
  .PHONY: all
9
- all: sass_embedded embedded_sass_pb.rb
9
+ all: embedded_sass_pb.rb sass_embedded
10
10
 
11
11
  .PHONY: install
12
- install:
12
+ install: distclean
13
13
 
14
14
  .PHONY: clean
15
15
  clean:
16
- $(RM) embedded_sass_pb.rb protoc sass_embedded
16
+ $(RM) embedded_sass_pb.rb sass_embedded
17
17
 
18
18
  .PHONY: distclean
19
- distclean: clean
20
- $(RM) embedded_sass.proto protoc-*.zip sass_embedded-*.tar.gz
19
+ distclean:
20
+ $(RM) embedded_sass.proto protoc protoc-* sass_embedded-*
21
21
 
22
22
  ifeq ($(OS),Windows_NT)
23
23
  sass_embedded-*.zip:
data/ext/sass/extconf.rb CHANGED
@@ -104,14 +104,24 @@ module Sass
104
104
  end
105
105
  end
106
106
 
107
- def fetch(uri_s)
108
- uri = URI.parse(uri_s)
109
- path = URI::DEFAULT_PARSER.unescape(uri.path)
107
+ def fetch(uri_or_path)
108
+ begin
109
+ uri = URI.parse(uri_or_path)
110
+ path = URI::DEFAULT_PARSER.unescape(uri.path)
111
+ raise if uri.instance_of?(URI::Generic) && !File.file?(path)
112
+ rescue StandardError
113
+ raise unless File.file?(uri_or_path)
114
+
115
+ uri = nil
116
+ path = uri_or_path
117
+ end
118
+
110
119
  dest = File.absolute_path(File.basename(path), __dir__)
111
- if uri.is_a?(URI::File) || uri.instance_of?(URI::Generic)
120
+
121
+ if uri.nil? || uri.is_a?(URI::File) || uri.instance_of?(URI::Generic)
112
122
  puts "cp -- #{path} #{dest}"
113
123
  FileUtils.copy_file(path, dest)
114
- elsif uri.respond_to? :open
124
+ elsif uri.respond_to?(:open)
115
125
  puts "curl -fsSLo #{dest} -- #{uri}"
116
126
  uri.open do |stream|
117
127
  File.binwrite(dest, stream.read)
@@ -120,7 +130,7 @@ module Sass
120
130
  raise
121
131
  end
122
132
  rescue StandardError
123
- raise "Failed to fetch #{uri_s}"
133
+ raise "Failed to fetch #{uri_or_path}"
124
134
  end
125
135
 
126
136
  def default_sass_embedded
@@ -29,7 +29,7 @@ module Sass
29
29
  )
30
30
  )
31
31
  when Sass::Value::Color
32
- if obj.instance_eval { @hue.nil? }
32
+ if obj.instance_eval { !defined?(@hue) }
33
33
  Sass::EmbeddedProtocol::Value.new(
34
34
  rgb_color: Sass::EmbeddedProtocol::Value::RgbColor.new(
35
35
  red: obj.red,
@@ -38,7 +38,7 @@ module Sass
38
38
  alpha: obj.alpha.to_f
39
39
  )
40
40
  )
41
- elsif obj.instance_eval { @saturation.nil? }
41
+ elsif obj.instance_eval { !defined?(@saturation) }
42
42
  Sass::EmbeddedProtocol::Value.new(
43
43
  hwb_color: Sass::EmbeddedProtocol::Value::HwbColor.new(
44
44
  hue: obj.hue.to_f,
@@ -8,6 +8,7 @@ module Sass
8
8
  class Host
9
9
  def initialize(channel)
10
10
  @channel = channel
11
+ @mutex = Mutex.new
11
12
  end
12
13
 
13
14
  def id
@@ -118,14 +119,16 @@ module Sass
118
119
  private
119
120
 
120
121
  def await
121
- raise EOFError unless @async.nil?
122
-
123
- @connection = @channel.connect(self)
124
- @async = Async.new
125
- yield
126
- @async.await
127
- ensure
128
- @connection.disconnect
122
+ @mutex.synchronize do
123
+ raise EOFError if defined? @async
124
+
125
+ @connection = @channel.connect(self)
126
+ @async = Async.new
127
+ yield
128
+ @async.await
129
+ ensure
130
+ @connection.disconnect
131
+ end
129
132
  end
130
133
  end
131
134
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sass
4
4
  class Embedded
5
- VERSION = '1.0.1'
5
+ VERSION = '1.0.4'
6
6
  end
7
7
  end
@@ -70,37 +70,37 @@ module Sass
70
70
  end
71
71
 
72
72
  def red
73
- hsl_to_rgb if @red.nil?
73
+ hsl_to_rgb unless defined? @red
74
74
 
75
75
  @red
76
76
  end
77
77
 
78
78
  def green
79
- hsl_to_rgb if @green.nil?
79
+ hsl_to_rgb unless defined? @green
80
80
 
81
81
  @green
82
82
  end
83
83
 
84
84
  def blue
85
- hsl_to_rgb if @blue.nil?
85
+ hsl_to_rgb unless defined? @blue
86
86
 
87
87
  @blue
88
88
  end
89
89
 
90
90
  def hue
91
- rgb_to_hsl if @hue.nil?
91
+ rgb_to_hsl unless defined? @hue
92
92
 
93
93
  @hue
94
94
  end
95
95
 
96
96
  def saturation
97
- rgb_to_hsl if @saturation.nil?
97
+ rgb_to_hsl unless defined? @saturation
98
98
 
99
99
  @saturation
100
100
  end
101
101
 
102
102
  def lightness
103
- rgb_to_hsl if @lightness.nil?
103
+ rgb_to_hsl unless defined? @lightness
104
104
 
105
105
  @lightness
106
106
  end
data/lib/sass.rb CHANGED
@@ -77,13 +77,13 @@ module Sass
77
77
  private
78
78
 
79
79
  def instance
80
- if @instance.nil?
80
+ if defined? @instance
81
+ @instance = Embedded.new if @instance.closed?
82
+ else
81
83
  @instance = Embedded.new
82
84
  at_exit do
83
85
  @instance.close
84
86
  end
85
- elsif @instance.closed?
86
- @instance = Embedded.new
87
87
  end
88
88
  @instance
89
89
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sass-embedded
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - なつき
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-27 00:00:00.000000000 Z
11
+ date: 2022-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -162,8 +162,8 @@ homepage: https://github.com/ntkme/sass-embedded-host-ruby
162
162
  licenses:
163
163
  - MIT
164
164
  metadata:
165
- documentation_uri: https://www.rubydoc.info/gems/sass-embedded/1.0.1
166
- source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v1.0.1
165
+ documentation_uri: https://www.rubydoc.info/gems/sass-embedded/1.0.4
166
+ source_code_uri: https://github.com/ntkme/sass-embedded-host-ruby/tree/v1.0.4
167
167
  funding_uri: https://github.com/sponsors/ntkme
168
168
  post_install_message:
169
169
  rdoc_options: []