sassc 2.1.0.pre3-x64-mingw32 → 2.4.0-x64-mingw32

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: cc812093352e00086bbb17d7c21812f7d8fcde65cd084edad9e5bd49b9c7d1a3
4
- data.tar.gz: 5ae96371242246a65816f4f9dc94956209809be45e93ad03b64d03bbb358338c
3
+ metadata.gz: aef021ba77abb64065e3844904e2f3c700111053b41d2ce9c9676c21e2ee6d51
4
+ data.tar.gz: e93a85d27b94d6c677106ef3defffab897557021b99b4dbbfd8fd2737aa709f1
5
5
  SHA512:
6
- metadata.gz: 6939e244dbbfaed8edcadac2b8d753bade503ed8c007665b42b421db048b251709e240a625af7328b2513dbcd41a649c66f225e6f0dc4412629404bcde927c27
7
- data.tar.gz: bb281865210e1ff68ebb3c9d00d1a86eb137925e19f5a673045780e04d13b3965b24af1b331e2e2ab9cd18159e6c948449074dc08a48979f6a4ba3ab6e20ee0f
6
+ metadata.gz: b633d7d402a16a8141b862d2412606c86ed9d400e2792e8446afa781d33c4a8f42748605c44ac3ed6535a2976342c2f13fba39ff6e26c40a3d8655fd18e3f630
7
+ data.tar.gz: 1e9a403743c64c4e27f4383a76e4eba0ca34187873a9614be1a2ce4ed1f92ede70b5b26156172c7ad49d599a7d7e0748c08eabebd35f74e5d71a157efc16c313
@@ -10,5 +10,7 @@ rvm:
10
10
  - 2.4.6
11
11
  - 2.5.5
12
12
  - 2.6.3
13
+ - 2.7.0
14
+ - truffleruby
13
15
  notifications:
14
16
  email: false
