sass 3.3.0 → 3.4.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +3 -1
- data/CODE_OF_CONDUCT.md +10 -0
- data/CONTRIBUTING.md +148 -0
- data/MIT-LICENSE +1 -1
- data/README.md +76 -62
- data/Rakefile +104 -24
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/VERSION_NAME +1 -1
- data/bin/sass +1 -1
- data/bin/scss +1 -1
- data/extra/sass-spec-ref.sh +32 -0
- data/extra/update_watch.rb +1 -1
- data/lib/sass/cache_stores/filesystem.rb +9 -5
- data/lib/sass/cache_stores/memory.rb +4 -5
- data/lib/sass/callbacks.rb +2 -2
- data/lib/sass/css.rb +12 -13
- data/lib/sass/deprecation.rb +55 -0
- data/lib/sass/engine.rb +106 -70
- data/lib/sass/environment.rb +39 -19
- data/lib/sass/error.rb +17 -20
- data/lib/sass/exec/base.rb +199 -0
- data/lib/sass/exec/sass_convert.rb +283 -0
- data/lib/sass/exec/sass_scss.rb +440 -0
- data/lib/sass/exec.rb +5 -771
- data/lib/sass/features.rb +9 -2
- data/lib/sass/importers/base.rb +8 -3
- data/lib/sass/importers/filesystem.rb +30 -38
- data/lib/sass/logger/base.rb +8 -2
- data/lib/sass/logger/delayed.rb +50 -0
- data/lib/sass/logger.rb +8 -3
- data/lib/sass/media.rb +1 -4
- data/lib/sass/plugin/compiler.rb +224 -90
- data/lib/sass/plugin/configuration.rb +38 -22
- data/lib/sass/plugin/merb.rb +2 -2
- data/lib/sass/plugin/rack.rb +3 -3
- data/lib/sass/plugin/rails.rb +1 -1
- data/lib/sass/plugin/staleness_checker.rb +4 -4
- data/lib/sass/plugin.rb +6 -5
- data/lib/sass/script/css_lexer.rb +1 -1
- data/lib/sass/script/css_parser.rb +2 -3
- data/lib/sass/script/css_variable_warning.rb +52 -0
- data/lib/sass/script/functions.rb +739 -318
- data/lib/sass/script/lexer.rb +134 -54
- data/lib/sass/script/parser.rb +252 -56
- data/lib/sass/script/tree/funcall.rb +13 -6
- data/lib/sass/script/tree/interpolation.rb +127 -4
- data/lib/sass/script/tree/list_literal.rb +31 -4
- data/lib/sass/script/tree/literal.rb +4 -0
- data/lib/sass/script/tree/node.rb +21 -3
- data/lib/sass/script/tree/operation.rb +54 -1
- data/lib/sass/script/tree/selector.rb +26 -0
- data/lib/sass/script/tree/string_interpolation.rb +59 -38
- data/lib/sass/script/tree/variable.rb +1 -1
- data/lib/sass/script/tree.rb +1 -0
- data/lib/sass/script/value/base.rb +17 -14
- data/lib/sass/script/value/bool.rb +0 -5
- data/lib/sass/script/value/color.rb +78 -42
- data/lib/sass/script/value/helpers.rb +119 -2
- data/lib/sass/script/value/list.rb +0 -15
- data/lib/sass/script/value/map.rb +1 -1
- data/lib/sass/script/value/null.rb +0 -5
- data/lib/sass/script/value/number.rb +112 -31
- data/lib/sass/script/value/string.rb +102 -13
- data/lib/sass/script/value.rb +0 -1
- data/lib/sass/script.rb +3 -3
- data/lib/sass/scss/css_parser.rb +24 -4
- data/lib/sass/scss/parser.rb +290 -383
- data/lib/sass/scss/rx.rb +17 -9
- data/lib/sass/scss/static_parser.rb +306 -4
- data/lib/sass/scss.rb +0 -2
- data/lib/sass/selector/abstract_sequence.rb +35 -18
- data/lib/sass/selector/comma_sequence.rb +114 -19
- data/lib/sass/selector/pseudo.rb +266 -0
- data/lib/sass/selector/sequence.rb +146 -40
- data/lib/sass/selector/simple.rb +22 -33
- data/lib/sass/selector/simple_sequence.rb +122 -39
- data/lib/sass/selector.rb +57 -197
- data/lib/sass/shared.rb +2 -2
- data/lib/sass/source/map.rb +31 -14
- data/lib/sass/source/position.rb +4 -4
- data/lib/sass/stack.rb +2 -8
- data/lib/sass/supports.rb +10 -13
- data/lib/sass/tree/at_root_node.rb +1 -0
- data/lib/sass/tree/charset_node.rb +1 -1
- data/lib/sass/tree/comment_node.rb +1 -1
- data/lib/sass/tree/css_import_node.rb +9 -1
- data/lib/sass/tree/directive_node.rb +8 -2
- data/lib/sass/tree/error_node.rb +18 -0
- data/lib/sass/tree/extend_node.rb +1 -1
- data/lib/sass/tree/function_node.rb +9 -0
- data/lib/sass/tree/import_node.rb +6 -5
- data/lib/sass/tree/keyframe_rule_node.rb +15 -0
- data/lib/sass/tree/node.rb +5 -3
- data/lib/sass/tree/prop_node.rb +6 -7
- data/lib/sass/tree/rule_node.rb +26 -11
- data/lib/sass/tree/visitors/check_nesting.rb +56 -32
- data/lib/sass/tree/visitors/convert.rb +59 -44
- data/lib/sass/tree/visitors/cssize.rb +34 -30
- data/lib/sass/tree/visitors/deep_copy.rb +6 -1
- data/lib/sass/tree/visitors/extend.rb +15 -13
- data/lib/sass/tree/visitors/perform.rb +87 -50
- data/lib/sass/tree/visitors/set_options.rb +15 -1
- data/lib/sass/tree/visitors/to_css.rb +72 -43
- data/lib/sass/util/multibyte_string_scanner.rb +0 -2
- data/lib/sass/util/normalized_map.rb +0 -1
- data/lib/sass/util/subset_map.rb +2 -3
- data/lib/sass/util.rb +334 -154
- data/lib/sass/version.rb +7 -7
- data/lib/sass.rb +10 -8
- data/test/sass/cache_test.rb +62 -20
- data/test/sass/callbacks_test.rb +1 -1
- data/test/sass/compiler_test.rb +24 -11
- data/test/sass/conversion_test.rb +241 -50
- data/test/sass/css2sass_test.rb +73 -5
- data/test/sass/css_variable_test.rb +132 -0
- data/test/sass/encoding_test.rb +219 -0
- data/test/sass/engine_test.rb +343 -260
- data/test/sass/exec_test.rb +12 -2
- data/test/sass/extend_test.rb +333 -44
- data/test/sass/functions_test.rb +353 -260
- data/test/sass/importer_test.rb +40 -21
- data/test/sass/logger_test.rb +1 -1
- data/test/sass/more_results/more_import.css +1 -1
- data/test/sass/more_templates/more1.sass +10 -10
- data/test/sass/more_templates/more_import.sass +2 -2
- data/test/sass/plugin_test.rb +24 -21
- data/test/sass/results/compact.css +1 -1
- data/test/sass/results/complex.css +4 -4
- data/test/sass/results/expanded.css +1 -1
- data/test/sass/results/import.css +1 -1
- data/test/sass/results/import_charset_ibm866.css +2 -2
- data/test/sass/results/mixins.css +17 -17
- data/test/sass/results/nested.css +1 -1
- data/test/sass/results/parent_ref.css +2 -2
- data/test/sass/results/script.css +5 -5
- data/test/sass/results/scss_import.css +1 -1
- data/test/sass/script_conversion_test.rb +71 -39
- data/test/sass/script_test.rb +714 -123
- data/test/sass/scss/css_test.rb +213 -30
- data/test/sass/scss/rx_test.rb +8 -4
- data/test/sass/scss/scss_test.rb +766 -22
- data/test/sass/source_map_test.rb +263 -95
- data/test/sass/superselector_test.rb +210 -0
- data/test/sass/templates/_partial.sass +1 -1
- data/test/sass/templates/basic.sass +10 -10
- data/test/sass/templates/bork1.sass +1 -1
- data/test/sass/templates/bork5.sass +1 -1
- data/test/sass/templates/compact.sass +10 -10
- data/test/sass/templates/complex.sass +187 -187
- data/test/sass/templates/compressed.sass +10 -10
- data/test/sass/templates/expanded.sass +10 -10
- data/test/sass/templates/import.sass +2 -2
- data/test/sass/templates/importee.sass +3 -3
- data/test/sass/templates/mixins.sass +22 -22
- data/test/sass/templates/multiline.sass +4 -4
- data/test/sass/templates/nested.sass +13 -13
- data/test/sass/templates/parent_ref.sass +12 -12
- data/test/sass/templates/script.sass +70 -70
- data/test/sass/templates/scss_import.scss +2 -1
- data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +1 -1
- data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +2 -2
- data/test/sass/templates/subdir/subdir.sass +3 -3
- data/test/sass/templates/units.sass +10 -10
- data/test/sass/test_helper.rb +1 -1
- data/test/sass/util/multibyte_string_scanner_test.rb +11 -3
- data/test/sass/util/normalized_map_test.rb +1 -1
- data/test/sass/util/subset_map_test.rb +2 -2
- data/test/sass/util_test.rb +46 -45
- data/test/sass/value_helpers_test.rb +5 -7
- data/test/sass-spec.yml +3 -0
- data/test/test_helper.rb +7 -6
- data/vendor/listen/CHANGELOG.md +1 -228
- data/vendor/listen/Gemfile +5 -15
- data/vendor/listen/README.md +111 -77
- data/vendor/listen/Rakefile +0 -42
- data/vendor/listen/lib/listen/adapter.rb +195 -82
- data/vendor/listen/lib/listen/adapters/bsd.rb +27 -64
- data/vendor/listen/lib/listen/adapters/darwin.rb +21 -58
- data/vendor/listen/lib/listen/adapters/linux.rb +23 -55
- data/vendor/listen/lib/listen/adapters/polling.rb +25 -34
- data/vendor/listen/lib/listen/adapters/windows.rb +50 -46
- data/vendor/listen/lib/listen/directory_record.rb +96 -61
- data/vendor/listen/lib/listen/listener.rb +135 -37
- data/vendor/listen/lib/listen/turnstile.rb +9 -5
- data/vendor/listen/lib/listen/version.rb +1 -1
- data/vendor/listen/lib/listen.rb +33 -19
- data/vendor/listen/listen.gemspec +6 -0
- data/vendor/listen/spec/listen/adapter_spec.rb +43 -77
- data/vendor/listen/spec/listen/adapters/polling_spec.rb +8 -8
- data/vendor/listen/spec/listen/directory_record_spec.rb +81 -56
- data/vendor/listen/spec/listen/listener_spec.rb +128 -39
- data/vendor/listen/spec/listen_spec.rb +15 -21
- data/vendor/listen/spec/spec_helper.rb +4 -0
- data/vendor/listen/spec/support/adapter_helper.rb +52 -15
- data/vendor/listen/spec/support/directory_record_helper.rb +7 -5
- data/vendor/listen/spec/support/listeners_helper.rb +30 -7
- metadata +310 -300
- data/CONTRIBUTING +0 -3
- data/ext/mkrf_conf.rb +0 -27
- data/lib/sass/script/value/deprecated_false.rb +0 -55
- data/lib/sass/scss/script_lexer.rb +0 -15
- data/lib/sass/scss/script_parser.rb +0 -25
- data/vendor/listen/lib/listen/dependency_manager.rb +0 -126
- data/vendor/listen/lib/listen/multi_listener.rb +0 -143
- data/vendor/listen/spec/listen/dependency_manager_spec.rb +0 -107
- data/vendor/listen/spec/listen/multi_listener_spec.rb +0 -174
data/lib/sass/version.rb
CHANGED
@@ -8,7 +8,7 @@ module Sass
|
|
8
8
|
# if it was installed from Git.
|
9
9
|
module Version
|
10
10
|
# Returns a hash representing the version of Sass.
|
11
|
-
# The `:major`, `:minor`, and `:teeny` keys have their respective numbers as
|
11
|
+
# The `:major`, `:minor`, and `:teeny` keys have their respective numbers as Integers.
|
12
12
|
# The `:name` key has the name of the version.
|
13
13
|
# The `:string` key contains a human-readable string representation of the version.
|
14
14
|
# The `:number` key is the major, minor, and teeny keys separated by periods.
|
@@ -41,7 +41,7 @@ module Sass
|
|
41
41
|
# :prerelease_number => 1
|
42
42
|
# }
|
43
43
|
#
|
44
|
-
# @return [{Symbol => String/
|
44
|
+
# @return [{Symbol => String/Integer}] The version hash
|
45
45
|
# @comment
|
46
46
|
# rubocop:disable ClassVars
|
47
47
|
def version
|
@@ -85,20 +85,20 @@ module Sass
|
|
85
85
|
private
|
86
86
|
|
87
87
|
def revision_number
|
88
|
-
if File.
|
88
|
+
if File.exist?(Sass::Util.scope('REVISION'))
|
89
89
|
rev = File.read(Sass::Util.scope('REVISION')).strip
|
90
90
|
return rev unless rev =~ /^([a-f0-9]+|\(.*\))$/ || rev == '(unknown)'
|
91
91
|
end
|
92
92
|
|
93
|
-
return unless File.
|
93
|
+
return unless File.exist?(Sass::Util.scope('.git/HEAD'))
|
94
94
|
rev = File.read(Sass::Util.scope('.git/HEAD')).strip
|
95
95
|
return rev unless rev =~ /^ref: (.*)$/
|
96
96
|
|
97
97
|
ref_name = $1
|
98
98
|
ref_file = Sass::Util.scope(".git/#{ref_name}")
|
99
99
|
info_file = Sass::Util.scope(".git/info/refs")
|
100
|
-
return File.read(ref_file).strip if File.
|
101
|
-
return unless File.
|
100
|
+
return File.read(ref_file).strip if File.exist?(ref_file)
|
101
|
+
return unless File.exist?(info_file)
|
102
102
|
File.open(info_file) do |f|
|
103
103
|
f.each do |l|
|
104
104
|
sha, ref = l.strip.split("\t", 2)
|
@@ -110,7 +110,7 @@ module Sass
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def version_date
|
113
|
-
return unless File.
|
113
|
+
return unless File.exist?(Sass::Util.scope('VERSION_DATE'))
|
114
114
|
DateTime.parse(File.read(Sass::Util.scope('VERSION_DATE')).strip)
|
115
115
|
end
|
116
116
|
end
|
data/lib/sass.rb
CHANGED
@@ -1,11 +1,6 @@
|
|
1
1
|
dir = File.dirname(__FILE__)
|
2
2
|
$LOAD_PATH.unshift dir unless $LOAD_PATH.include?(dir)
|
3
3
|
|
4
|
-
# This is necessary to set so that the Haml code that tries to load Sass
|
5
|
-
# knows that Sass is indeed loading,
|
6
|
-
# even if there's some crazy autoload stuff going on.
|
7
|
-
SASS_BEGUN_TO_LOAD = true unless defined?(SASS_BEGUN_TO_LOAD)
|
8
|
-
|
9
4
|
require 'sass/version'
|
10
5
|
|
11
6
|
# The module that contains everything Sass-related:
|
@@ -52,7 +47,7 @@ module Sass
|
|
52
47
|
#
|
53
48
|
# @param contents [String] The contents of the Sass file.
|
54
49
|
# @param options [{Symbol => Object}] An options hash;
|
55
|
-
# see {file:SASS_REFERENCE.md#
|
50
|
+
# see {file:SASS_REFERENCE.md#Options the Sass options documentation}
|
56
51
|
# @raise [Sass::SyntaxError] if there's an error in the document
|
57
52
|
# @raise [Encoding::UndefinedConversionError] if the source encoding
|
58
53
|
# cannot be converted to UTF-8
|
@@ -74,7 +69,7 @@ module Sass
|
|
74
69
|
#
|
75
70
|
# @param filename [String] The path to the Sass, SCSS, or CSS file on disk.
|
76
71
|
# @param options [{Symbol => Object}] An options hash;
|
77
|
-
# see {file:SASS_REFERENCE.md#
|
72
|
+
# see {file:SASS_REFERENCE.md#Options the Sass options documentation}
|
78
73
|
# @return [String] The compiled CSS.
|
79
74
|
#
|
80
75
|
# @overload compile_file(filename, css_filename, options = {})
|
@@ -82,7 +77,7 @@ module Sass
|
|
82
77
|
#
|
83
78
|
# @param filename [String] The path to the Sass, SCSS, or CSS file on disk.
|
84
79
|
# @param options [{Symbol => Object}] An options hash;
|
85
|
-
# see {file:SASS_REFERENCE.md#
|
80
|
+
# see {file:SASS_REFERENCE.md#Options the Sass options documentation}
|
86
81
|
# @param css_filename [String] The location to which to write the compiled CSS.
|
87
82
|
def self.compile_file(filename, *args)
|
88
83
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
@@ -105,3 +100,10 @@ require 'sass/engine'
|
|
105
100
|
require 'sass/plugin' if defined?(Merb::Plugins)
|
106
101
|
require 'sass/railtie'
|
107
102
|
require 'sass/features'
|
103
|
+
|
104
|
+
if Sass::Util.ruby1?
|
105
|
+
Sass::Util.sass_warn(
|
106
|
+
"DEPRECATION WARNING:\n" +
|
107
|
+
"Sass 3.5 will no longer support Ruby #{RUBY_VERSION}.\n" +
|
108
|
+
"Please upgrade to Ruby 2.0.0 or greater as soon as possible.\n")
|
109
|
+
end
|
data/test/sass/cache_test.rb
CHANGED
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper'
|
|
3
3
|
require File.dirname(__FILE__) + '/test_helper'
|
4
4
|
require 'sass/engine'
|
5
5
|
|
6
|
-
class CacheTest < Test
|
6
|
+
class CacheTest < MiniTest::Test
|
7
7
|
@@cache_dir = "tmp/file_cache"
|
8
8
|
|
9
9
|
def setup
|
@@ -18,42 +18,42 @@ class CacheTest < Test::Unit::TestCase
|
|
18
18
|
def test_file_cache_writes_a_file
|
19
19
|
file_store = Sass::CacheStores::Filesystem.new(@@cache_dir)
|
20
20
|
file_store.store("asdf/foo.scssc", "fakesha1", root_node)
|
21
|
-
assert File.
|
21
|
+
assert File.exist?("#{@@cache_dir}/asdf/foo.scssc")
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_file_cache_reads_a_file
|
25
25
|
file_store = Sass::CacheStores::Filesystem.new(@@cache_dir)
|
26
|
-
assert !File.
|
26
|
+
assert !File.exist?("#{@@cache_dir}/asdf/foo.scssc")
|
27
27
|
file_store.store("asdf/foo.scssc", "fakesha1", root_node)
|
28
|
-
assert File.
|
28
|
+
assert File.exist?("#{@@cache_dir}/asdf/foo.scssc")
|
29
29
|
assert_kind_of Sass::Tree::RootNode, file_store.retrieve("asdf/foo.scssc", "fakesha1")
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_file_cache_miss_returns_nil
|
33
33
|
file_store = Sass::CacheStores::Filesystem.new(@@cache_dir)
|
34
|
-
assert !File.
|
34
|
+
assert !File.exist?("#{@@cache_dir}/asdf/foo.scssc")
|
35
35
|
assert_nil file_store.retrieve("asdf/foo.scssc", "fakesha1")
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_sha_change_invalidates_cache_and_cleans_up
|
39
39
|
file_store = Sass::CacheStores::Filesystem.new(@@cache_dir)
|
40
|
-
assert !File.
|
40
|
+
assert !File.exist?("#{@@cache_dir}/asdf/foo.scssc")
|
41
41
|
file_store.store("asdf/foo.scssc", "fakesha1", root_node)
|
42
|
-
assert File.
|
42
|
+
assert File.exist?("#{@@cache_dir}/asdf/foo.scssc")
|
43
43
|
assert_nil file_store.retrieve("asdf/foo.scssc", "differentsha1")
|
44
|
-
assert !File.
|
44
|
+
assert !File.exist?("#{@@cache_dir}/asdf/foo.scssc")
|
45
45
|
end
|
46
46
|
|
47
47
|
def test_version_change_invalidates_cache_and_cleans_up
|
48
48
|
file_store = Sass::CacheStores::Filesystem.new(@@cache_dir)
|
49
|
-
assert !File.
|
49
|
+
assert !File.exist?("#{@@cache_dir}/asdf/foo.scssc")
|
50
50
|
file_store.store("asdf/foo.scssc", "fakesha1", root_node)
|
51
|
-
assert File.
|
51
|
+
assert File.exist?("#{@@cache_dir}/asdf/foo.scssc")
|
52
52
|
real_version = Sass::VERSION
|
53
53
|
begin
|
54
54
|
Sass::VERSION.replace("a different version")
|
55
55
|
assert_nil file_store.retrieve("asdf/foo.scssc", "fakesha1")
|
56
|
-
assert !File.
|
56
|
+
assert !File.exist?("#{@@cache_dir}/asdf/foo.scssc")
|
57
57
|
ensure
|
58
58
|
Sass::VERSION.replace(real_version)
|
59
59
|
end
|
@@ -66,17 +66,52 @@ class CacheTest < Test::Unit::TestCase
|
|
66
66
|
assert_equal an_object, cache.retrieve("an_object", "")
|
67
67
|
end
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
raise 'Unmarshalable'
|
72
|
-
end
|
69
|
+
def test_cache_node_with_unmarshalable_option
|
70
|
+
engine_with_unmarshalable_options("foo {a: b + c}").to_tree
|
73
71
|
end
|
74
72
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
73
|
+
# Regression tests
|
74
|
+
|
75
|
+
def test_cache_mixin_def_splat_sass_node_with_unmarshalable_option
|
76
|
+
engine_with_unmarshalable_options(<<SASS, :syntax => :sass).to_tree
|
77
|
+
=color($args...)
|
78
|
+
color: red
|
79
|
+
SASS
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_cache_mixin_def_splat_scss_node_with_unmarshalable_option
|
83
|
+
engine_with_unmarshalable_options(<<SCSS, :syntax => :scss).to_tree
|
84
|
+
@mixin color($args...) {
|
85
|
+
color: red;
|
86
|
+
}
|
87
|
+
SCSS
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_cache_function_splat_sass_node_with_unmarshalable_option
|
91
|
+
engine_with_unmarshalable_options(<<SASS, :syntax => :sass).to_tree
|
92
|
+
@function color($args...)
|
93
|
+
@return red
|
94
|
+
SASS
|
95
|
+
end
|
96
|
+
|
97
|
+
def test_cache_function_splat_scss_node_with_unmarshalable_option
|
98
|
+
engine_with_unmarshalable_options(<<SCSS, :syntax => :scss).to_tree
|
99
|
+
@function color($args...) {
|
100
|
+
@return red;
|
101
|
+
}
|
102
|
+
SCSS
|
103
|
+
end
|
104
|
+
|
105
|
+
def test_cache_include_splat_sass_node_with_unmarshalable_option
|
106
|
+
engine_with_unmarshalable_options(<<SASS, :syntax => :sass).to_tree
|
107
|
+
@include color($args..., $kwargs...)
|
108
|
+
SASS
|
109
|
+
end
|
110
|
+
|
111
|
+
def test_cache_include_splat_scss_node_with_unmarshalable_option
|
112
|
+
engine_with_unmarshalable_options(<<SCSS, :syntax => :scss).to_tree
|
113
|
+
@include color($args..., $kwargs...);
|
114
|
+
SCSS
|
80
115
|
end
|
81
116
|
|
82
117
|
private
|
@@ -86,4 +121,11 @@ class CacheTest < Test::Unit::TestCase
|
|
86
121
|
div { @include color(red); }
|
87
122
|
SCSS
|
88
123
|
end
|
124
|
+
|
125
|
+
def engine_with_unmarshalable_options(src, options={})
|
126
|
+
Sass::Engine.new(src, {
|
127
|
+
:syntax => :scss, :object => Class.new.new, :filename => 'file.scss',
|
128
|
+
:importer => Sass::Importers::Filesystem.new(absolutize('templates'))
|
129
|
+
}.merge(options))
|
130
|
+
end
|
89
131
|
end
|
data/test/sass/callbacks_test.rb
CHANGED
data/test/sass/compiler_test.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
require '
|
2
|
+
require 'minitest/autorun'
|
3
3
|
require File.dirname(__FILE__) + '/../test_helper'
|
4
4
|
require 'sass/plugin'
|
5
5
|
require 'sass/plugin/compiler'
|
6
6
|
|
7
|
-
class CompilerTest < Test
|
7
|
+
class CompilerTest < MiniTest::Test
|
8
8
|
class FakeListener
|
9
9
|
attr_accessor :options
|
10
10
|
attr_accessor :directories
|
@@ -18,7 +18,7 @@ class CompilerTest < Test::Unit::TestCase
|
|
18
18
|
@start_called = false
|
19
19
|
reset_events!
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def fire_events!(*args)
|
23
23
|
@on_filesystem_event.call(@modified, @added, @removed)
|
24
24
|
reset_events!
|
@@ -47,7 +47,11 @@ class CompilerTest < Test::Unit::TestCase
|
|
47
47
|
|
48
48
|
# used for Listen >= 2.0
|
49
49
|
def start
|
50
|
-
|
50
|
+
parent = Thread.current
|
51
|
+
@thread = Thread.new do
|
52
|
+
@run_during_start.call(self) if @run_during_start
|
53
|
+
parent.raise Interrupt
|
54
|
+
end
|
51
55
|
end
|
52
56
|
|
53
57
|
def stop
|
@@ -82,9 +86,18 @@ class CompilerTest < Test::Unit::TestCase
|
|
82
86
|
|
83
87
|
private
|
84
88
|
def create_listener(*args, &on_filesystem_event)
|
85
|
-
|
86
|
-
|
87
|
-
|
89
|
+
if Sass::Util.listen_geq_2?
|
90
|
+
args.pop if args.last.is_a?(Hash)
|
91
|
+
args.map do |dir|
|
92
|
+
@fake_listener = FakeListener.new(*args, &on_filesystem_event)
|
93
|
+
@fake_listener.on_start!(&run_during_start)
|
94
|
+
@fake_listener
|
95
|
+
end
|
96
|
+
else
|
97
|
+
@fake_listener = FakeListener.new(*args, &on_filesystem_event)
|
98
|
+
@fake_listener.on_start!(&run_during_start)
|
99
|
+
@fake_listener
|
100
|
+
end
|
88
101
|
end
|
89
102
|
end
|
90
103
|
|
@@ -174,12 +187,12 @@ class CompilerTest < Test::Unit::TestCase
|
|
174
187
|
directories = nil
|
175
188
|
c = watcher do |listener|
|
176
189
|
directories = listener.directories
|
177
|
-
listener.removed "
|
190
|
+
listener.removed File.expand_path("./foo.scss")
|
178
191
|
listener.fire_events!
|
179
192
|
end
|
180
|
-
c.watch([["
|
181
|
-
assert directories.include?("
|
182
|
-
assert_equal "
|
193
|
+
c.watch([[File.expand_path("./foo.scss"), File.expand_path("./foo.css"), nil]])
|
194
|
+
assert directories.include?(File.expand_path(".")), directories.inspect
|
195
|
+
assert_equal File.expand_path("./foo.css"), c.deleted_css_files.first, "the corresponding css file was not deleted"
|
183
196
|
assert_equal [], c.update_stylesheets_called_with[1], "the sass file should not have been compiled"
|
184
197
|
end
|
185
198
|
|