sassc 2.1.0.pre2 → 2.1.0.pre3

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: cded5a763843c824e5d515d37545e852120a63d187b39d8214c7fe002f9c57a4
4
- data.tar.gz: cda45eb98106cfaba4ae9c21fe3016af2239d330bdadc8fe4a1f86acde5da078
3
+ metadata.gz: c292d43734810782d28442d9ce558bd6d15f8c1726f9f9cf7ab734e60154616a
4
+ data.tar.gz: 10fdd3957c9e01b3e4eff3c7485af87a1acfdba6fd704cca71e1473dd115941e
5
5
  SHA512:
6
- metadata.gz: d85b37901cc1ed34a21d2e9a4ab2ceb1fcb94bd70354a0b4f1640fe76b1301b088616db73ed8dd79d51a74e1341c1a39fcf60feb11400bb7a0820d9aee6bf2a4
7
- data.tar.gz: 49ee4ffcf2c78f6be513af3b549ac1a09f89b1c4e64e57c807a33da5edad0663c8e5053f1ae0dd701e62bd487405f746bf8da1cdb4c4555186b3bf355efdc201
6
+ metadata.gz: 42faa474b08b2f1a561097698ea879dc3760bb4d0554d33e2f4f2250ca2f72f13c41e8d1c130905258846e64eba6d6e6f17d3fac747e216adcff9dc13be0c394
7
+ data.tar.gz: 0aa4d3f26dfe102fcff5863a352ef60527467ccff6590338db20bf3c653dc1059bc7bfb28b4b90222341d412da94924a75f878cb373f21dfdc5d4b1abb034317
@@ -1,3 +1,6 @@
1
+ - **2.1.0.pre3**
2
+ - [extconf.rb: Always write VERSION if we have .git](https://github.com/sass/sassc-ruby/pull/131)
3
+ - [Update libsass to 3.6.1](https://github.com/sass/sassc-ruby/pull/130)
1
4
  - **2.1.0.pre2**
2
5
  - [Reduce Ruby warnings](https://github.com/sass/sassc-ruby/pull/124)
3
6
  - [prefer equal? to determine object identity](https://github.com/sass/sassc-ruby/pull/122)
data/README.md CHANGED
@@ -6,7 +6,7 @@ This gem combines the speed of `libsass`, the [Sass C implementation](https://gi
6
6
 
7
7
  ### libsass Version
8
8
 
9
- [3.6.0](https://github.com/sass/libsass/releases/3.6.0)
9
+ [3.6.1](https://github.com/sass/libsass/releases/3.6.1)
10
10
 
11
11
  ## Installation
12
12
 
data/Rakefile CHANGED
@@ -43,7 +43,7 @@ task 'gem:native' do
43
43
  "RUBY_CC_VERSION=2.6.0 CLEAN=1"
44
44
  end
45
45
 
46
- CLEAN.include 'tmp', 'pkg', 'lib/sassc/libsass.so', 'ext/libsass/VERSION',
46
+ CLEAN.include 'tmp', 'pkg', 'lib/sassc/libsass.{so,bundle}', 'ext/libsass/VERSION',
47
47
  'ext/*.{o,so,bundle}', 'ext/Makefile'
48
48
 
49
49
  desc "Run all tests"
@@ -38,13 +38,12 @@ $CFLAGS.gsub!(/[\s+](-ansi|-std=[^\s]+)/, '')
38
38
  dir_config 'libsass'
39
39
 
40
40
  libsass_version = Dir.chdir(libsass_dir) do
41
- if File.exist?('VERSION')
42
- File.read('VERSION').chomp
43
- elsif File.exist?('.git')
41
+ if File.exist?('.git')
44
42
  ver = %x[git describe --abbrev=4 --dirty --always --tags].chomp
45
43
  File.write('VERSION', ver)
46
44
  ver
47
45
  end
46
+ File.read('VERSION').chomp if File.exist?('VERSION')
48
47
  end
49
48
 
50
49
  if libsass_version
@@ -1 +1 @@
1
- 3.6.0
1
+ 3.6.1
@@ -17,6 +17,12 @@
17
17
  #endif
18
18
  #endif
19
19
 
20
+ // Work around lack of `noexcept` keyword support in VS2013
21
+ #if defined(_MSC_VER) && (_MSC_VER <= 1800) && !defined(_ALLOW_KEYWORD_MACROS)
22
+ #define _ALLOW_KEYWORD_MACROS 1
23
+ #define noexcept throw( )
24
+ #endif
25
+
20
26
  #include <stddef.h>
21
27
  #include <stdbool.h>
22
28
 
@@ -184,7 +184,7 @@ namespace Sass {
184
184
  /////////////////////////////////////////////////////////////////////////
185
185
 
186
186
  Bubble::Bubble(ParserState pstate, Statement_Obj n, Statement_Obj g, size_t t)
187
- : Statement(pstate, Statement::BUBBLE, t), node_(n), group_end_(g == 0)
187
+ : Statement(pstate, Statement::BUBBLE, t), node_(n), group_end_(g == nullptr)
188
188
  { }
189
189
  Bubble::Bubble(const Bubble* ptr)
190
190
  : Statement(ptr),
@@ -834,7 +834,7 @@ namespace Sass {
834
834
  }
835
835
 
836
836
  bool At_Root_Block::exclude_node(Statement_Obj s) {
837
- if (expression() == 0)
837
+ if (expression() == nullptr)
838
838
  {
839
839
  return s->statement_type() == Statement::RULESET;
840
840
  }
@@ -312,7 +312,7 @@ namespace Sass {
312
312
  bool empty() const { return list_.empty(); }
313
313
  bool has(Expression_Obj k) const { return elements_.count(k) == 1; }
314
314
  Expression_Obj at(Expression_Obj k) const;
315
- bool has_duplicate_key() const { return duplicate_key_ != 0; }
315
+ bool has_duplicate_key() const { return duplicate_key_ != nullptr; }
316
316
  Expression_Obj get_duplicate_key() const { return duplicate_key_; }
317
317
  const ExpressionMap elements() { return elements_; }
318
318
  Hashed& operator<<(std::pair<Expression_Obj, Expression_Obj> p)
@@ -104,7 +104,7 @@ namespace Sass {
104
104
  bool has_parent_selector = false;
105
105
  for (size_t i = 0, L = selector_stack.size(); i < L && !has_parent_selector; i++) {
106
106
  Selector_List_Obj ll = selector_stack.at(i);
107
- has_parent_selector = ll != 0 && ll->length() > 0;
107
+ has_parent_selector = ll != nullptr && ll->length() > 0;
108
108
  }
109
109
 
110
110
  Selector_List_Obj sel = r->selector();
@@ -614,7 +614,7 @@ namespace Sass {
614
614
 
615
615
 
616
616
  Selector_List_Obj contextualized = Cast<Selector_List>(s->perform(&eval));
617
- if (contextualized == false) return;
617
+ if (contextualized == nullptr) return;
618
618
  for (auto complex_sel : contextualized->elements()) {
619
619
  Complex_Selector_Obj c = complex_sel;
620
620
  if (!c->head() || c->tail()) {
@@ -13,9 +13,8 @@
13
13
  #else
14
14
  # include <unistd.h>
15
15
  #endif
16
- #include <iostream>
17
- #include <fstream>
18
16
  #include <cctype>
17
+ #include <cstdio>
19
18
  #include <vector>
20
19
  #include <algorithm>
21
20
  #include <sys/stat.h>
@@ -462,21 +461,27 @@ namespace Sass {
462
461
  // just convert from unsigned char*
463
462
  char* contents = (char*) pBuffer;
464
463
  #else
464
+ // Read the file using `<cstdio>` instead of `<fstream>` for better portability.
465
+ // The `<fstream>` header initializes `<locale>` and this buggy in GCC4/5 with static linking.
466
+ // See:
467
+ // https://www.spinics.net/lists/gcchelp/msg46851.html
468
+ // https://github.com/sass/sassc-ruby/issues/128
465
469
  struct stat st;
466
470
  if (stat(path.c_str(), &st) == -1 || S_ISDIR(st.st_mode)) return 0;
467
- std::ifstream file(path.c_str(), std::ios::in | std::ios::binary | std::ios::ate);
468
- char* contents = 0;
469
- if (file.is_open()) {
470
- size_t size = file.tellg();
471
- // allocate an extra byte for the null char
472
- // and another one for edge-cases in lexer
473
- contents = (char*) malloc((size+2)*sizeof(char));
474
- file.seekg(0, std::ios::beg);
475
- file.read(contents, size);
476
- contents[size+0] = '\0';
477
- contents[size+1] = '\0';
478
- file.close();
471
+ FILE* fd = std::fopen(path.c_str(), "rb");
472
+ if (fd == nullptr) return nullptr;
473
+ const std::size_t size = st.st_size;
474
+ char* contents = static_cast<char*>(malloc(st.st_size + 2 * sizeof(char)));
475
+ if (std::fread(static_cast<void*>(contents), 1, size, fd) != size) {
476
+ free(contents);
477
+ return nullptr;
479
478
  }
479
+ if (std::fclose(fd) != 0) {
480
+ free(contents);
481
+ return nullptr;
482
+ }
483
+ contents[size] = '\0';
484
+ contents[size + 1] = '\0';
480
485
  #endif
481
486
  std::string extension;
482
487
  if (path.length() > 5) {
@@ -1060,7 +1060,7 @@ namespace Sass {
1060
1060
 
1061
1061
  for (size_t i = 0, L = g->length(); i < L; ++i) {
1062
1062
  if (!in_wrapped && i == 0) append_indentation();
1063
- if ((*g)[i] == 0) continue;
1063
+ if ((*g)[i] == nullptr) continue;
1064
1064
  schedule_mapping(g->at(i)->last());
1065
1065
  // add_open_mapping((*g)[i]->last());
1066
1066
  (*g)[i]->perform(this);
@@ -3,8 +3,10 @@
3
3
 
4
4
  #include "sass/base.h"
5
5
 
6
+ #include <cstddef>
6
7
  #include <iostream>
7
8
  #include <string>
9
+ #include <type_traits>
8
10
  #include <vector>
9
11
 
10
12
  namespace Sass {
@@ -185,6 +187,100 @@ namespace Sass {
185
187
  T* detach() { return static_cast<T*>(SharedPtr::detach()); }
186
188
  };
187
189
 
188
- }
190
+ // Comparison operators, based on:
191
+ // https://en.cppreference.com/w/cpp/memory/unique_ptr/operator_cmp
192
+
193
+ template<class T1, class T2>
194
+ bool operator==(const SharedImpl<T1>& x, const SharedImpl<T2>& y) {
195
+ return x.ptr() == y.ptr();
196
+ }
197
+
198
+ template<class T1, class T2>
199
+ bool operator!=(const SharedImpl<T1>& x, const SharedImpl<T2>& y) {
200
+ return x.ptr() != y.ptr();
201
+ }
202
+
203
+ template<class T1, class T2>
204
+ bool operator<(const SharedImpl<T1>& x, const SharedImpl<T2>& y) {
205
+ using CT = typename std::common_type<T1*, T2*>::type;
206
+ return std::less<CT>()(x.get(), y.get());
207
+ }
208
+
209
+ template<class T1, class T2>
210
+ bool operator<=(const SharedImpl<T1>& x, const SharedImpl<T2>& y) {
211
+ return !(y < x);
212
+ }
213
+
214
+ template<class T1, class T2>
215
+ bool operator>(const SharedImpl<T1>& x, const SharedImpl<T2>& y) {
216
+ return y < x;
217
+ }
218
+
219
+ template<class T1, class T2>
220
+ bool operator>=(const SharedImpl<T1>& x, const SharedImpl<T2>& y) {
221
+ return !(x < y);
222
+ }
223
+
224
+ template <class T>
225
+ bool operator==(const SharedImpl<T>& x, std::nullptr_t) noexcept {
226
+ return x.isNull();
227
+ }
228
+
229
+ template <class T>
230
+ bool operator==(std::nullptr_t, const SharedImpl<T>& x) noexcept {
231
+ return x.isNull();
232
+ }
233
+
234
+ template <class T>
235
+ bool operator!=(const SharedImpl<T>& x, std::nullptr_t) noexcept {
236
+ return !x.isNull();
237
+ }
238
+
239
+ template <class T>
240
+ bool operator!=(std::nullptr_t, const SharedImpl<T>& x) noexcept {
241
+ return !x.isNull();
242
+ }
243
+
244
+ template <class T>
245
+ bool operator<(const SharedImpl<T>& x, std::nullptr_t) {
246
+ return std::less<T*>()(x.get(), nullptr);
247
+ }
248
+
249
+ template <class T>
250
+ bool operator<(std::nullptr_t, const SharedImpl<T>& y) {
251
+ return std::less<T*>()(nullptr, y.get());
252
+ }
253
+
254
+ template <class T>
255
+ bool operator<=(const SharedImpl<T>& x, std::nullptr_t) {
256
+ return !(nullptr < x);
257
+ }
258
+
259
+ template <class T>
260
+ bool operator<=(std::nullptr_t, const SharedImpl<T>& y) {
261
+ return !(y < nullptr);
262
+ }
263
+
264
+ template <class T>
265
+ bool operator>(const SharedImpl<T>& x, std::nullptr_t) {
266
+ return nullptr < x;
267
+ }
268
+
269
+ template <class T>
270
+ bool operator>(std::nullptr_t, const SharedImpl<T>& y) {
271
+ return y < nullptr;
272
+ }
273
+
274
+ template <class T>
275
+ bool operator>=(const SharedImpl<T>& x, std::nullptr_t) {
276
+ return !(x < nullptr);
277
+ }
278
+
279
+ template <class T>
280
+ bool operator>=(std::nullptr_t, const SharedImpl<T>& y) {
281
+ return !(nullptr < y);
282
+ }
283
+
284
+ } // namespace Sass
189
285
 
190
286
  #endif
@@ -2488,7 +2488,7 @@ namespace Sass {
2488
2488
  Supports_Condition_Obj Parser::parse_supports_condition_in_parens(bool parens_required)
2489
2489
  {
2490
2490
  Supports_Condition_Obj interp = parse_supports_interpolation();
2491
- if (interp != 0) return interp;
2491
+ if (interp != nullptr) return interp;
2492
2492
 
2493
2493
  if (!lex < exactly <'('> >()) {
2494
2494
  if (parens_required) {
@@ -627,9 +627,9 @@ namespace Sass {
627
627
 
628
628
  bool isPrintable(Media_Block* m, Sass_Output_Style style)
629
629
  {
630
- if (m == 0) return false;
630
+ if (m == nullptr) return false;
631
631
  Block_Obj b = m->block();
632
- if (b == 0) return false;
632
+ if (b == nullptr) return false;
633
633
  for (size_t i = 0, L = b->length(); i < L; ++i) {
634
634
  Statement_Obj stm = b->at(i);
635
635
  if (Cast<Directive>(stm)) return true;
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SassC
4
- VERSION = "2.1.0.pre2"
4
+ VERSION = "2.1.0.pre3"
5
5
  end
@@ -48,7 +48,7 @@ Gem::Specification.new do |spec|
48
48
  end
49
49
 
50
50
  # Write a VERSION file for non-binary gems (for `SassC::Native.version`).
51
- if !File.exist?(File.join(libsass_dir, 'VERSION'))
51
+ if File.exist?(File.join(libsass_dir, '.git'))
52
52
  libsass_version = Dir.chdir(libsass_dir) do
53
53
  %x[git describe --abbrev=4 --dirty --always --tags].chomp
54
54
  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.0", Native.version
14
+ assert_equal "3.6.1", Native.version
15
15
  end
16
16
  end
17
17
 
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.pre2
4
+ version: 2.1.0.pre3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Boland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-05 00:00:00.000000000 Z
11
+ date: 2019-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest