sass 3.4.25 → 3.5.0

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.
Files changed (135) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/Rakefile +2 -117
  4. data/VERSION +1 -1
  5. data/VERSION_DATE +1 -1
  6. data/VERSION_NAME +1 -1
  7. data/lib/sass/cache_stores/filesystem.rb +1 -1
  8. data/lib/sass/css.rb +1 -2
  9. data/lib/sass/engine.rb +38 -20
  10. data/lib/sass/environment.rb +26 -5
  11. data/lib/sass/error.rb +2 -2
  12. data/lib/sass/exec/base.rb +2 -11
  13. data/lib/sass/features.rb +1 -0
  14. data/lib/sass/importers/filesystem.rb +2 -2
  15. data/lib/sass/plugin/compiler.rb +20 -50
  16. data/lib/sass/plugin/configuration.rb +2 -2
  17. data/lib/sass/railtie.rb +1 -1
  18. data/lib/sass/script/functions.rb +235 -43
  19. data/lib/sass/script/lexer.rb +13 -2
  20. data/lib/sass/script/parser.rb +69 -67
  21. data/lib/sass/script/tree/funcall.rb +35 -30
  22. data/lib/sass/script/tree/list_literal.rb +23 -8
  23. data/lib/sass/script/tree/map_literal.rb +2 -2
  24. data/lib/sass/script/tree/node.rb +0 -8
  25. data/lib/sass/script/tree/operation.rb +0 -7
  26. data/lib/sass/script/value/arg_list.rb +1 -1
  27. data/lib/sass/script/value/base.rb +17 -0
  28. data/lib/sass/script/value/callable.rb +25 -0
  29. data/lib/sass/script/value/color.rb +5 -0
  30. data/lib/sass/script/value/function.rb +19 -0
  31. data/lib/sass/script/value/helpers.rb +29 -9
  32. data/lib/sass/script/value/list.rb +35 -14
  33. data/lib/sass/script/value/map.rb +2 -2
  34. data/lib/sass/script/value/number.rb +1 -1
  35. data/lib/sass/script/value.rb +2 -0
  36. data/lib/sass/scss/parser.rb +99 -40
  37. data/lib/sass/scss/rx.rb +4 -10
  38. data/lib/sass/scss/static_parser.rb +5 -24
  39. data/lib/sass/selector/abstract_sequence.rb +7 -6
  40. data/lib/sass/selector/comma_sequence.rb +7 -4
  41. data/lib/sass/selector/pseudo.rb +19 -2
  42. data/lib/sass/selector/sequence.rb +35 -6
  43. data/lib/sass/selector/simple.rb +9 -2
  44. data/lib/sass/selector/simple_sequence.rb +8 -4
  45. data/lib/sass/selector.rb +4 -0
  46. data/lib/sass/source/map.rb +2 -2
  47. data/lib/sass/stack.rb +21 -1
  48. data/lib/sass/tree/charset_node.rb +1 -1
  49. data/lib/sass/tree/prop_node.rb +45 -53
  50. data/lib/sass/tree/rule_node.rb +3 -2
  51. data/lib/sass/tree/visitors/check_nesting.rb +1 -1
  52. data/lib/sass/tree/visitors/convert.rb +2 -3
  53. data/lib/sass/tree/visitors/cssize.rb +4 -15
  54. data/lib/sass/tree/visitors/deep_copy.rb +1 -1
  55. data/lib/sass/tree/visitors/extend.rb +2 -8
  56. data/lib/sass/tree/visitors/perform.rb +21 -9
  57. data/lib/sass/tree/visitors/set_options.rb +1 -1
  58. data/lib/sass/tree/visitors/to_css.rb +47 -13
  59. data/lib/sass/util/multibyte_string_scanner.rb +127 -131
  60. data/lib/sass/util/normalized_map.rb +1 -8
  61. data/lib/sass/util.rb +12 -290
  62. data/lib/sass/version.rb +0 -2
  63. data/lib/sass.rb +0 -7
  64. data/test/sass/cache_test.rb +0 -1
  65. data/test/sass/callbacks_test.rb +0 -1
  66. data/test/sass/compiler_test.rb +4 -15
  67. data/test/sass/conversion_test.rb +113 -163
  68. data/test/sass/css2sass_test.rb +16 -19
  69. data/test/sass/css_variable_test.rb +176 -71
  70. data/test/sass/encoding_test.rb +2 -33
  71. data/test/sass/engine_test.rb +71 -19
  72. data/test/sass/exec_test.rb +0 -1
  73. data/test/sass/extend_test.rb +37 -92
  74. data/test/sass/functions_test.rb +58 -14
  75. data/test/sass/importer_test.rb +2 -3
  76. data/test/sass/logger_test.rb +0 -1
  77. data/test/sass/plugin_test.rb +6 -10
  78. data/test/sass/results/script.css +1 -1
  79. data/test/sass/results/units.css +2 -2
  80. data/test/sass/script_conversion_test.rb +10 -2
  81. data/test/sass/script_test.rb +22 -24
  82. data/test/sass/scss/css_test.rb +3 -18
  83. data/test/sass/scss/rx_test.rb +0 -1
  84. data/test/sass/scss/scss_test.rb +49 -16
  85. data/test/sass/source_map_test.rb +13 -16
  86. data/test/sass/superselector_test.rb +0 -1
  87. data/test/sass/util/multibyte_string_scanner_test.rb +121 -124
  88. data/test/sass/util/normalized_map_test.rb +0 -1
  89. data/test/sass/util/subset_map_test.rb +0 -1
  90. data/test/sass/util_test.rb +4 -39
  91. data/test/sass/value_helpers_test.rb +0 -1
  92. data/test/sass-spec.yml +1 -1
  93. data/test/test_helper.rb +39 -0
  94. metadata +19 -44
  95. data/lib/sass/script/css_variable_warning.rb +0 -52
  96. data/lib/sass/util/cross_platform_random.rb +0 -19
  97. data/lib/sass/util/ordered_hash.rb +0 -192
  98. data/test/sass/results/import_charset_1_8.css +0 -5
  99. data/test/sass/templates/import_charset_1_8.sass +0 -6
  100. data/vendor/listen/CHANGELOG.md +0 -1
  101. data/vendor/listen/CONTRIBUTING.md +0 -38
  102. data/vendor/listen/Gemfile +0 -20
  103. data/vendor/listen/Guardfile +0 -8
  104. data/vendor/listen/LICENSE +0 -20
  105. data/vendor/listen/README.md +0 -349
  106. data/vendor/listen/Rakefile +0 -5
  107. data/vendor/listen/Vagrantfile +0 -96
  108. data/vendor/listen/lib/listen/adapter.rb +0 -327
  109. data/vendor/listen/lib/listen/adapters/bsd.rb +0 -75
  110. data/vendor/listen/lib/listen/adapters/darwin.rb +0 -48
  111. data/vendor/listen/lib/listen/adapters/linux.rb +0 -81
  112. data/vendor/listen/lib/listen/adapters/polling.rb +0 -58
  113. data/vendor/listen/lib/listen/adapters/windows.rb +0 -91
  114. data/vendor/listen/lib/listen/directory_record.rb +0 -406
  115. data/vendor/listen/lib/listen/listener.rb +0 -323
  116. data/vendor/listen/lib/listen/turnstile.rb +0 -32
  117. data/vendor/listen/lib/listen/version.rb +0 -3
  118. data/vendor/listen/lib/listen.rb +0 -54
  119. data/vendor/listen/listen.gemspec +0 -28
  120. data/vendor/listen/spec/listen/adapter_spec.rb +0 -149
  121. data/vendor/listen/spec/listen/adapters/bsd_spec.rb +0 -36
  122. data/vendor/listen/spec/listen/adapters/darwin_spec.rb +0 -37
  123. data/vendor/listen/spec/listen/adapters/linux_spec.rb +0 -47
  124. data/vendor/listen/spec/listen/adapters/polling_spec.rb +0 -68
  125. data/vendor/listen/spec/listen/adapters/windows_spec.rb +0 -30
  126. data/vendor/listen/spec/listen/directory_record_spec.rb +0 -1250
  127. data/vendor/listen/spec/listen/listener_spec.rb +0 -258
  128. data/vendor/listen/spec/listen/turnstile_spec.rb +0 -56
  129. data/vendor/listen/spec/listen_spec.rb +0 -67
  130. data/vendor/listen/spec/spec_helper.rb +0 -25
  131. data/vendor/listen/spec/support/adapter_helper.rb +0 -666
  132. data/vendor/listen/spec/support/directory_record_helper.rb +0 -57
  133. data/vendor/listen/spec/support/fixtures_helper.rb +0 -29
  134. data/vendor/listen/spec/support/listeners_helper.rb +0 -179
  135. data/vendor/listen/spec/support/platform_helper.rb +0 -15