@@ -1,3 +1,27 @@
1
+ - **2.4.0**
2
+ - [Update libsass to 3.6.4](https://github.com/sass/sassc-ruby/pull/199)
3
+ - [Use FFI::MemoryPointer instead of libc's malloc()](https://github.com/sass/sassc-ruby/pull/205)
4
+ - [Test against Ruby 2.7.0](https://github.com/sass/sassc-ruby/pull/193)
5
+
6
+ - **2.3.0**
7
+ - [Fix rake gem:native task](https://github.com/sass/sassc-ruby/pull/196)
8
+ - [disable lto flag for darwin + nix](https://github.com/sass/sassc-ruby/pull/166)
9
+ - [Sort input file list](https://github.com/sass/sassc-ruby/pull/178)
10
+ - [Set appropriate encoding for source_map](https://github.com/sass/sassc-ruby/pull/152)
11
+ - [allow passing functions directly](https://github.com/sass/sassc-ruby/pull/162)
12
+ - [always dispose data context](https://github.com/sass/sassc-ruby/pull/161)
13
+ - [Update libsass to 3.6.3](https://github.com/sass/sassc-ruby/pull/164)
14
+ - [Restore strip symbols](https://github.com/sass/sassc-ruby/pull/184)
15
+ - [Default --march-tune-native to false](https://github.com/sass/sassc-ruby/pull/158)
16
+ - [Fix compile issue on Mac OS X](https://github.com/sass/sassc-ruby/pull/174)
17
+ - [Test on TruffleRuby in TravisCI](https://github.com/sass/sassc-ruby/pull/171)
18
+ - [Use RbConfig::MAKEFILE_CONFIG['DLEXT'] instead of hardcoding extensions](https://github.com/sass/sassc-ruby/pull/173)
19
+ - **2.2.1**
20
+ - [Fix LoadError on some non-rvm environments](https://github.com/sass/sassc-ruby/pull/156)
21
+ - **2.2.0**
22
+ - [Do not build precompiled gems for Linux](https://github.com/sass/sassc-ruby/pull/145)
23
+ - **2.1.0**
24
+ - Equivalent to 2.1.0.pre3
1
25
  - **2.1.0.pre3**
2
26
  - [extconf.rb: Always write VERSION if we have .git](https://github.com/sass/sassc-ruby/pull/131)
3
27
  - [Update libsass to 3.6.1](https://github.com/sass/sassc-ruby/pull/130)
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ Rake::ExtensionTask.new('libsass', gem_spec) do |ext|
18
18
  ext.ext_dir = 'ext'
19
19
  ext.lib_dir = 'lib/sassc'
20
20
  ext.cross_compile = true
21
- ext.cross_platform = %w[x86-mingw32 x64-mingw32 x86-linux x86_64-linux]
21
+ ext.cross_platform = %w[x86-mingw32 x64-mingw32]
22
22
 
23
23
  # Link C++ stdlib statically when building binary gems.
24
24
  ext.cross_config_options << '--enable-static-stdlib'
@@ -36,9 +36,7 @@ task 'gem:native' do
36
36
 
37
37
  # The RUBY_CC_VERSION here doesn't matter for the final package.
38
38
  # Only one version should be specified, as the shared library is Ruby-agnostic.
39
- #
40
- # g++-multilib is installed for 64->32-bit cross-compilation.
41
- RakeCompilerDock.sh "sudo apt-get install -y g++-multilib && bundle && gem i rake --no-document && "\
39
+ RakeCompilerDock.sh "gem i rake bundler --no-document && bundle && "\
42
40
  "rake clean && rake cross native gem MAKE='nice make -j`nproc`' "\
43
41
  "RUBY_CC_VERSION=2.6.0 CLEAN=1"
44
42
  end
@@ -16,6 +16,7 @@ module SassC
16
16
  def initialize(template, options = {})
17
17
  @template = template
18
18
  @options = options
19
+ @functions = options.fetch(:functions, Script::Functions)
19
20
  end
20
21
 
21
22
  def render
@@ -37,7 +38,7 @@ module SassC
37
38
  Native.option_set_omit_source_map_url(native_options, true) if omit_source_map_url?
38
39
 
39
40
  import_handler.setup(native_options)
40
- functions_handler.setup(native_options)
41
+ functions_handler.setup(native_options, functions: @functions)
41
42
 
42
43
  status = Native.compile_data_context(data_context)
43
44
 
@@ -54,11 +55,12 @@ module SassC
54
55
  @dependencies = Native.context_get_included_files(context)
55
56
  @source_map = Native.context_get_source_map_string(context)
56
57
 
57
- Native.delete_data_context(data_context)
58
-
59
58
  css.force_encoding(@template.encoding)
59
+ @source_map.force_encoding(@template.encoding) if @source_map.is_a?(String)
60
60
 
61
61
  return css unless quiet?
62
+ ensure
63
+ Native.delete_data_context(data_context) if data_context
62
64
  end
63
65
 
64
66
  def dependencies
@@ -6,20 +6,24 @@ module SassC
6
6
  @options = options
7
7
  end
8
8
 
9
- def setup(native_options)
9
+ def setup(native_options, functions: Script::Functions)
10
10
  @callbacks = {}
11
11
  @function_names = {}
12
12
 
13
- list = Native.make_function_list(Script.custom_functions.count)
13
+ list = Native.make_function_list(Script.custom_functions(functions: functions).count)
14
14
 
15
- functions = FunctionWrapper.extend(Script::Functions)
16
- functions.options = @options
15
+ # use an anonymous class wrapper to avoid mutations in a threaded environment
16
+ functions_wrapper = Class.new do
17
+ attr_accessor :options
18
+ include functions
19
+ end.new
20
+ functions_wrapper.options = @options
17
21
 
18
- Script.custom_functions.each_with_index do |custom_function, i|
22
+ Script.custom_functions(functions: functions).each_with_index do |custom_function, i|
19
23
  @callbacks[custom_function] = FFI::Function.new(:pointer, [:pointer, :pointer]) do |native_argument_list, cookie|
20
24
  begin
21
25
  function_arguments = arguments_from_native_list(native_argument_list)
22
- result = functions.send(custom_function, *function_arguments)
26
+ result = functions_wrapper.send(custom_function, *function_arguments)
23
27
  to_native_value(result)
24
28
  rescue StandardError => exception
25
29
  # This rescues any exceptions that occur either in value conversion
@@ -28,7 +32,7 @@ module SassC
28
32
  end
29
33
  end
30
34
 
31
- @function_names[custom_function] = Script.formatted_function_name(custom_function)
35
+ @function_names[custom_function] = Script.formatted_function_name(custom_function, functions: functions)
32
36
 
33
37
  callback = Native.make_function(
34
38
  @function_names[custom_function],
@@ -65,11 +69,5 @@ module SassC
65
69
  $stderr.puts "[SassC::FunctionsHandler] #{message}"
66
70
  Native.make_error(message)
67
71
  end
68
-
69
- class FunctionWrapper
70
- class << self
71
- attr_accessor :options
72
- end
73
- end
74
72
  end
75
73
  end
@@ -6,8 +6,12 @@ module SassC
6
6
  module Native
7
7
  extend FFI::Library
8
8
 
9
- dl_ext = (RbConfig::CONFIG['host_os'] =~ /darwin/ ? 'bundle' : 'so')
10
- ffi_lib File.expand_path("libsass.#{dl_ext}", __dir__)
9
+ dl_ext = RbConfig::MAKEFILE_CONFIG['DLEXT']
10
+ begin
11
+ ffi_lib File.expand_path("libsass.#{dl_ext}", __dir__)
12
+ rescue LoadError # Some non-rvm environments don't copy a shared object over to lib/sassc
13
+ ffi_lib File.expand_path("libsass.#{dl_ext}", "#{__dir__}/../../ext")
14
+ end
11
15
 
12
16
  require_relative "native/sass_value"
13
17
 
@@ -30,7 +34,6 @@ module SassC
30
34
  require_relative "native/sass_input_style"
31
35
  require_relative "native/sass_output_style"
32
36
  require_relative "native/string_list"
33
- require_relative "native/lib_c"
34
37
 
35
38
  # Remove the redundant "sass_" from the beginning of every method name
36
39
  def self.attach_function(*args)
@@ -49,10 +52,9 @@ module SassC
49
52
  end
50
53
 
51
54
  def self.native_string(string)
52
- string = "#{string}\0"
53
- data = Native::LibC.malloc(string.bytesize)
54
- data.write_string(string)
55
- data
55
+ m = FFI::MemoryPointer.from_string(string)
56
+ m.autorelease = false
57
+ m
56
58
  end
57
59
 
58
60
  require_relative "native/native_context_api"
@@ -3,14 +3,12 @@
3
3
  module SassC
4
4
  module Script
5
5
 
6
- def self.custom_functions
7
- Functions.instance_methods.select do |function|
8
- Functions.public_method_defined?(function)
9
- end
6
+ def self.custom_functions(functions: Functions)
7
+ functions.public_instance_methods
10
8
  end
11
9
 
12
- def self.formatted_function_name(function_name)
13
- params = Functions.instance_method(function_name).parameters
10
+ def self.formatted_function_name(function_name, functions: Functions)
11
+ params = functions.instance_method(function_name).parameters
14
12
  params = params.map { |param_type, name| "$#{name}#{': null' if param_type == :opt}" }.join(", ")
15
13
  return "#{function_name}(#{params})"
16
14
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SassC
4
- VERSION = "2.1.0.pre3"
4
+ VERSION = "2.4.0"
5
5
  end
@@ -140,7 +140,7 @@ module SassC
140
140
 
141
141
  assert_match /Error: error in C function function_that_raises_errors/, exception.message
142
142
  assert_match /Intentional wrong thing happened somewhere inside the custom function/, exception.message
143
- assert_equal "[SassC::FunctionsHandler] Intentional wrong thing happened somewhere inside the custom function", stderr_output
143
+ assert_match /\[SassC::FunctionsHandler\] Intentional wrong thing happened somewhere inside the custom function/, stderr_output
144
144
  end
145
145
 
146
146
  def test_function_that_returns_a_sass_value
@@ -185,6 +185,33 @@ module SassC
185
185
  CSS
186
186
  end
187
187
 
188
+ def test_concurrency
189
+ 10.times do
190
+ threads = []
191
+ 10.times do |i|
192
+ threads << Thread.new(i) do |id|
193
+ out = Engine.new("div { url: inspect_options(); }", {test_key1: 'test_value', test_key2: id}).render
194
+ assert_match /test_key1/, out
195
+ assert_match /test_key2/, out
196
+ assert_match /test_value/, out
197
+ assert_match /#{id}/, out
198
+ end
199
+ end
200
+ threads.each(&:join)
201
+ end
202
+ end
203
+
204
+ def test_pass_custom_functions_as_a_parameter
205
+ out = Engine.new("div { url: test-function(); }", {functions: ExternalFunctions}).render
206
+ assert_match /custom_function/, out
207
+ end
208
+
209
+ def test_pass_incompatible_type_to_custom_functions
210
+ assert_raises(TypeError) do
211
+ Engine.new("div { url: test-function(); }", {functions: Class.new}).render
212
+ end
213
+ end
214
+
188
215
  private
189
216
 
190
217
  def assert_sass(sass, expected_css)
@@ -279,6 +306,10 @@ module SassC
279
306
  return argument
280
307
  end
281
308
 
309
+ def inspect_options
310
+ SassC::Script::Value::String.new(self.options.inspect, :string)
311
+ end
312
+
282
313
  def returns_sass_value
283
314
  return SassC::Script::Value::Color.new(red: 0, green: 0, blue: 0)
284
315
  end
@@ -299,5 +330,11 @@ module SassC
299
330
 
300
331
  end
301
332
 
333
+ module ExternalFunctions
334
+ def test_function
335
+ SassC::Script::Value::String.new("custom_function", :string)
336
+ end
337
+ end
338
+
302
339
  end
303
340
  end
@@ -11,7 +11,7 @@ module SassC
11
11
 
12
12
  class General < MiniTest::Test
13
13
  def test_it_reports_the_libsass_version
14
- assert_equal "3.6.1", Native.version
14
+ assert_equal "3.6.4", Native.version
15
15
  end
16
16
  end
17
17
 
@@ -185,9 +185,9 @@ module SassC
185
185
  funct = FFI::Function.new(:pointer, [:pointer, :pointer, :pointer]) do |url, prev, cookie|
186
186
  list = Native.make_import_list(2)
187
187
 
188
- str = "$var: 5px;\0"
189
- data = Native::LibC.malloc(str.size)
190
- data.write_string(str)
188
+ str = "$var: 5px;"
189
+ data = FFI::MemoryPointer.from_string(str)
190
+ data.autorelease = false
191
191
 
192
192
  entry0 = Native.make_import_entry("fake_includ.scss", data, nil)
193
193
  entry1 = Native.make_import_entry("not_included.scss", nil, nil)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sassc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0.pre3
4
+ version: 2.4.0
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Ryan Boland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-18 00:00:00.000000000 Z
11
+ date: 2020-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -161,7 +161,6 @@ files:
161
161
  - lib/sassc/importer.rb
162
162
  - lib/sassc/libsass.so
163
163
  - lib/sassc/native.rb
164
- - lib/sassc/native/lib_c.rb
165
164
  - lib/sassc/native/native_context_api.rb
166
165
  - lib/sassc/native/native_functions_api.rb
167
166
  - lib/sassc/native/sass2scss_api.rb
@@ -215,12 +214,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
215
214
  version: 2.0.0
216
215
  required_rubygems_version: !ruby/object:Gem::Requirement
217
216
  requirements:
218
- - - ">"
217
+ - - ">="
219
218
  - !ruby/object:Gem::Version
220
- version: 1.3.1
219
+ version: '0'
221
220
  requirements: []
222
- rubyforge_project:
223
- rubygems_version: 2.7.9
221
+ rubygems_version: 3.1.2
224
222
  signing_key:
225
223
  specification_version: 4
226
224
  summary: Use libsass with Ruby!
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module SassC
4
- module Native
5
- module LibC
6
- extend FFI::Library
7
- ffi_lib FFI::Library::LIBC
8
-
9
- # memory allocators
10
- attach_function :malloc, [:size_t], :pointer
11
- # attach_function :calloc, [:size_t], :pointer
12
- # attach_function :valloc, [:size_t], :pointer
13
- # attach_function :realloc, [:pointer, :size_t], :pointer
14
- # attach_function :free, [:pointer], :void
15
-
16
- # memory movers
17
- # attach_function :memcpy, [:pointer, :pointer, :size_t], :pointer
18
- # attach_function :bcopy, [:pointer, :pointer, :size_t], :void
19
- end
20
- end
21
- end