sass 3.2.5 → 3.2.6
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.
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/bin/sass +2 -1
- data/bin/sass-convert +2 -1
- data/bin/scss +2 -1
- data/lib/sass/cache_stores/chain.rb +1 -1
- data/lib/sass/cache_stores/filesystem.rb +0 -1
- data/lib/sass/engine.rb +7 -1
- data/lib/sass/importers/filesystem.rb +1 -1
- data/lib/sass/media.rb +1 -4
- data/lib/sass/script/funcall.rb +43 -8
- data/lib/sass/script/lexer.rb +0 -2
- data/lib/sass/script/parser.rb +0 -2
- data/lib/sass/scss/parser.rb +13 -1
- data/lib/sass/selector/simple_sequence.rb +1 -1
- data/lib/sass/tree/comment_node.rb +2 -2
- data/lib/sass/tree/visitors/cssize.rb +10 -1
- data/lib/sass/tree/visitors/perform.rb +4 -2
- data/lib/sass/util.rb +54 -1
- data/lib/sass/util/multibyte_string_scanner.rb +29 -8
- data/test/sass/engine_test.rb +16 -0
- data/test/sass/extend_test.rb +15 -0
- data/test/sass/script_test.rb +3 -1
- data/vendor/listen/CHANGELOG.md +76 -2
- data/vendor/listen/CONTRIBUTING.md +38 -0
- data/vendor/listen/Gemfile +8 -1
- data/vendor/listen/Guardfile +1 -1
- data/vendor/listen/LICENSE +1 -1
- data/vendor/listen/README.md +8 -5
- data/vendor/listen/lib/listen.rb +7 -5
- data/vendor/listen/lib/listen/adapter.rb +76 -29
- data/vendor/listen/lib/listen/adapters/bsd.rb +112 -0
- data/vendor/listen/lib/listen/adapters/darwin.rb +11 -10
- data/vendor/listen/lib/listen/adapters/linux.rb +33 -30
- data/vendor/listen/lib/listen/adapters/polling.rb +2 -1
- data/vendor/listen/lib/listen/adapters/windows.rb +27 -21
- data/vendor/listen/lib/listen/dependency_manager.rb +126 -0
- data/vendor/listen/lib/listen/directory_record.rb +63 -10
- data/vendor/listen/lib/listen/listener.rb +22 -0
- data/vendor/listen/lib/listen/multi_listener.rb +22 -0
- data/vendor/listen/lib/listen/version.rb +1 -1
- data/vendor/listen/listen.gemspec +0 -4
- data/vendor/listen/spec/listen/adapter_spec.rb +45 -4
- data/vendor/listen/spec/listen/adapters/bsd_spec.rb +36 -0
- data/vendor/listen/spec/listen/adapters/darwin_spec.rb +6 -0
- data/vendor/listen/spec/listen/adapters/linux_spec.rb +6 -0
- data/vendor/listen/spec/listen/adapters/windows_spec.rb +7 -1
- data/vendor/listen/spec/listen/dependency_manager_spec.rb +107 -0
- data/vendor/listen/spec/listen/directory_record_spec.rb +91 -4
- data/vendor/listen/spec/listen/listener_spec.rb +14 -0
- data/vendor/listen/spec/listen/multi_listener_spec.rb +19 -1
- data/vendor/listen/spec/spec_helper.rb +6 -3
- data/vendor/listen/spec/support/adapter_helper.rb +125 -212
- data/vendor/listen/spec/support/listeners_helper.rb +13 -1
- data/vendor/listen/spec/support/platform_helper.rb +4 -0
- metadata +9 -3
@@ -84,6 +84,13 @@ describe Listen::Listener do
|
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
87
|
+
describe '#ignore!'do
|
88
|
+
it 'delegates the work to the directory record' do
|
89
|
+
subject.directory_record.should_receive(:ignore!).with 'some_directory'
|
90
|
+
subject.ignore! 'some_directory'
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
87
94
|
describe '#filter' do
|
88
95
|
it 'delegates the work to the directory record' do
|
89
96
|
subject.directory_record.should_receive(:filter).with /\.txt$/
|
@@ -91,6 +98,13 @@ describe Listen::Listener do
|
|
91
98
|
end
|
92
99
|
end
|
93
100
|
|
101
|
+
describe '#filter!' do
|
102
|
+
it 'delegates the work to the directory record' do
|
103
|
+
subject.directory_record.should_receive(:filter!).with /\.txt$/
|
104
|
+
subject.filter! /\.txt$/
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
94
108
|
|
95
109
|
describe '#on_change' do
|
96
110
|
let(:directories) { %w{dir1 dir2 dir3} }
|
@@ -80,7 +80,7 @@ describe Listen::MultiListener do
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
-
describe '#ignore'do
|
83
|
+
describe '#ignore' do
|
84
84
|
it 'delegates the work to each directory record' do
|
85
85
|
subject.directories_records.each do |r|
|
86
86
|
r.should_receive(:ignore).with 'some_directory'
|
@@ -89,6 +89,15 @@ describe Listen::MultiListener do
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
+
describe '#ignore!' do
|
93
|
+
it 'delegates the work to each directory record' do
|
94
|
+
subject.directories_records.each do |r|
|
95
|
+
r.should_receive(:ignore!).with 'some_directory'
|
96
|
+
end
|
97
|
+
subject.ignore! 'some_directory'
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
92
101
|
describe '#filter' do
|
93
102
|
it 'delegates the work to each directory record' do
|
94
103
|
subject.directories_records.each do |r|
|
@@ -98,6 +107,15 @@ describe Listen::MultiListener do
|
|
98
107
|
end
|
99
108
|
end
|
100
109
|
|
110
|
+
describe '#filter!' do
|
111
|
+
it 'delegates the work to each directory record' do
|
112
|
+
subject.directories_records.each do |r|
|
113
|
+
r.should_receive(:filter!).with /\.txt$/
|
114
|
+
end
|
115
|
+
subject.filter! /\.txt$/
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
101
119
|
describe '#on_change' do
|
102
120
|
let(:directories) { %w{dir1 dir2 dir3} }
|
103
121
|
let(:changes) { {:modified => [], :added => [], :removed => []} }
|
@@ -1,7 +1,5 @@
|
|
1
1
|
require 'listen'
|
2
2
|
|
3
|
-
ENV["TEST_LATENCY"] ||= "0.25"
|
4
|
-
|
5
3
|
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
6
4
|
|
7
5
|
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
@@ -11,8 +9,13 @@ RSpec.configure do |config|
|
|
11
9
|
config.filter_run :focus => true
|
12
10
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
13
11
|
config.run_all_when_everything_filtered = true
|
12
|
+
config.filter_run_excluding :broken => true
|
13
|
+
config.fail_fast = true
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_latency
|
17
|
-
|
17
|
+
0.1
|
18
18
|
end
|
19
|
+
|
20
|
+
# Crash loud in tests!
|
21
|
+
Thread.abort_on_exception = true
|
@@ -3,18 +3,29 @@
|
|
3
3
|
# @param [Listen::Listener] listener the adapter listener
|
4
4
|
# @param [String] path the path to watch
|
5
5
|
#
|
6
|
-
def watch(listener, *paths)
|
7
|
-
callback = lambda { |changed_dirs, options| @called = true; listener.on_change(changed_dirs
|
8
|
-
@adapter = Listen::Adapter.select_and_initialize(paths, { :latency => test_latency }, &callback)
|
6
|
+
def watch(listener, expected_changes, *paths)
|
7
|
+
callback = lambda { |changed_dirs, options| @called = true; listener.on_change(changed_dirs) }
|
8
|
+
@adapter = Listen::Adapter.select_and_initialize(paths, { :report_changes => false, :latency => test_latency }, &callback)
|
9
|
+
|
10
|
+
forced_stop = false
|
11
|
+
prevent_deadlock = Proc.new { sleep(10); puts "Forcing stop"; @adapter.stop; forced_stop = true }
|
12
|
+
|
9
13
|
@adapter.start(false)
|
10
14
|
|
11
15
|
yield
|
12
16
|
|
13
|
-
t = Thread.new
|
14
|
-
@adapter.
|
17
|
+
t = Thread.new(&prevent_deadlock)
|
18
|
+
@adapter.wait_for_changes(expected_changes)
|
19
|
+
|
20
|
+
unless forced_stop
|
21
|
+
Thread.kill(t)
|
22
|
+
@adapter.report_changes
|
23
|
+
end
|
15
24
|
ensure
|
16
|
-
|
17
|
-
|
25
|
+
unless forced_stop
|
26
|
+
Thread.kill(t) if t
|
27
|
+
@adapter.stop
|
28
|
+
end
|
18
29
|
end
|
19
30
|
|
20
31
|
shared_examples_for 'a filesystem adapter' do
|
@@ -61,7 +72,7 @@ shared_examples_for 'a filesystem adapter' do
|
|
61
72
|
|
62
73
|
context 'with a started adapter' do
|
63
74
|
before { subject.start(false) }
|
64
|
-
after
|
75
|
+
after { subject.stop }
|
65
76
|
|
66
77
|
it 'returns true' do
|
67
78
|
subject.should be_started
|
@@ -79,30 +90,26 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
79
90
|
context 'when a file is created' do
|
80
91
|
it 'detects the added file' do
|
81
92
|
fixtures do |path|
|
82
|
-
|
83
|
-
|
84
|
-
else
|
85
|
-
listener.should_receive(:on_change).once.with([path], {})
|
93
|
+
listener.should_receive(:on_change).once.with do |array|
|
94
|
+
array.should include(path)
|
86
95
|
end
|
87
96
|
|
88
|
-
watch(listener, path) do
|
97
|
+
watch(listener, 1, path) do
|
89
98
|
touch 'new_file.rb'
|
90
99
|
end
|
91
100
|
end
|
92
101
|
end
|
93
102
|
|
94
|
-
context 'given a symlink' do
|
103
|
+
context 'given a symlink', :unless => windows? do
|
95
104
|
it 'detects the added file' do
|
96
105
|
fixtures do |path|
|
97
|
-
|
98
|
-
|
99
|
-
else
|
100
|
-
listener.should_receive(:on_change).once.with([path], {})
|
106
|
+
listener.should_receive(:on_change).once.with do |array|
|
107
|
+
array.should include(path)
|
101
108
|
end
|
102
109
|
|
103
110
|
touch 'new_file.rb'
|
104
111
|
|
105
|
-
watch(listener, path) do
|
112
|
+
watch(listener, 1, path) do
|
106
113
|
ln_s 'new_file.rb', 'new_file_symlink.rb'
|
107
114
|
end
|
108
115
|
end
|
@@ -112,18 +119,14 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
112
119
|
context 'given a new created directory' do
|
113
120
|
it 'detects the added file' do
|
114
121
|
fixtures do |path|
|
115
|
-
|
116
|
-
|
117
|
-
else
|
118
|
-
listener.should_receive(:on_change).once.with do |array, options|
|
119
|
-
array.should =~ [path, "#{path}/a_directory"]
|
120
|
-
end
|
122
|
+
listener.should_receive(:on_change).once.with do |array|
|
123
|
+
array.should include(path, "#{path}/a_directory")
|
121
124
|
end
|
122
125
|
|
123
|
-
watch(listener, path) do
|
126
|
+
watch(listener, 2, path) do
|
124
127
|
mkdir 'a_directory'
|
125
128
|
# Needed for INotify, because of :recursive rb-inotify custom flag?
|
126
|
-
sleep 0.05
|
129
|
+
sleep 0.05
|
127
130
|
touch 'a_directory/new_file.rb'
|
128
131
|
end
|
129
132
|
end
|
@@ -133,15 +136,13 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
133
136
|
context 'given an existing directory' do
|
134
137
|
it 'detects the added file' do
|
135
138
|
fixtures do |path|
|
136
|
-
|
137
|
-
|
138
|
-
else
|
139
|
-
listener.should_receive(:on_change).once.with(["#{path}/a_directory"], {})
|
139
|
+
listener.should_receive(:on_change).once.with do |array|
|
140
|
+
array.should include("#{path}/a_directory")
|
140
141
|
end
|
141
142
|
|
142
143
|
mkdir 'a_directory'
|
143
144
|
|
144
|
-
watch(listener, path) do
|
145
|
+
watch(listener, 1, path) do
|
145
146
|
touch 'a_directory/new_file.rb'
|
146
147
|
end
|
147
148
|
end
|
@@ -151,15 +152,13 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
151
152
|
context 'given a directory with subdirectories' do
|
152
153
|
it 'detects the added file' do
|
153
154
|
fixtures do |path|
|
154
|
-
|
155
|
-
|
156
|
-
else
|
157
|
-
listener.should_receive(:on_change).once.with(["#{path}/a_directory/subdirectory"], {})
|
155
|
+
listener.should_receive(:on_change).once.with do |array|
|
156
|
+
array.should include("#{path}/a_directory/subdirectory")
|
158
157
|
end
|
159
158
|
|
160
159
|
mkdir_p 'a_directory/subdirectory'
|
161
160
|
|
162
|
-
watch(listener, path) do
|
161
|
+
watch(listener, 1, path) do
|
163
162
|
touch 'a_directory/subdirectory/new_file.rb'
|
164
163
|
end
|
165
164
|
end
|
@@ -170,33 +169,29 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
170
169
|
context 'when a file is modified' do
|
171
170
|
it 'detects the modified file' do
|
172
171
|
fixtures do |path|
|
173
|
-
|
174
|
-
|
175
|
-
else
|
176
|
-
listener.should_receive(:on_change).once.with([path], {})
|
172
|
+
listener.should_receive(:on_change).once.with do |array|
|
173
|
+
array.should include(path)
|
177
174
|
end
|
178
175
|
|
179
176
|
touch 'existing_file.txt'
|
180
177
|
|
181
|
-
watch(listener, path) do
|
178
|
+
watch(listener, 1, path) do
|
182
179
|
touch 'existing_file.txt'
|
183
180
|
end
|
184
181
|
end
|
185
182
|
end
|
186
183
|
|
187
|
-
context 'given a symlink' do
|
184
|
+
context 'given a symlink', :unless => windows? do
|
188
185
|
it 'detects the modified file' do
|
189
186
|
fixtures do |path|
|
190
|
-
|
191
|
-
|
192
|
-
else
|
193
|
-
listener.should_receive(:on_change).once.with([path], {})
|
187
|
+
listener.should_receive(:on_change).once.with do |array|
|
188
|
+
array.should include(path)
|
194
189
|
end
|
195
190
|
|
196
191
|
touch 'existing_file.rb'
|
197
192
|
ln_s 'existing_file.rb', 'existing_file_symlink.rb'
|
198
193
|
|
199
|
-
watch(listener, path) do
|
194
|
+
watch(listener, 1, path) do
|
200
195
|
touch 'existing_file.rb'
|
201
196
|
end
|
202
197
|
end
|
@@ -206,36 +201,30 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
206
201
|
context 'given a hidden file' do
|
207
202
|
it 'detects the modified file' do
|
208
203
|
fixtures do |path|
|
209
|
-
|
210
|
-
|
211
|
-
else
|
212
|
-
listener.should_receive(:on_change).once.with([path], {})
|
204
|
+
listener.should_receive(:on_change).once.with do |array|
|
205
|
+
array.should include(path)
|
213
206
|
end
|
214
207
|
|
215
208
|
touch '.hidden'
|
216
209
|
|
217
|
-
watch(listener, path) do
|
210
|
+
watch(listener, 1, path) do
|
218
211
|
touch '.hidden'
|
219
212
|
end
|
220
213
|
end
|
221
214
|
end
|
222
215
|
end
|
223
216
|
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
else
|
231
|
-
listener.should_receive(:on_change).once.with([path], {})
|
232
|
-
end
|
217
|
+
context 'given a file mode change', :unless => windows? do
|
218
|
+
it 'does not detect the mode change' do
|
219
|
+
fixtures do |path|
|
220
|
+
listener.should_receive(:on_change).once.with do |array|
|
221
|
+
array.should include(path)
|
222
|
+
end
|
233
223
|
|
234
|
-
|
224
|
+
touch 'run.rb'
|
235
225
|
|
236
|
-
|
237
|
-
|
238
|
-
end
|
226
|
+
watch(listener, 1, path) do
|
227
|
+
chmod 0777, 'run.rb'
|
239
228
|
end
|
240
229
|
end
|
241
230
|
end
|
@@ -244,16 +233,14 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
244
233
|
context 'given an existing directory' do
|
245
234
|
it 'detects the modified file' do
|
246
235
|
fixtures do |path|
|
247
|
-
|
248
|
-
|
249
|
-
else
|
250
|
-
listener.should_receive(:on_change).once.with(["#{path}/a_directory"], {})
|
236
|
+
listener.should_receive(:on_change).once.with do |array|
|
237
|
+
array.should include("#{path}/a_directory")
|
251
238
|
end
|
252
239
|
|
253
240
|
mkdir 'a_directory'
|
254
241
|
touch 'a_directory/existing_file.txt'
|
255
242
|
|
256
|
-
watch(listener, path) do
|
243
|
+
watch(listener, 1, path) do
|
257
244
|
touch 'a_directory/existing_file.txt'
|
258
245
|
end
|
259
246
|
end
|
@@ -263,16 +250,14 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
263
250
|
context 'given a directory with subdirectories' do
|
264
251
|
it 'detects the modified file' do
|
265
252
|
fixtures do |path|
|
266
|
-
|
267
|
-
|
268
|
-
else
|
269
|
-
listener.should_receive(:on_change).once.with(["#{path}/a_directory/subdirectory"], {})
|
253
|
+
listener.should_receive(:on_change).once.with do |array|
|
254
|
+
array.should include("#{path}/a_directory/subdirectory")
|
270
255
|
end
|
271
256
|
|
272
257
|
mkdir_p 'a_directory/subdirectory'
|
273
258
|
touch 'a_directory/subdirectory/existing_file.txt'
|
274
259
|
|
275
|
-
watch(listener, path) do
|
260
|
+
watch(listener, 1, path) do
|
276
261
|
touch 'a_directory/subdirectory/new_file.rb'
|
277
262
|
end
|
278
263
|
end
|
@@ -283,33 +268,29 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
283
268
|
context 'when a file is moved' do
|
284
269
|
it 'detects the file move' do
|
285
270
|
fixtures do |path|
|
286
|
-
|
287
|
-
|
288
|
-
else
|
289
|
-
listener.should_receive(:on_change).once.with([path], {})
|
271
|
+
listener.should_receive(:on_change).once.with do |array|
|
272
|
+
array.should include(path)
|
290
273
|
end
|
291
274
|
|
292
275
|
touch 'move_me.txt'
|
293
276
|
|
294
|
-
watch(listener, path) do
|
277
|
+
watch(listener, 1, path) do
|
295
278
|
mv 'move_me.txt', 'new_name.txt'
|
296
279
|
end
|
297
280
|
end
|
298
281
|
end
|
299
282
|
|
300
|
-
context 'given a symlink' do
|
283
|
+
context 'given a symlink', :unless => windows? do
|
301
284
|
it 'detects the file move' do
|
302
285
|
fixtures do |path|
|
303
|
-
|
304
|
-
|
305
|
-
else
|
306
|
-
listener.should_receive(:on_change).once.with([path], {})
|
286
|
+
listener.should_receive(:on_change).once.with do |array|
|
287
|
+
array.should include(path)
|
307
288
|
end
|
308
289
|
|
309
290
|
touch 'move_me.rb'
|
310
291
|
ln_s 'move_me.rb', 'move_me_symlink.rb'
|
311
292
|
|
312
|
-
watch(listener, path) do
|
293
|
+
watch(listener, 1, path) do
|
313
294
|
mv 'move_me_symlink.rb', 'new_symlink.rb'
|
314
295
|
end
|
315
296
|
end
|
@@ -319,18 +300,14 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
319
300
|
context 'given an existing directory' do
|
320
301
|
it 'detects the file move into the directory' do
|
321
302
|
fixtures do |path|
|
322
|
-
|
323
|
-
|
324
|
-
else
|
325
|
-
listener.should_receive(:on_change).once.with do |array, options|
|
326
|
-
array.should =~ [path, "#{path}/a_directory"]
|
327
|
-
end
|
303
|
+
listener.should_receive(:on_change).once.with do |array|
|
304
|
+
array.should include(path, "#{path}/a_directory")
|
328
305
|
end
|
329
306
|
|
330
307
|
mkdir 'a_directory'
|
331
308
|
touch 'move_me.txt'
|
332
309
|
|
333
|
-
watch(listener, path) do
|
310
|
+
watch(listener, 2, path) do
|
334
311
|
mv 'move_me.txt', 'a_directory/move_me.txt'
|
335
312
|
end
|
336
313
|
end
|
@@ -338,18 +315,14 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
338
315
|
|
339
316
|
it 'detects a file move out of the directory' do
|
340
317
|
fixtures do |path|
|
341
|
-
|
342
|
-
|
343
|
-
else
|
344
|
-
listener.should_receive(:on_change).once.with do |array, options|
|
345
|
-
array.should =~ [path, "#{path}/a_directory"]
|
346
|
-
end
|
318
|
+
listener.should_receive(:on_change).once.with do |array|
|
319
|
+
array.should include(path, "#{path}/a_directory")
|
347
320
|
end
|
348
321
|
|
349
322
|
mkdir 'a_directory'
|
350
323
|
touch 'a_directory/move_me.txt'
|
351
324
|
|
352
|
-
watch(listener, path) do
|
325
|
+
watch(listener, 2, path) do
|
353
326
|
mv 'a_directory/move_me.txt', 'i_am_here.txt'
|
354
327
|
end
|
355
328
|
end
|
@@ -357,19 +330,15 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
357
330
|
|
358
331
|
it 'detects a file move between two directories' do
|
359
332
|
fixtures do |path|
|
360
|
-
|
361
|
-
|
362
|
-
else
|
363
|
-
listener.should_receive(:on_change).once.with do |array, options|
|
364
|
-
array.should =~ ["#{path}/from_directory", "#{path}/to_directory"]
|
365
|
-
end
|
333
|
+
listener.should_receive(:on_change).once.with do |array|
|
334
|
+
array.should include("#{path}/from_directory", "#{path}/to_directory")
|
366
335
|
end
|
367
336
|
|
368
337
|
mkdir 'from_directory'
|
369
338
|
touch 'from_directory/move_me.txt'
|
370
339
|
mkdir 'to_directory'
|
371
340
|
|
372
|
-
watch(listener, path) do
|
341
|
+
watch(listener, 2, path) do
|
373
342
|
mv 'from_directory/move_me.txt', 'to_directory/move_me.txt'
|
374
343
|
end
|
375
344
|
end
|
@@ -379,19 +348,15 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
379
348
|
context 'given a directory with subdirectories' do
|
380
349
|
it 'detects files movements between subdirectories' do
|
381
350
|
fixtures do |path|
|
382
|
-
|
383
|
-
|
384
|
-
else
|
385
|
-
listener.should_receive(:on_change).once.with do |array, options|
|
386
|
-
array.should =~ ["#{path}/a_directory/subdirectory", "#{path}/b_directory/subdirectory"]
|
387
|
-
end
|
351
|
+
listener.should_receive(:on_change).once.with do |array|
|
352
|
+
array.should include("#{path}/a_directory/subdirectory", "#{path}/b_directory/subdirectory")
|
388
353
|
end
|
389
354
|
|
390
355
|
mkdir_p 'a_directory/subdirectory'
|
391
356
|
mkdir_p 'b_directory/subdirectory'
|
392
357
|
touch 'a_directory/subdirectory/move_me.txt'
|
393
358
|
|
394
|
-
watch(listener, path) do
|
359
|
+
watch(listener, 2, path) do
|
395
360
|
mv 'a_directory/subdirectory/move_me.txt', 'b_directory/subdirectory'
|
396
361
|
end
|
397
362
|
end
|
@@ -402,33 +367,29 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
402
367
|
context 'when a file is deleted' do
|
403
368
|
it 'detects the file removal' do
|
404
369
|
fixtures do |path|
|
405
|
-
|
406
|
-
|
407
|
-
else
|
408
|
-
listener.should_receive(:on_change).once.with([path], {})
|
370
|
+
listener.should_receive(:on_change).once.with do |array|
|
371
|
+
array.should include(path)
|
409
372
|
end
|
410
373
|
|
411
374
|
touch 'unnecessary.txt'
|
412
375
|
|
413
|
-
watch(listener, path) do
|
376
|
+
watch(listener, 1, path) do
|
414
377
|
rm 'unnecessary.txt'
|
415
378
|
end
|
416
379
|
end
|
417
380
|
end
|
418
381
|
|
419
|
-
context 'given a symlink' do
|
382
|
+
context 'given a symlink', :unless => windows? do
|
420
383
|
it 'detects the file removal' do
|
421
384
|
fixtures do |path|
|
422
|
-
|
423
|
-
|
424
|
-
else
|
425
|
-
listener.should_receive(:on_change).once.with([path], {})
|
385
|
+
listener.should_receive(:on_change).once.with do |array|
|
386
|
+
array.should include(path)
|
426
387
|
end
|
427
388
|
|
428
389
|
touch 'unnecessary.rb'
|
429
390
|
ln_s 'unnecessary.rb', 'unnecessary_symlink.rb'
|
430
391
|
|
431
|
-
watch(listener, path) do
|
392
|
+
watch(listener, 1, path) do
|
432
393
|
rm 'unnecessary_symlink.rb'
|
433
394
|
end
|
434
395
|
end
|
@@ -438,16 +399,14 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
438
399
|
context 'given an existing directory' do
|
439
400
|
it 'detects the file removal' do
|
440
401
|
fixtures do |path|
|
441
|
-
|
442
|
-
|
443
|
-
else
|
444
|
-
listener.should_receive(:on_change).once.with(["#{path}/a_directory"], {})
|
402
|
+
listener.should_receive(:on_change).once.with do |array|
|
403
|
+
array.should include("#{path}/a_directory")
|
445
404
|
end
|
446
405
|
|
447
406
|
mkdir 'a_directory'
|
448
407
|
touch 'a_directory/do_not_use.rb'
|
449
408
|
|
450
|
-
watch(listener, path) do
|
409
|
+
watch(listener, 1, path) do
|
451
410
|
rm 'a_directory/do_not_use.rb'
|
452
411
|
end
|
453
412
|
end
|
@@ -457,16 +416,14 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
457
416
|
context 'given a directory with subdirectories' do
|
458
417
|
it 'detects the file removal' do
|
459
418
|
fixtures do |path|
|
460
|
-
|
461
|
-
|
462
|
-
else
|
463
|
-
listener.should_receive(:on_change).once.with(["#{path}/a_directory/subdirectory"], {})
|
419
|
+
listener.should_receive(:on_change).once.with do |array|
|
420
|
+
array.should include("#{path}/a_directory/subdirectory")
|
464
421
|
end
|
465
422
|
|
466
423
|
mkdir_p 'a_directory/subdirectory'
|
467
424
|
touch 'a_directory/subdirectory/do_not_use.rb'
|
468
425
|
|
469
|
-
watch(listener, path) do
|
426
|
+
watch(listener, 1, path) do
|
470
427
|
rm 'a_directory/subdirectory/do_not_use.rb'
|
471
428
|
end
|
472
429
|
end
|
@@ -478,15 +435,11 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
478
435
|
context 'multiple file operations' do
|
479
436
|
it 'detects the added files' do
|
480
437
|
fixtures do |path|
|
481
|
-
|
482
|
-
|
483
|
-
else
|
484
|
-
listener.should_receive(:on_change).once.with do |array, options|
|
485
|
-
array.should =~ [path, "#{path}/a_directory"]
|
486
|
-
end
|
438
|
+
listener.should_receive(:on_change).once.with do |array|
|
439
|
+
array.should include(path, "#{path}/a_directory")
|
487
440
|
end
|
488
441
|
|
489
|
-
watch(listener, path) do
|
442
|
+
watch(listener, 2, path) do
|
490
443
|
touch 'a_file.rb'
|
491
444
|
touch 'b_file.rb'
|
492
445
|
mkdir 'a_directory'
|
@@ -501,12 +454,8 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
501
454
|
|
502
455
|
it 'detects the modified files' do
|
503
456
|
fixtures do |path|
|
504
|
-
|
505
|
-
|
506
|
-
else
|
507
|
-
listener.should_receive(:on_change).once.with do |array, options|
|
508
|
-
array.should =~ [path, "#{path}/a_directory"]
|
509
|
-
end
|
457
|
+
listener.should_receive(:on_change).once.with do |array|
|
458
|
+
array.should include(path, "#{path}/a_directory")
|
510
459
|
end
|
511
460
|
|
512
461
|
touch 'a_file.rb'
|
@@ -515,7 +464,7 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
515
464
|
touch 'a_directory/a_file.rb'
|
516
465
|
touch 'a_directory/b_file.rb'
|
517
466
|
|
518
|
-
watch(listener, path) do
|
467
|
+
watch(listener, 2, path) do
|
519
468
|
touch 'b_file.rb'
|
520
469
|
touch 'a_directory/a_file.rb'
|
521
470
|
end
|
@@ -524,12 +473,8 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
524
473
|
|
525
474
|
it 'detects the removed files' do
|
526
475
|
fixtures do |path|
|
527
|
-
|
528
|
-
|
529
|
-
else
|
530
|
-
listener.should_receive(:on_change).once.with do |array, options|
|
531
|
-
array.should =~ [path, "#{path}/a_directory"]
|
532
|
-
end
|
476
|
+
listener.should_receive(:on_change).once.with do |array|
|
477
|
+
array.should include(path, "#{path}/a_directory")
|
533
478
|
end
|
534
479
|
|
535
480
|
touch 'a_file.rb'
|
@@ -538,7 +483,7 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
538
483
|
touch 'a_directory/a_file.rb'
|
539
484
|
touch 'a_directory/b_file.rb'
|
540
485
|
|
541
|
-
watch(listener, path) do
|
486
|
+
watch(listener, 2, path) do
|
542
487
|
rm 'b_file.rb'
|
543
488
|
rm 'a_directory/a_file.rb'
|
544
489
|
end
|
@@ -549,17 +494,15 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
549
494
|
context 'single directory operations' do
|
550
495
|
it 'detects a moved directory' do
|
551
496
|
fixtures do |path|
|
552
|
-
|
553
|
-
|
554
|
-
else
|
555
|
-
listener.should_receive(:on_change).once.with([path], {})
|
497
|
+
listener.should_receive(:on_change).once.with do |array|
|
498
|
+
array.should include(path)
|
556
499
|
end
|
557
500
|
|
558
501
|
mkdir 'a_directory'
|
559
502
|
touch 'a_directory/a_file.rb'
|
560
503
|
touch 'a_directory/b_file.rb'
|
561
504
|
|
562
|
-
watch(listener, path) do
|
505
|
+
watch(listener, 1, path) do
|
563
506
|
mv 'a_directory', 'renamed'
|
564
507
|
end
|
565
508
|
end
|
@@ -567,19 +510,15 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
567
510
|
|
568
511
|
it 'detects a removed directory' do
|
569
512
|
fixtures do |path|
|
570
|
-
|
571
|
-
|
572
|
-
else
|
573
|
-
listener.should_receive(:on_change).once.with do |array, options|
|
574
|
-
array.should =~ [path, "#{path}/a_directory"]
|
575
|
-
end
|
513
|
+
listener.should_receive(:on_change).once.with do |array|
|
514
|
+
array.should include(path, "#{path}/a_directory")
|
576
515
|
end
|
577
516
|
|
578
517
|
mkdir 'a_directory'
|
579
518
|
touch 'a_directory/a_file.rb'
|
580
519
|
touch 'a_directory/b_file.rb'
|
581
520
|
|
582
|
-
watch(listener, path) do
|
521
|
+
watch(listener, 2, path) do
|
583
522
|
rm_rf 'a_directory'
|
584
523
|
end
|
585
524
|
end
|
@@ -590,7 +529,7 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
590
529
|
context 'when a file is created' do
|
591
530
|
it "doesn't detects the added file" do
|
592
531
|
fixtures do |path|
|
593
|
-
watch(listener, path) do
|
532
|
+
watch(listener, 1, path) do # The expected changes param is set to one!
|
594
533
|
@adapter.paused = true
|
595
534
|
touch 'new_file.rb'
|
596
535
|
end
|
@@ -604,13 +543,11 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
604
543
|
context 'when files are added to one of multiple directories' do
|
605
544
|
it 'detects added files' do
|
606
545
|
fixtures(2) do |path1, path2|
|
607
|
-
|
608
|
-
|
609
|
-
else
|
610
|
-
listener.should_receive(:on_change).once.with([path2], {})
|
546
|
+
listener.should_receive(:on_change).once.with do |array|
|
547
|
+
array.should include(path2)
|
611
548
|
end
|
612
549
|
|
613
|
-
watch(listener, path1, path2) do
|
550
|
+
watch(listener, 1, path1, path2) do
|
614
551
|
touch "#{path2}/new_file.rb"
|
615
552
|
end
|
616
553
|
end
|
@@ -620,17 +557,11 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
620
557
|
context 'when files are added to multiple directories' do
|
621
558
|
it 'detects added files' do
|
622
559
|
fixtures(2) do |path1, path2|
|
623
|
-
|
624
|
-
|
625
|
-
directories.should =~ [path1, path2] && options.should == {:recursive => true}
|
626
|
-
end
|
627
|
-
else
|
628
|
-
listener.should_receive(:on_change).once.with do |directories, options|
|
629
|
-
directories.should =~ [path1, path2] && options.should == {}
|
630
|
-
end
|
560
|
+
listener.should_receive(:on_change).once.with do |array|
|
561
|
+
array.should include(path1, path2)
|
631
562
|
end
|
632
563
|
|
633
|
-
watch(listener, path1, path2) do
|
564
|
+
watch(listener, 2, path1, path2) do
|
634
565
|
touch "#{path1}/new_file.rb"
|
635
566
|
touch "#{path2}/new_file.rb"
|
636
567
|
end
|
@@ -641,20 +572,15 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
641
572
|
context 'given a new and an existing directory on multiple directories' do
|
642
573
|
it 'detects the added file' do
|
643
574
|
fixtures(2) do |path1, path2|
|
644
|
-
|
645
|
-
|
646
|
-
directories.should =~ [path1, path2] && options.should == {:recursive => true}
|
647
|
-
end
|
648
|
-
else
|
649
|
-
listener.should_receive(:on_change).once.with do |directories, options|
|
650
|
-
directories.should =~ [path2, "#{path2}/b_directory", "#{path1}/a_directory"] && options.should == {}
|
651
|
-
end
|
575
|
+
listener.should_receive(:on_change).once.with do |array|
|
576
|
+
array.should include(path2, "#{path1}/a_directory", "#{path2}/b_directory")
|
652
577
|
end
|
653
578
|
|
654
579
|
mkdir "#{path1}/a_directory"
|
655
580
|
|
656
|
-
watch(listener, path1, path2) do
|
581
|
+
watch(listener, 3, path1, path2) do
|
657
582
|
mkdir "#{path2}/b_directory"
|
583
|
+
# Needed for INotify
|
658
584
|
sleep 0.05
|
659
585
|
touch "#{path1}/a_directory/new_file.rb"
|
660
586
|
touch "#{path2}/b_directory/new_file.rb"
|
@@ -666,21 +592,15 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
666
592
|
context 'when a file is moved between the multiple watched directories' do
|
667
593
|
it 'detects the movements of the file' do
|
668
594
|
fixtures(3) do |path1, path2, path3|
|
669
|
-
|
670
|
-
|
671
|
-
directories.should =~ [path1, path2, path3] && options.should == {:recursive => true}
|
672
|
-
end
|
673
|
-
else
|
674
|
-
listener.should_receive(:on_change).once.with do |directories, options|
|
675
|
-
directories.should =~ ["#{path1}/from_directory", path2, "#{path3}/to_directory"] && options.should == {}
|
676
|
-
end
|
595
|
+
listener.should_receive(:on_change).once.with do |array|
|
596
|
+
array.should include("#{path1}/from_directory", path2, "#{path3}/to_directory")
|
677
597
|
end
|
678
598
|
|
679
599
|
mkdir "#{path1}/from_directory"
|
680
600
|
touch "#{path1}/from_directory/move_me.txt"
|
681
601
|
mkdir "#{path3}/to_directory"
|
682
602
|
|
683
|
-
watch(listener, path1, path2, path3) do
|
603
|
+
watch(listener, 3, path1, path2, path3) do
|
684
604
|
mv "#{path1}/from_directory/move_me.txt", "#{path2}/move_me.txt"
|
685
605
|
mv "#{path2}/move_me.txt", "#{path3}/to_directory/move_me.txt"
|
686
606
|
end
|
@@ -691,20 +611,14 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
691
611
|
context 'when files are deleted from the multiple watched directories' do
|
692
612
|
it 'detects the files removal' do
|
693
613
|
fixtures(2) do |path1, path2|
|
694
|
-
|
695
|
-
|
696
|
-
directories.should =~ [path1, path2] && options.should == {:recursive => true}
|
697
|
-
end
|
698
|
-
else
|
699
|
-
listener.should_receive(:on_change).once.with do |directories, options|
|
700
|
-
directories.should =~ [path1, path2] && options.should == {}
|
701
|
-
end
|
614
|
+
listener.should_receive(:on_change).once.with do |array|
|
615
|
+
array.should include(path1, path2)
|
702
616
|
end
|
703
617
|
|
704
618
|
touch "#{path1}/unnecessary.txt"
|
705
619
|
touch "#{path2}/unnecessary.txt"
|
706
620
|
|
707
|
-
watch(listener, path1, path2) do
|
621
|
+
watch(listener, 2, path1, path2) do
|
708
622
|
rm "#{path1}/unnecessary.txt"
|
709
623
|
rm "#{path2}/unnecessary.txt"
|
710
624
|
end
|
@@ -712,5 +626,4 @@ shared_examples_for 'an adapter that call properly listener#on_change' do |*args
|
|
712
626
|
end
|
713
627
|
end
|
714
628
|
end
|
715
|
-
|
716
629
|
end
|