@@ -1,258 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Listen::Listener do
4
- let(:adapter) { double(Listen::Adapter, :start => true).as_null_object }
5
- let(:watched_directories) { [File.dirname(__FILE__), File.expand_path('../..', __FILE__)] }
6
-
7
- before do
8
- Listen::Adapter.stub(:select_and_initialize) { adapter }
9
- # Don't build a record of the files inside the base directory.
10
- Listen::DirectoryRecord.any_instance.stub(:build)
11
- Kernel.stub(:warn)
12
- end
13
- subject { described_class.new(watched_directories) }
14
-
15
- it_should_behave_like 'a listener to changes on a file-system'
16
-
17
- describe '#initialize' do
18
- context 'listening to a single directory' do
19
- let(:watched_directory) { File.dirname(__FILE__) }
20
- let(:watched_directories) { nil }
21
- subject { described_class.new(watched_directory) }
22
-
23
- it 'sets the directories' do
24
- subject.directories.should eq [watched_directory]
25
- end
26
-
27
- context 'with no options' do
28
- it 'sets the option for using relative paths in the callback to false' do
29
- subject.instance_variable_get(:@use_relative_paths).should eq false
30
- end
31
- end
32
-
33
- context 'with :relative_paths => false' do
34
- it 'sets the option for using relative paths in the callback to false' do
35
- listener = described_class.new(watched_directory, :relative_paths => false)
36
- listener.instance_variable_get(:@use_relative_paths).should eq false
37
- end
38
- end
39
-
40
- context 'with :relative_paths => true' do
41
- it 'sets the option for using relative paths in the callback to true' do
42
- listener = described_class.new(watched_directory, :relative_paths => true)
43
- listener.instance_variable_get(:@use_relative_paths).should eq true
44
- end
45
- end
46
- end
47
-
48
- context 'listening to multiple directories' do
49
- subject { described_class.new(watched_directories) }
50
-
51
- it 'sets the directories' do
52
- subject.directories.should eq watched_directories
53
- end
54
-
55
- context 'with no options' do
56
- it 'sets the option for using relative paths in the callback to false' do
57
- subject.instance_variable_get(:@use_relative_paths).should eq false
58
- end
59
- end
60
-
61
- context 'with :relative_paths => false' do
62
- it 'sets the option for using relative paths in the callback to false' do
63
- listener = described_class.new(watched_directories, :relative_paths => false)
64
- listener.instance_variable_get(:@use_relative_paths).should eq false
65
- end
66
- end
67
-
68
- context 'with :relative_paths => true' do
69
- it 'warns' do
70
- Kernel.should_receive(:warn).with("[Listen warning]: #{Listen::Listener::RELATIVE_PATHS_WITH_MULTIPLE_DIRECTORIES_WARNING_MESSAGE}")
71
- listener = described_class.new(watched_directories, :relative_paths => true)
72
- end
73
-
74
- it 'sets the option for using relative paths in the callback to false' do
75
- listener = described_class.new(watched_directories, :relative_paths => true)
76
- listener.instance_variable_get(:@use_relative_paths).should eq false
77
- end
78
- end
79
- end
80
-
81
- context 'with a directory' do
82
- let(:watched_directory) { File.dirname(__FILE__) }
83
- it 'converts the passed path into an absolute path - #21' do
84
- described_class.new(File.join(watched_directory, '..')).directories.should eq [File.expand_path('..', watched_directory)]
85
- end
86
- end
87
-
88
- context 'with custom options' do
89
- let(:watched_directory) { File.dirname(__FILE__) }
90
- let(:adapter_class) { double('adapter class') }
91
-
92
- let(:options) do
93
- {
94
- :ignore => /\.ssh/, :filter => [/.*\.rb/, /.*\.md/],
95
- :latency => 0.5, :force_polling => true, :relative_paths => true,
96
- :force_adapter => adapter_class
97
- }
98
- end
99
- subject { described_class.new(watched_directory, options) }
100
-
101
- it 'passes the custom ignored paths to the directory record' do
102
- subject.directories_records.each do |directory_record|
103
- directory_record.ignoring_patterns.should include /\.ssh/
104
- end
105
- end
106
-
107
- it 'passes the custom filters to the directory record' do
108
- subject.directories_records.each do |directory_record|
109
- directory_record.filtering_patterns.should =~ [/.*\.rb/,/.*\.md/]
110
- end
111
- end
112
-
113
- it 'sets adapter_options' do
114
- subject.instance_variable_get(:@adapter_options).should eq(:latency => 0.5, :force_polling => true, :force_adapter => adapter_class)
115
- end
116
- end
117
- end
118
-
119
- describe '#start' do
120
- it 'selects and initializes an adapter' do
121
- Listen::Adapter.should_receive(:select_and_initialize).with(watched_directories, {}) { adapter }
122
- subject.start
123
- end
124
-
125
- it 'builds the directory record' do
126
- subject.directories_records.each do |directory_record|
127
- directory_record.should_receive(:build)
128
- end
129
- subject.start
130
- end
131
- end
132
-
133
- context 'with a started listener' do
134
- before do
135
- subject.stub(:initialize_adapter) { adapter }
136
- subject.start
137
- end
138
-
139
- describe '#unpause' do
140
- it 'rebuilds the directory record' do
141
- subject.directories_records.each do |directory_record|
142
- directory_record.should_receive(:build)
143
- end
144
- subject.unpause
145
- end
146
- end
147
- end
148
-
149
- describe '#ignore'do
150
- it 'delegates the work to the directory record' do
151
- subject.directories_records.each do |directory_record|
152
- directory_record.should_receive(:ignore).with 'some_directory'
153
- end
154
- subject.ignore 'some_directory'
155
- end
156
- end
157
-
158
- describe '#ignore!'do
159
- it 'delegates the work to the directory record' do
160
- subject.directories_records.each do |directory_record|
161
- directory_record.should_receive(:ignore!).with 'some_directory'
162
- end
163
- subject.ignore! 'some_directory'
164
- end
165
- end
166
-
167
- describe '#filter' do
168
- it 'delegates the work to the directory record' do
169
- subject.directories_records.each do |directory_record|
170
- directory_record.should_receive(:filter).with /\.txt$/
171
- end
172
- subject.filter /\.txt$/
173
- end
174
- end
175
-
176
- describe '#filter!' do
177
- it 'delegates the work to the directory record' do
178
- subject.directories_records.each do |directory_record|
179
- directory_record.should_receive(:filter!).with /\.txt$/
180
- end
181
- subject.filter! /\.txt$/
182
- end
183
- end
184
-
185
- describe '#on_change' do
186
- let(:directories) { %w{dir1 dir2 dir3} }
187
- let(:changes) { {:modified => [], :added => [], :removed => []} }
188
- let(:callback) { Proc.new { @called = true } }
189
-
190
- before do
191
- @called = false
192
- subject.stub(:fetch_records_changes => changes)
193
- end
194
-
195
- it 'fetches the changes of all directories records' do
196
- subject.unstub(:fetch_records_changes)
197
-
198
- subject.directories_records.each do |record|
199
- record.should_receive(:fetch_changes).with(directories, an_instance_of(Hash)).and_return(changes)
200
- end
201
- subject.on_change(directories)
202
- end
203
-
204
- context "with a callback raising an exception" do
205
- let(:callback) { Proc.new { raise 'foo' } }
206
-
207
- before do
208
- subject.change(&callback)
209
- subject.stub(:fetch_records_changes => { :modified => ['foo'], :added => [], :removed => [] } )
210
- end
211
-
212
- it "stops the adapter and warns" do
213
- Kernel.should_receive(:warn).with("[Listen warning]: Change block raise an execption: foo")
214
- Kernel.should_receive(:warn).with(/^Backtrace:.*/)
215
- subject.on_change(directories)
216
- end
217
-
218
- end
219
-
220
- context 'with no changes to report' do
221
- if RUBY_VERSION[/^1.8/]
222
- it 'does not run the callback' do
223
- subject.change(&callback)
224
- subject.on_change(directories)
225
- @called.should be_false
226
- end
227
- else
228
- it 'does not run the callback' do
229
- callback.should_not_receive(:call)
230
- subject.change(&callback)
231
- subject.on_change(directories)
232
- end
233
- end
234
- end
235
-
236
- context 'with changes to report' do
237
- let(:changes) do
238
- {
239
- :modified => %w{path1}, :added => [], :removed => %w{path2}
240
- }
241
- end
242
-
243
- if RUBY_VERSION[/^1.8/]
244
- it 'runs the callback passing it the changes' do
245
- subject.change(&callback)
246
- subject.on_change(directories)
247
- @called.should be_true
248
- end
249
- else
250
- it 'runs the callback passing it the changes' do
251
- callback.should_receive(:call).with(changes[:modified], changes[:added], changes[:removed])
252
- subject.change(&callback)
253
- subject.on_change(directories)
254
- end
255
- end
256
- end
257
- end
258
- end
@@ -1,56 +0,0 @@
1
- require 'spec_helper'
2
-
3
- def run_in_two_threads(proc1, proc2)
4
- t1 = Thread.new &proc1
5
- sleep test_latency # t1 must run before t2
6
- t2 = Thread.new { proc2.call; Thread.kill t1 }
7
- t2.join(test_latency * 2)
8
- ensure
9
- Thread.kill t1 if t1
10
- Thread.kill t2 if t2
11
- end
12
-
13
- describe Listen::Turnstile do
14
- before { @called = false }
15
-
16
- describe '#wait' do
17
- context 'without a signal' do
18
- it 'blocks one thread indefinitely' do
19
- run_in_two_threads lambda {
20
- subject.wait
21
- @called = true
22
- }, lambda {
23
- sleep test_latency
24
- }
25
- @called.should be_false
26
- end
27
- end
28
-
29
- context 'with a signal' do
30
- it 'blocks one thread until it recieves a signal from another thread' do
31
- run_in_two_threads lambda {
32
- subject.wait
33
- @called = true
34
- }, lambda {
35
- subject.signal
36
- sleep test_latency
37
- }
38
- @called.should be_true
39
- end
40
- end
41
- end
42
-
43
- describe '#signal' do
44
- context 'without a wait-call before' do
45
- it 'does nothing' do
46
- run_in_two_threads lambda {
47
- subject.signal
48
- @called = true
49
- }, lambda {
50
- sleep test_latency
51
- }
52
- @called.should be_true
53
- end
54
- end
55
- end
56
- end
@@ -1,67 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Listen do
4
- describe '#to' do
5
- let(:listener) { double(Listen::Listener) }
6
- let(:listener_class) { Listen::Listener }
7
- before { listener_class.stub(:new => listener) }
8
-
9
- context 'with one path to listen to' do
10
- context 'without options' do
11
- it 'creates an instance of Listener' do
12
- listener_class.should_receive(:new).with('/path')
13
- described_class.to('/path')
14
- end
15
- end
16
-
17
- context 'with options' do
18
- it 'creates an instance of Listener with the passed params' do
19
- listener_class.should_receive(:new).with('/path', :filter => '**/*')
20
- described_class.to('/path', :filter => '**/*')
21
- end
22
- end
23
-
24
- context 'without a block' do
25
- it 'returns the listener' do
26
- described_class.to('/path', :filter => '**/*').should eq listener
27
- end
28
- end
29
-
30
- context 'with a block' do
31
- it 'starts the listener after creating it' do
32
- listener.should_receive(:start)
33
- described_class.to('/path', :filter => '**/*') { |modified, added, removed| }
34
- end
35
- end
36
- end
37
-
38
- context 'with multiple paths to listen to' do
39
- context 'without options' do
40
- it 'creates an instance of Listener' do
41
- listener_class.should_receive(:new).with('path1', 'path2')
42
- described_class.to('path1', 'path2')
43
- end
44
- end
45
-
46
- context 'with options' do
47
- it 'creates an instance of Listener with the passed params' do
48
- listener_class.should_receive(:new).with('path1', 'path2', :filter => '**/*')
49
- described_class.to('path1', 'path2', :filter => '**/*')
50
- end
51
- end
52
-
53
- context 'without a block' do
54
- it 'returns a Listener instance created with the passed params' do
55
- described_class.to('path1', 'path2', :filter => '**/*').should eq listener
56
- end
57
- end
58
-
59
- context 'with a block' do
60
- it 'starts a Listener instance after creating it with the passed params' do
61
- listener.should_receive(:start)
62
- described_class.to('path1', 'path2', :filter => '**/*') { |modified, added, removed| }
63
- end
64
- end
65
- end
66
- end
67
- end
@@ -1,25 +0,0 @@
1
- require 'rubygems'
2
- require 'coveralls'
3
- Coveralls.wear!
4
-
5
- require 'listen'
6
-
7
- Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
8
-
9
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
10
- RSpec.configure do |config|
11
- config.color_enabled = true
12
- config.order = :random
13
- config.filter_run :focus => true
14
- config.treat_symbols_as_metadata_keys_with_true_values = true
15
- config.run_all_when_everything_filtered = true
16
- config.filter_run_excluding :broken => true
17
- config.fail_fast = true
18
- end
19
-
20
- def test_latency
21
- 0.1
22
- end
23
-
24
- # Crash loud in tests!
25
- Thread.abort_on_exception = true