sassc 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/README.md +6 -4
- data/lib/sassc.rb +4 -0
- data/lib/sassc/cache_stores.rb +6 -0
- data/lib/sassc/cache_stores/base.rb +6 -0
- data/lib/sassc/dependency.rb +13 -0
- data/lib/sassc/engine.rb +51 -3
- data/lib/sassc/error.rb +4 -0
- data/lib/sassc/native.rb +1 -1
- data/lib/sassc/native/native_functions_api.rb +4 -0
- data/lib/sassc/script.rb +71 -0
- data/lib/sassc/script/functions.rb +6 -0
- data/lib/sassc/script/string.rb +103 -0
- data/lib/sassc/version.rb +1 -1
- data/sassc.gemspec +2 -2
- data/test/engine_test.rb +122 -0
- data/test/fixtures/paths.scss +10 -0
- data/test/functions_test.rb +57 -0
- data/test/{smoke_test.rb → native_test.rb} +4 -7
- data/test/test_helper.rb +25 -0
- metadata +19 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a212192b55be4390eb3420aefcbb2b9c0240852
|
4
|
+
data.tar.gz: 24aa593a9b043f454dd0da299cc18572eb480bee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e04ff420d46edf08fc4cf3a330d35f0212ddf294e6228e20768d86c9cc9ef628863477e34e3f143c2fd546a9979781701a3c991d44cb8c908f6062eceef6c1ca
|
7
|
+
data.tar.gz: 2a356fd1f4f954d4cd8a60c9e79eba076398d60afa48822fe12f51edf58738ea79bf83f4eb60dcb07395d9ebcdba7a937277f4e6d6a59bb37e0561633c4816fd
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
# SassC [![Build Status](https://travis-ci.org/bolandrm/sassc.svg?branch=master)](https://travis-ci.org/bolandrm/sassc) [![Gem Version](https://badge.fury.io/rb/sassc.svg)](http://badge.fury.io/rb/sassc)
|
1
|
+
# SassC [![Build Status](https://travis-ci.org/bolandrm/sassc-ruby.svg?branch=master)](https://travis-ci.org/bolandrm/sassc-ruby) [![Gem Version](https://badge.fury.io/rb/sassc.svg)](http://badge.fury.io/rb/sassc)
|
2
2
|
|
3
|
-
|
3
|
+
Use `libsass` with Ruby!
|
4
4
|
|
5
|
-
|
5
|
+
This gem combines the speed of `libsass`, the [Sass C implementation](https://github.com/sass/libsass), with the easy of use of the original [Ruby Sass](https://github.com/sass/sass) library.
|
6
6
|
|
7
|
-
|
7
|
+
### libsass Version
|
8
|
+
|
9
|
+
[3.1.0](https://github.com/sass/libsass/releases/tag/3.1.0)
|
8
10
|
|
9
11
|
## Contributing
|
10
12
|
|
data/lib/sassc.rb
CHANGED
data/lib/sassc/engine.rb
CHANGED
@@ -1,13 +1,61 @@
|
|
1
1
|
module SassC
|
2
2
|
class Engine
|
3
|
+
class NotRenderedError < StandardError; end
|
4
|
+
|
3
5
|
def initialize(template, options = {})
|
4
|
-
#@options = self.class.normalize_options(options)
|
5
6
|
@template = template
|
7
|
+
@options = options
|
6
8
|
end
|
7
9
|
|
8
10
|
def render
|
9
|
-
|
10
|
-
|
11
|
+
data_context = Native.make_data_context(@template)
|
12
|
+
context = Native.data_context_get_context(data_context)
|
13
|
+
options = Native.context_get_options(context)
|
14
|
+
|
15
|
+
Native.option_set_is_indented_syntax_src(options, true) if sass?
|
16
|
+
Native.option_set_input_path(options, filename) if filename
|
17
|
+
Native.option_set_include_path(options, load_paths)
|
18
|
+
|
19
|
+
status = Script.setup_custom_functions(options, @options) do
|
20
|
+
Native.compile_data_context(data_context)
|
21
|
+
end
|
22
|
+
|
23
|
+
css = Native.context_get_output_string(context)
|
24
|
+
|
25
|
+
if status != 0
|
26
|
+
message = SassC::Native.context_get_error_message(context)
|
27
|
+
raise SyntaxError.new(message)
|
28
|
+
end
|
29
|
+
|
30
|
+
@dependencies = Native.context_get_included_files(context)
|
31
|
+
|
32
|
+
Native.delete_data_context(data_context)
|
33
|
+
|
34
|
+
return css unless quiet?
|
35
|
+
end
|
36
|
+
|
37
|
+
def dependencies
|
38
|
+
raise NotRenderedError unless @dependencies
|
39
|
+
Dependency.from_filenames(@dependencies)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def quiet?
|
45
|
+
@options[:quiet]
|
46
|
+
end
|
47
|
+
|
48
|
+
def filename
|
49
|
+
@options[:filename]
|
50
|
+
end
|
51
|
+
|
52
|
+
def sass?
|
53
|
+
@options[:syntax] && @options[:syntax].to_sym == :sass
|
54
|
+
end
|
55
|
+
|
56
|
+
def load_paths
|
57
|
+
paths = @options[:load_paths]
|
58
|
+
paths.join(":") if paths
|
11
59
|
end
|
12
60
|
end
|
13
61
|
end
|
data/lib/sassc/error.rb
ADDED
data/lib/sassc/native.rb
CHANGED
@@ -38,7 +38,7 @@ module SassC
|
|
38
38
|
|
39
39
|
# https://github.com/ffi/ffi/wiki/Examples#array-of-strings
|
40
40
|
def self.return_string_array(ptr)
|
41
|
-
ptr.
|
41
|
+
ptr.null? ? [] : ptr.get_array_of_string(0).compact
|
42
42
|
end
|
43
43
|
|
44
44
|
require_relative "native/native_context_api"
|
@@ -23,6 +23,10 @@ module SassC
|
|
23
23
|
# ADDAPI const char* ADDCALL sass_string_get_value (const union Sass_Value* v);
|
24
24
|
attach_function :sass_string_get_value, [:sass_value_ptr], :string
|
25
25
|
|
26
|
+
# ADDAPI size_t ADDCALL sass_list_get_length(const union Sass_Value* v)
|
27
|
+
# ADDAPI union Sass_Value* ADDCALL sass_list_get_value (const union Sass_Value* v, size_t i);
|
28
|
+
attach_function :sass_list_get_length, [:sass_value_ptr], :size_t
|
29
|
+
attach_function :sass_list_get_value, [:sass_value_ptr, :size_t], :sass_value_ptr
|
26
30
|
|
27
31
|
# Getters for custom function descriptors
|
28
32
|
# ADDAPI const char* ADDCALL sass_function_get_signature (Sass_C_Function_Callback fn);
|
data/lib/sassc/script.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
module SassC
|
2
|
+
module Script
|
3
|
+
def self.custom_functions
|
4
|
+
Functions.instance_methods.select do |function|
|
5
|
+
Functions.public_method_defined?(function)
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.setup_custom_functions(options, sass_options)
|
10
|
+
callbacks = {}
|
11
|
+
|
12
|
+
list = Native.make_function_list(custom_functions.count)
|
13
|
+
|
14
|
+
functs = Class.new.extend(Functions)
|
15
|
+
def functs.options=(opts)
|
16
|
+
@sass_options = opts
|
17
|
+
end
|
18
|
+
def functs.options
|
19
|
+
@sass_options
|
20
|
+
end
|
21
|
+
functs.options = sass_options
|
22
|
+
|
23
|
+
custom_functions.each_with_index do |custom_function, i|
|
24
|
+
callbacks[custom_function] = FFI::Function.new(:pointer, [:pointer, :pointer]) do |s_args, cookie|
|
25
|
+
length = Native.list_get_length(s_args)
|
26
|
+
|
27
|
+
v = Native.list_get_value(s_args, 0)
|
28
|
+
v = Native.string_get_value(v).dup
|
29
|
+
|
30
|
+
s = String.new(String.unquote(v), String.type(v))
|
31
|
+
|
32
|
+
value = functs.send(custom_function, s)
|
33
|
+
|
34
|
+
if value
|
35
|
+
value.to_native
|
36
|
+
else
|
37
|
+
String.new("").to_native
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
callback = Native.make_function(
|
42
|
+
formatted_function_name(custom_function),
|
43
|
+
callbacks[custom_function],
|
44
|
+
nil
|
45
|
+
)
|
46
|
+
|
47
|
+
Native::function_set_list_entry(list, i, callback)
|
48
|
+
end
|
49
|
+
|
50
|
+
Native::option_set_c_functions(options, list)
|
51
|
+
|
52
|
+
status = yield
|
53
|
+
|
54
|
+
callbacks
|
55
|
+
|
56
|
+
status
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.formatted_function_name(function_name)
|
60
|
+
params = Functions.instance_method(function_name).parameters
|
61
|
+
params = params.select { |param| param[0] == :req }
|
62
|
+
.map(&:first)
|
63
|
+
.map { |p| "$#{p}" }
|
64
|
+
.join(", ")
|
65
|
+
"#{function_name}(#{params})"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
require_relative "script/functions"
|
71
|
+
require_relative "script/string"
|
@@ -0,0 +1,103 @@
|
|
1
|
+
module SassC
|
2
|
+
module Script
|
3
|
+
class String
|
4
|
+
# The Ruby value of the string.
|
5
|
+
#
|
6
|
+
# @return [String]
|
7
|
+
attr_reader :value
|
8
|
+
|
9
|
+
# Whether this is a CSS string or a CSS identifier.
|
10
|
+
# The difference is that strings are written with double-quotes,
|
11
|
+
# while identifiers aren't.
|
12
|
+
#
|
13
|
+
# @return [Symbol] `:string` or `:identifier`
|
14
|
+
attr_reader :type
|
15
|
+
|
16
|
+
def self.value(contents)
|
17
|
+
contents.gsub("\\\n", "").gsub(/\\(?:([0-9a-fA-F]{1,6})\s?|(.))/) do
|
18
|
+
next $2 if $2
|
19
|
+
# Handle unicode escapes as per CSS Syntax Level 3 section 4.3.8.
|
20
|
+
code_point = $1.to_i(16)
|
21
|
+
if code_point == 0 || code_point > 0x10FFFF ||
|
22
|
+
(code_point >= 0xD800 && code_point <= 0xDFFF)
|
23
|
+
'�'
|
24
|
+
else
|
25
|
+
[code_point].pack("U")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.quote(contents, quote = nil)
|
31
|
+
# Short-circuit if there are no characters that need quoting.
|
32
|
+
unless contents =~ /[\n\\"']/
|
33
|
+
quote ||= '"'
|
34
|
+
return "#{quote}#{contents}#{quote}"
|
35
|
+
end
|
36
|
+
|
37
|
+
if quote.nil?
|
38
|
+
if contents.include?('"')
|
39
|
+
if contents.include?("'")
|
40
|
+
quote = '"'
|
41
|
+
else
|
42
|
+
quote = "'"
|
43
|
+
end
|
44
|
+
else
|
45
|
+
quote = '"'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Replace single backslashes with multiples.
|
50
|
+
contents = contents.gsub("\\", "\\\\\\\\")
|
51
|
+
|
52
|
+
if quote == '"'
|
53
|
+
contents = contents.gsub('"', "\\\"")
|
54
|
+
else
|
55
|
+
contents = contents.gsub("'", "\\'")
|
56
|
+
end
|
57
|
+
|
58
|
+
contents = contents.gsub(/\n(?![a-fA-F0-9\s])/, "\\a").gsub("\n", "\\a ")
|
59
|
+
"#{quote}#{contents}#{quote}"
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.type(contents)
|
63
|
+
unquote(contents) == contents ? :identifier : :string
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.unquote(contents)
|
67
|
+
s = contents.dup
|
68
|
+
|
69
|
+
case contents[0,1]
|
70
|
+
when "'", '"', '`'
|
71
|
+
s[0] = ''
|
72
|
+
end
|
73
|
+
|
74
|
+
case contents[-1,1]
|
75
|
+
when "'", '"', '`'
|
76
|
+
s[-1] = ''
|
77
|
+
end
|
78
|
+
|
79
|
+
return s
|
80
|
+
end
|
81
|
+
|
82
|
+
# Creates a new string.
|
83
|
+
#
|
84
|
+
# @param value [String] See \{#value}
|
85
|
+
# @param type [Symbol] See \{#type}
|
86
|
+
def initialize(value, type = :identifier)
|
87
|
+
value.freeze unless value.nil? || value == true || value == false
|
88
|
+
@value = value
|
89
|
+
@type = type
|
90
|
+
end
|
91
|
+
|
92
|
+
def to_native
|
93
|
+
Native::make_string(to_s)
|
94
|
+
end
|
95
|
+
|
96
|
+
# @see Value#to_s
|
97
|
+
def to_s(opts = {})
|
98
|
+
return @value.gsub(/\n\s*/, ' ') if opts[:quote] == :none || @type == :identifier
|
99
|
+
SassC::Script::String.quote(value, opts[:quote])
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
data/lib/sassc/version.rb
CHANGED
data/sassc.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = SassC::VERSION
|
9
9
|
spec.authors = ["Ryan Boland"]
|
10
10
|
spec.email = ["bolandryanm@gmail.com"]
|
11
|
-
spec.summary = "Use
|
12
|
-
spec.description = "Use
|
11
|
+
spec.summary = "Use libsass with Ruby!"
|
12
|
+
spec.description = "Use libsass with Ruby!"
|
13
13
|
spec.homepage = "https://github.com/bolandrm/sassc-ruby"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
data/test/engine_test.rb
ADDED
@@ -0,0 +1,122 @@
|
|
1
|
+
require_relative "test_helper"
|
2
|
+
|
3
|
+
class EngineTest < SassCTest
|
4
|
+
def render(data)
|
5
|
+
SassC::Engine.new(data).render
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_one_line_comments
|
9
|
+
assert_equal <<CSS, render(<<SCSS)
|
10
|
+
.foo {
|
11
|
+
baz: bang; }
|
12
|
+
CSS
|
13
|
+
.foo {// bar: baz;}
|
14
|
+
baz: bang; //}
|
15
|
+
}
|
16
|
+
SCSS
|
17
|
+
assert_equal <<CSS, render(<<SCSS)
|
18
|
+
.foo bar[val="//"] {
|
19
|
+
baz: bang; }
|
20
|
+
CSS
|
21
|
+
.foo bar[val="//"] {
|
22
|
+
baz: bang; //}
|
23
|
+
}
|
24
|
+
SCSS
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_variables
|
28
|
+
assert_equal <<CSS, render(<<SCSS)
|
29
|
+
blat {
|
30
|
+
a: foo; }
|
31
|
+
CSS
|
32
|
+
$var: foo;
|
33
|
+
|
34
|
+
blat {a: $var}
|
35
|
+
SCSS
|
36
|
+
|
37
|
+
assert_equal <<CSS, render(<<SCSS)
|
38
|
+
foo {
|
39
|
+
a: 2;
|
40
|
+
b: 6; }
|
41
|
+
CSS
|
42
|
+
foo {
|
43
|
+
$var: 2;
|
44
|
+
$another-var: 4;
|
45
|
+
a: $var;
|
46
|
+
b: $var + $another-var;}
|
47
|
+
SCSS
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_dependency_filenames_are_reported
|
51
|
+
within_construct do |construct|
|
52
|
+
construct.file("not_included.scss", "$size: 30px;")
|
53
|
+
construct.file("import_parent.scss", "$size: 30px;")
|
54
|
+
construct.file("import.scss", "@import 'import_parent'; $size: 30px;")
|
55
|
+
construct.file("styles.scss", "@import 'import.scss'; .hi { width: $size; }")
|
56
|
+
|
57
|
+
engine = SassC::Engine.new(File.read("styles.scss"))
|
58
|
+
engine.render
|
59
|
+
deps = engine.dependencies
|
60
|
+
filenames = deps.map { |dep| dep.options[:filename] }.sort
|
61
|
+
|
62
|
+
assert_equal ["import.scss", "import_parent.scss"], filenames
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def test_no_dependencies
|
67
|
+
engine = SassC::Engine.new("$size: 30px;")
|
68
|
+
engine.render
|
69
|
+
deps = engine.dependencies
|
70
|
+
assert_equal [], deps
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_not_rendered_error
|
74
|
+
engine = SassC::Engine.new("$size: 30px;")
|
75
|
+
assert_raises(SassC::Engine::NotRenderedError) { engine.dependencies }
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_load_paths
|
79
|
+
within_construct do |c|
|
80
|
+
c.directory("included_1")
|
81
|
+
c.directory("included_2")
|
82
|
+
|
83
|
+
c.file("included_1/import_parent.scss", "$s: 30px;")
|
84
|
+
c.file("included_2/import.scss", "@import 'import_parent'; $size: $s;")
|
85
|
+
c.file("styles.scss", "@import 'import.scss'; .hi { width: $size; }")
|
86
|
+
|
87
|
+
assert_equal ".hi {\n width: 30px; }\n", SassC::Engine.new(
|
88
|
+
File.read("styles.scss"),
|
89
|
+
load_paths: [ "included_1", "included_2" ]
|
90
|
+
).render
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_load_paths_not_configured
|
95
|
+
within_construct do |c|
|
96
|
+
c.file("included_1/import_parent.scss", "$s: 30px;")
|
97
|
+
c.file("included_2/import.scss", "@import 'import_parent'; $size: $s;")
|
98
|
+
c.file("styles.scss", "@import 'import.scss'; .hi { width: $size; }")
|
99
|
+
|
100
|
+
assert_raises(SassC::SyntaxError) {
|
101
|
+
SassC::Engine.new(File.read("styles.scss")).render
|
102
|
+
}
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_sass_variation
|
107
|
+
sass = <<SASS
|
108
|
+
$size: 30px
|
109
|
+
.foo
|
110
|
+
width: $size
|
111
|
+
SASS
|
112
|
+
|
113
|
+
css = <<CSS
|
114
|
+
.foo {
|
115
|
+
width: 30px; }
|
116
|
+
CSS
|
117
|
+
|
118
|
+
assert_equal css, SassC::Engine.new(sass, syntax: :sass).render
|
119
|
+
assert_equal css, SassC::Engine.new(sass, syntax: "sass").render
|
120
|
+
assert_raises(SassC::SyntaxError) { SassC::Engine.new(sass).render }
|
121
|
+
end
|
122
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
div {
|
2
|
+
url: url(asset-path("foo.svg"));
|
3
|
+
url: url(image-path("foo.png"));
|
4
|
+
url: url(video-path("foo.mov"));
|
5
|
+
url: url(audio-path("foo.mp3"));
|
6
|
+
url: url(font-path("foo.woff"));
|
7
|
+
url: url(javascript-path('foo.js'));
|
8
|
+
url: url(javascript-path("foo.js"));
|
9
|
+
url: url(stylesheet-path("foo.css"));
|
10
|
+
}
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require_relative "test_helper"
|
2
|
+
|
3
|
+
class FunctionsTest < SassCTest
|
4
|
+
module ::SassC::Script::Functions
|
5
|
+
def javascript_path(path)
|
6
|
+
::SassC::Script::String.new("/js/#{path.value}", :string)
|
7
|
+
end
|
8
|
+
|
9
|
+
def no_return_path(path)
|
10
|
+
nil
|
11
|
+
end
|
12
|
+
|
13
|
+
module Compass
|
14
|
+
def stylesheet_path(path)
|
15
|
+
::SassC::Script::String.new("/css/#{path.value}", :identifier)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
include Compass
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_functions_work
|
22
|
+
filename = fixture_path('paths.scss')
|
23
|
+
assert data = File.read(filename)
|
24
|
+
|
25
|
+
engine = ::SassC::Engine.new(data, {
|
26
|
+
filename: filename,
|
27
|
+
syntax: :scss
|
28
|
+
})
|
29
|
+
|
30
|
+
# test identifier / string types
|
31
|
+
# test varying quotes
|
32
|
+
|
33
|
+
assert_equal <<-EOS, engine.render
|
34
|
+
div {
|
35
|
+
url: url(asset-path("foo.svg"));
|
36
|
+
url: url(image-path("foo.png"));
|
37
|
+
url: url(video-path("foo.mov"));
|
38
|
+
url: url(audio-path("foo.mp3"));
|
39
|
+
url: url(font-path("foo.woff"));
|
40
|
+
url: url("/js/foo.js");
|
41
|
+
url: url("/js/foo.js");
|
42
|
+
url: url(/css/foo.css); }
|
43
|
+
EOS
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_function_with_no_return_value
|
47
|
+
filename = fixture_path('paths.scss')
|
48
|
+
assert data = File.read(filename)
|
49
|
+
|
50
|
+
engine = ::SassC::Engine.new("div {url: url(no-return-path('foo.svg'));}")
|
51
|
+
|
52
|
+
assert_equal <<-EOS, engine.render
|
53
|
+
div {
|
54
|
+
url: url(); }
|
55
|
+
EOS
|
56
|
+
end
|
57
|
+
end
|
@@ -1,18 +1,17 @@
|
|
1
1
|
require_relative "test_helper"
|
2
|
-
require "sassc"
|
3
2
|
|
4
|
-
module
|
3
|
+
module NativeTest
|
5
4
|
SAMPLE_SASS_STRING = "$size: 30px; .hi { width: $size; }"
|
6
5
|
SAMPLE_CSS_OUTPUT = ".hi {\n width: 30px; }\n"
|
7
6
|
BAD_SASS_STRING = "$size = 30px;"
|
8
7
|
|
9
|
-
class General <
|
8
|
+
class General < SassCTest
|
10
9
|
def test_it_reports_the_libsass_version
|
11
10
|
assert_equal "3.1.0", SassC::Native.version
|
12
11
|
end
|
13
12
|
end
|
14
13
|
|
15
|
-
class DataContext <
|
14
|
+
class DataContext < SassCTest
|
16
15
|
def teardown
|
17
16
|
SassC::Native.delete_data_context(@data_context)
|
18
17
|
end
|
@@ -90,9 +89,7 @@ module SmokeTest
|
|
90
89
|
end
|
91
90
|
end
|
92
91
|
|
93
|
-
class FileContext <
|
94
|
-
include TestConstruct::Helpers
|
95
|
-
|
92
|
+
class FileContext < SassCTest
|
96
93
|
def around
|
97
94
|
within_construct do |construct|
|
98
95
|
@construct = construct
|
data/test/test_helper.rb
CHANGED
@@ -2,3 +2,28 @@ require "minitest/autorun"
|
|
2
2
|
require "minitest/pride"
|
3
3
|
require "minitest/around/unit"
|
4
4
|
require "test_construct"
|
5
|
+
|
6
|
+
require "sassc"
|
7
|
+
|
8
|
+
class SassCTest < MiniTest::Test
|
9
|
+
include TestConstruct::Helpers
|
10
|
+
|
11
|
+
FIXTURE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "fixtures"))
|
12
|
+
|
13
|
+
def self.test(name, &block)
|
14
|
+
define_method("test_#{name.inspect}", &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def fixture(path)
|
18
|
+
IO.read(fixture_path(path))
|
19
|
+
end
|
20
|
+
|
21
|
+
def fixture_path(path)
|
22
|
+
if path.match(FIXTURE_ROOT)
|
23
|
+
path
|
24
|
+
else
|
25
|
+
File.join(FIXTURE_ROOT, path)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
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: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Boland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 1.9.6
|
97
|
-
description: Use
|
97
|
+
description: Use libsass with Ruby!
|
98
98
|
email:
|
99
99
|
- bolandryanm@gmail.com
|
100
100
|
executables: []
|
@@ -239,7 +239,11 @@ files:
|
|
239
239
|
- ext/libsass/win/libsass.sln
|
240
240
|
- ext/libsass/win/libsass.vcxproj
|
241
241
|
- lib/sassc.rb
|
242
|
+
- lib/sassc/cache_stores.rb
|
243
|
+
- lib/sassc/cache_stores/base.rb
|
244
|
+
- lib/sassc/dependency.rb
|
242
245
|
- lib/sassc/engine.rb
|
246
|
+
- lib/sassc/error.rb
|
243
247
|
- lib/sassc/native.rb
|
244
248
|
- lib/sassc/native/native_context_api.rb
|
245
249
|
- lib/sassc/native/native_functions_api.rb
|
@@ -247,9 +251,15 @@ files:
|
|
247
251
|
- lib/sassc/native/sass_output_style.rb
|
248
252
|
- lib/sassc/native/sass_value.rb
|
249
253
|
- lib/sassc/native/string_list.rb
|
254
|
+
- lib/sassc/script.rb
|
255
|
+
- lib/sassc/script/functions.rb
|
256
|
+
- lib/sassc/script/string.rb
|
250
257
|
- lib/sassc/version.rb
|
251
258
|
- sassc.gemspec
|
252
|
-
- test/
|
259
|
+
- test/engine_test.rb
|
260
|
+
- test/fixtures/paths.scss
|
261
|
+
- test/functions_test.rb
|
262
|
+
- test/native_test.rb
|
253
263
|
- test/test_helper.rb
|
254
264
|
homepage: https://github.com/bolandrm/sassc-ruby
|
255
265
|
licenses:
|
@@ -275,7 +285,10 @@ rubyforge_project:
|
|
275
285
|
rubygems_version: 2.4.5
|
276
286
|
signing_key:
|
277
287
|
specification_version: 4
|
278
|
-
summary: Use
|
288
|
+
summary: Use libsass with Ruby!
|
279
289
|
test_files:
|
280
|
-
- test/
|
290
|
+
- test/engine_test.rb
|
291
|
+
- test/fixtures/paths.scss
|
292
|
+
- test/functions_test.rb
|
293
|
+
- test/native_test.rb
|
281
294
|
- test/test_helper.rb
|