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
@@ -4,13 +4,24 @@
|
|
4
4
|
# @param [String] path the path to watch
|
5
5
|
#
|
6
6
|
def watch(listener, expected_changes, *paths)
|
7
|
-
|
8
|
-
|
7
|
+
sleep 0.05 # allow file/creation to be done (!)
|
8
|
+
|
9
|
+
callback = lambda do |changed_directories, options|
|
10
|
+
@called = true
|
11
|
+
listener.on_change(changed_directories)
|
12
|
+
end
|
13
|
+
@adapter = Listen::Adapter.select_and_initialize(paths, { :latency => test_latency }, &callback)
|
14
|
+
@adapter.stub(:start_poller) { nil }
|
9
15
|
|
10
16
|
forced_stop = false
|
11
|
-
prevent_deadlock =
|
17
|
+
prevent_deadlock = lambda do
|
18
|
+
sleep(10)
|
19
|
+
puts 'Forcing stop'
|
20
|
+
@adapter.stop
|
21
|
+
forced_stop = true
|
22
|
+
end
|
12
23
|
|
13
|
-
@adapter.start
|
24
|
+
@adapter.start
|
14
25
|
|
15
26
|
yield
|
16
27
|
|
@@ -32,25 +43,51 @@ shared_examples_for 'a filesystem adapter' do
|
|
32
43
|
subject { described_class.new(File.dirname(__FILE__), &Proc.new {}) }
|
33
44
|
|
34
45
|
describe '#start' do
|
46
|
+
before { Kernel.stub(:warn) }
|
35
47
|
after { subject.stop }
|
36
48
|
|
37
|
-
|
38
|
-
|
49
|
+
it 'do not block the current thread after starting the workers' do
|
50
|
+
@called = false
|
51
|
+
t = Thread.new { subject.start; @called = true }
|
52
|
+
sleep(test_latency * 3)
|
53
|
+
Thread.kill(t) if t
|
54
|
+
@called.should be_true
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'with the blocking hash option set to false' do
|
58
|
+
subject { described_class.new(File.dirname(__FILE__), { :blocking => false }, &Proc.new {}) }
|
59
|
+
|
60
|
+
it 'does not block the current thread after starting the workers' do
|
39
61
|
@called = false
|
40
|
-
t = Thread.new { subject.start
|
62
|
+
t = Thread.new { subject.start; @called = true }
|
41
63
|
sleep(test_latency * 3)
|
42
64
|
Thread.kill(t) if t
|
43
|
-
@called.should
|
65
|
+
@called.should be_true
|
44
66
|
end
|
45
67
|
end
|
68
|
+
end
|
46
69
|
|
47
|
-
|
48
|
-
|
70
|
+
describe '#start!' do
|
71
|
+
before { Kernel.stub(:warn) }
|
72
|
+
after { subject.stop }
|
73
|
+
|
74
|
+
it 'blocks the current thread after starting the workers' do
|
75
|
+
@called = false
|
76
|
+
t = Thread.new { subject.start!; @called = true }
|
77
|
+
sleep(test_latency * 3)
|
78
|
+
Thread.kill(t) if t
|
79
|
+
@called.should be_false
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'with the blocking hash option set to false' do
|
83
|
+
subject { described_class.new(File.dirname(__FILE__), { :blocking => true }, &Proc.new {}) }
|
84
|
+
|
85
|
+
it 'blocks the current thread after starting the workers' do
|
49
86
|
@called = false
|
50
|
-
t = Thread.new { subject.start
|
87
|
+
t = Thread.new { subject.start!; @called = true }
|
51
88
|
sleep(test_latency * 3)
|
52
89
|
Thread.kill(t) if t
|
53
|
-
@called.should
|
90
|
+
@called.should be_false
|
54
91
|
end
|
55
92
|
end
|
56
93
|
end
|
@@ -63,7 +100,7 @@ shared_examples_for 'a filesystem adapter' do
|
|
63
100
|
end
|
64
101
|
|
65
102
|
context 'with a stopped adapter' do
|
66
|
-
before { subject.start
|
103
|
+
before { subject.start; subject.stop }
|
67
104
|
|
68
105
|
it 'returns false' do
|
69
106
|
subject.should_not be_started
|
@@ -71,7 +108,7 @@ shared_examples_for 'a filesystem adapter' do
|
|
71
108
|
end
|
72
109
|
|
73
110
|
context 'with a started adapter' do
|
74
|
-
before { subject.start
|
111
|
+
before { subject.start }
|
75
112
|
after { subject.stop }
|
76
113
|
|
77
114
|
it 'returns true' do
|
@@ -83,7 +120,7 @@ end
|
|
83
120
|
|
84
121
|
shared_examples_for 'an adapter that call properly listener#on_change' do |*args|
|
85
122
|
options = (args.first && args.first.is_a?(Hash)) ? args.first : {}
|
86
|
-
let(:listener) {
|
123
|
+
let(:listener) { double(Listen::Listener) }
|
87
124
|
before { described_class.stub(:works?) { true } }
|
88
125
|
|
89
126
|
context 'single file operations' do
|
@@ -24,7 +24,7 @@ def changes(root_path, options = {})
|
|
24
24
|
paths = options.delete(:paths) || [root_path]
|
25
25
|
options[:recursive] = true if options[:recursive].nil?
|
26
26
|
|
27
|
-
changes = @record.fetch_changes(paths, {:relative_paths => true}.merge(options))
|
27
|
+
changes = @record.fetch_changes(paths, { :relative_paths => true }.merge(options))
|
28
28
|
|
29
29
|
[changes[:modified], changes[:added], changes[:removed]]
|
30
30
|
end
|
@@ -32,14 +32,15 @@ end
|
|
32
32
|
# Generates a small time difference before performing a time sensitive
|
33
33
|
# task (like comparing mtimes of files).
|
34
34
|
#
|
35
|
-
# @note Modification time for files only includes the milliseconds on Linux with MRI > 1.9.2
|
35
|
+
# @note Modification time for files only includes the milliseconds on Linux with MRI > 1.9.2
|
36
|
+
# and platform that support it (OS X 10.8 not included),
|
36
37
|
# that's why we generate a difference that's greater than 1 second.
|
37
38
|
#
|
38
39
|
def small_time_difference
|
39
40
|
t = Time.now
|
40
41
|
diff = t.to_f - t.to_i
|
41
42
|
|
42
|
-
sleep(
|
43
|
+
sleep(1.05 - diff)
|
43
44
|
end
|
44
45
|
|
45
46
|
# Ensures that the test runs at almost the same second at which
|
@@ -49,7 +50,8 @@ def ensure_same_second
|
|
49
50
|
t = Time.now
|
50
51
|
diff = t.to_f - t.to_i
|
51
52
|
|
52
|
-
|
53
|
-
|
53
|
+
# We are not at the end of a second
|
54
|
+
if diff >= (1 - Listen::Adapter::DEFAULT_LATENCY)
|
55
|
+
sleep(1.05 - diff)
|
54
56
|
end
|
55
57
|
end
|
@@ -9,14 +9,37 @@ shared_examples_for 'a listener to changes on a file-system' do
|
|
9
9
|
subject.start
|
10
10
|
end
|
11
11
|
|
12
|
-
context 'with the blocking param set to
|
13
|
-
it '
|
14
|
-
|
12
|
+
context 'with the blocking deprecated param set to true' do
|
13
|
+
it 'displays a deprecation notice' do
|
14
|
+
Kernel.should_receive(:warn).with(/#{Listen::Listener::BLOCKING_PARAMETER_DEPRECATION_MESSAGE}/)
|
15
|
+
subject.start(true)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context 'with the blocking deprecated param set to false' do
|
20
|
+
it 'displays a deprecation notice' do
|
21
|
+
Kernel.should_receive(:warn).with(/#{Listen::Listener::BLOCKING_PARAMETER_DEPRECATION_MESSAGE}/)
|
15
22
|
subject.start(false)
|
16
23
|
end
|
17
24
|
end
|
18
25
|
end
|
19
26
|
|
27
|
+
describe '#start!' do
|
28
|
+
before do
|
29
|
+
subject.stub(:initialize_adapter) { adapter }
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'starts the adapter' do
|
33
|
+
adapter.should_receive(:start!)
|
34
|
+
subject.start!
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'passes the blocking param to the adapter' do
|
38
|
+
adapter.should_receive(:start!)
|
39
|
+
subject.start!
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
20
43
|
context 'with a started listener' do
|
21
44
|
before do
|
22
45
|
subject.start
|
@@ -31,7 +54,7 @@ shared_examples_for 'a listener to changes on a file-system' do
|
|
31
54
|
|
32
55
|
describe '#pause' do
|
33
56
|
it 'sets adapter.paused to true' do
|
34
|
-
adapter.should_receive(:
|
57
|
+
adapter.should_receive(:pause)
|
35
58
|
subject.pause
|
36
59
|
end
|
37
60
|
|
@@ -42,7 +65,7 @@ shared_examples_for 'a listener to changes on a file-system' do
|
|
42
65
|
|
43
66
|
describe '#unpause' do
|
44
67
|
it 'sets adapter.paused to false' do
|
45
|
-
adapter.should_receive(:
|
68
|
+
adapter.should_receive(:unpause)
|
46
69
|
subject.unpause
|
47
70
|
end
|
48
71
|
|
@@ -58,12 +81,12 @@ shared_examples_for 'a listener to changes on a file-system' do
|
|
58
81
|
end
|
59
82
|
|
60
83
|
it 'returns true when adapter is paused' do
|
61
|
-
adapter.should_receive(:paused) { true }
|
84
|
+
adapter.should_receive(:paused?) { true }
|
62
85
|
subject.should be_paused
|
63
86
|
end
|
64
87
|
|
65
88
|
it 'returns false when adapter is not paused' do
|
66
|
-
adapter.should_receive(:paused) { false }
|
89
|
+
adapter.should_receive(:paused?) { false }
|
67
90
|
subject.should_not be_paused
|
68
91
|
end
|
69
92
|
end
|