sass 3.2.0.alpha.104 → 3.2.0.alpha.236
Sign up to get free protection for your applications and to get access to all the features.
- data/REVISION +1 -1
- data/Rakefile +2 -2
- data/VERSION +1 -1
- data/lib/sass/engine.rb +8 -1
- data/lib/sass/exec.rb +2 -2
- data/lib/sass/plugin/compiler.rb +51 -43
- data/lib/sass/script/color.rb +4 -9
- data/lib/sass/script/funcall.rb +11 -2
- data/lib/sass/script/functions.rb +16 -30
- data/lib/sass/script/lexer.rb +7 -1
- data/lib/sass/script/list.rb +2 -2
- data/lib/sass/script/literal.rb +8 -0
- data/lib/sass/script/null.rb +34 -0
- data/lib/sass/script/operation.rb +4 -0
- data/lib/sass/script/parser.rb +4 -2
- data/lib/sass/scss/parser.rb +1 -5
- data/lib/sass/scss/rx.rb +1 -1
- data/lib/sass/tree/directive_node.rb +5 -0
- data/lib/sass/tree/media_node.rb +3 -0
- data/lib/sass/tree/prop_node.rb +7 -3
- data/lib/sass/tree/visitors/base.rb +1 -1
- data/lib/sass/tree/visitors/check_nesting.rb +21 -18
- data/lib/sass/tree/visitors/convert.rb +1 -0
- data/lib/sass/tree/visitors/perform.rb +3 -2
- data/lib/sass/tree/visitors/to_css.rb +1 -0
- data/lib/sass/util.rb +28 -0
- data/test/sass/conversion_test.rb +33 -0
- data/test/sass/engine_test.rb +118 -3
- data/test/sass/functions_test.rb +56 -24
- data/test/sass/script_test.rb +60 -4
- data/test/sass/scss/scss_test.rb +10 -0
- data/vendor/listen/CHANGELOG.md +19 -1
- data/vendor/listen/README.md +27 -12
- data/vendor/listen/lib/listen/adapter.rb +9 -1
- data/vendor/listen/lib/listen/adapters/linux.rb +18 -7
- data/vendor/listen/lib/listen/adapters/windows.rb +7 -8
- data/vendor/listen/lib/listen/directory_record.rb +108 -48
- data/vendor/listen/lib/listen/listener.rb +28 -11
- data/vendor/listen/lib/listen/multi_listener.rb +6 -6
- data/vendor/listen/lib/listen/version.rb +1 -1
- data/vendor/listen/spec/listen/adapters/linux_spec.rb +11 -0
- data/vendor/listen/spec/listen/directory_record_spec.rb +268 -41
- data/vendor/listen/spec/listen/listener_spec.rb +8 -4
- data/vendor/listen/spec/listen/multi_listener_spec.rb +9 -4
- data/vendor/listen/spec/support/adapter_helper.rb +178 -0
- data/vendor/listen/spec/support/directory_record_helper.rb +24 -4
- data/vendor/listen/spec/support/listeners_helper.rb +11 -0
- metadata +11 -11
- data/lib/sass/plugin/listener.rb +0 -61
@@ -1,21 +1,34 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Listen::DirectoryRecord do
|
4
|
-
let(:base_directory) {
|
4
|
+
let(:base_directory) { File.dirname(__FILE__) }
|
5
5
|
|
6
6
|
subject { described_class.new(base_directory) }
|
7
7
|
|
8
|
+
describe '.generate_default_ignoring_patterns' do
|
9
|
+
it 'creates regexp patterns from the default ignored directories and extensions' do
|
10
|
+
described_class.generate_default_ignoring_patterns.should include(
|
11
|
+
%r{^(?:\.rbx|\.bundle|\.git|\.svn|log|tmp|vendor)/},
|
12
|
+
%r{(?:\.DS_Store)$}
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'memoizes the generated results' do
|
17
|
+
described_class.generate_default_ignoring_patterns.should equal described_class.generate_default_ignoring_patterns
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
8
21
|
describe '#initialize' do
|
9
22
|
it 'sets the base directory' do
|
10
23
|
subject.directory.should eq base_directory
|
11
24
|
end
|
12
25
|
|
13
|
-
it 'sets the default
|
14
|
-
subject.
|
26
|
+
it 'sets the default ignoring patterns' do
|
27
|
+
subject.ignoring_patterns.should =~ described_class.generate_default_ignoring_patterns
|
15
28
|
end
|
16
29
|
|
17
|
-
it 'sets the default
|
18
|
-
subject.
|
30
|
+
it 'sets the default filtering patterns' do
|
31
|
+
subject.filtering_patterns.should eq []
|
19
32
|
end
|
20
33
|
|
21
34
|
it 'raises an error when the passed path does not exist' do
|
@@ -29,39 +42,76 @@ describe Listen::DirectoryRecord do
|
|
29
42
|
|
30
43
|
describe '#ignore' do
|
31
44
|
it 'adds the passed paths to the list of ignoted paths in the record' do
|
32
|
-
subject.ignore(
|
33
|
-
subject.
|
45
|
+
subject.ignore(%r{^\.old/}, %r{\.pid$})
|
46
|
+
subject.ignoring_patterns.should include(%r{^\.old/}, %r{\.pid$})
|
34
47
|
end
|
35
48
|
end
|
36
49
|
|
37
50
|
describe '#filter' do
|
38
51
|
it 'adds the passed regexps to the list of filters that determine the stored paths' do
|
39
52
|
subject.filter(%r{\.(?:jpe?g|gif|png)}, %r{\.(?:mp3|ogg|a3c)})
|
40
|
-
subject.
|
53
|
+
subject.filtering_patterns.should include(%r{\.(?:jpe?g|gif|png)}, %r{\.(?:mp3|ogg|a3c)})
|
41
54
|
end
|
42
55
|
end
|
43
56
|
|
44
57
|
describe '#ignored?' do
|
58
|
+
before { subject.stub(:relative_to_base) { |path| path } }
|
59
|
+
|
60
|
+
it 'tests paths relative to the base directory' do
|
61
|
+
subject.should_receive(:relative_to_base).with('file.txt')
|
62
|
+
subject.ignored?('file.txt')
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'returns true when the passed path is a default ignored path' do
|
66
|
+
subject.ignored?('tmp/some_process.pid').should be_true
|
67
|
+
subject.ignored?('dir/.DS_Store').should be_true
|
68
|
+
subject.ignored?('.git/config').should be_true
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'returns false when the passed path is not a default ignored path' do
|
72
|
+
subject.ignored?('nested/tmp/some_process.pid').should be_false
|
73
|
+
subject.ignored?('nested/.git').should be_false
|
74
|
+
subject.ignored?('dir/.DS_Store/file').should be_false
|
75
|
+
subject.ignored?('file.git').should be_false
|
76
|
+
end
|
77
|
+
|
45
78
|
it 'returns true when the passed path is ignored' do
|
46
|
-
subject.ignore(
|
47
|
-
subject.ignored?('/
|
79
|
+
subject.ignore(%r{\.pid$})
|
80
|
+
subject.ignored?('dir/some_process.pid').should be_true
|
48
81
|
end
|
49
82
|
|
50
83
|
it 'returns false when the passed path is not ignored' do
|
51
|
-
subject.ignore(
|
52
|
-
subject.ignored?('/
|
84
|
+
subject.ignore(%r{\.pid$})
|
85
|
+
subject.ignored?('dir/some_file.txt').should be_false
|
53
86
|
end
|
54
87
|
end
|
55
88
|
|
56
|
-
describe '#
|
57
|
-
|
58
|
-
|
59
|
-
|
89
|
+
describe '#filtered?' do
|
90
|
+
before { subject.stub(:relative_to_base) { |path| path } }
|
91
|
+
|
92
|
+
context 'when no filtering patterns are set' do
|
93
|
+
it 'returns true for any path' do
|
94
|
+
subject.filtered?('file.txt').should be_true
|
95
|
+
end
|
60
96
|
end
|
61
97
|
|
62
|
-
|
63
|
-
subject.filter(%r{\.(?:jpe?g|gif|png)})
|
64
|
-
|
98
|
+
context 'when filtering patterns are set' do
|
99
|
+
before { subject.filter(%r{\.(?:jpe?g|gif|png)}) }
|
100
|
+
|
101
|
+
it 'tests paths relative to the base directory' do
|
102
|
+
subject.should_receive(:relative_to_base).with('file.txt')
|
103
|
+
subject.filtered?('file.txt')
|
104
|
+
end
|
105
|
+
|
106
|
+
it 'returns true when the passed path is filtered' do
|
107
|
+
subject.filter(%r{\.(?:jpe?g|gif|png)})
|
108
|
+
subject.filtered?('dir/picture.jpeg').should be_true
|
109
|
+
end
|
110
|
+
|
111
|
+
it 'returns false when the passed path is not filtered' do
|
112
|
+
subject.filter(%r{\.(?:jpe?g|gif|png)})
|
113
|
+
subject.filtered?('dir/song.mp3').should be_false
|
114
|
+
end
|
65
115
|
end
|
66
116
|
end
|
67
117
|
|
@@ -75,9 +125,9 @@ describe Listen::DirectoryRecord do
|
|
75
125
|
record = described_class.new(path)
|
76
126
|
record.build
|
77
127
|
|
78
|
-
record.paths[path]['file.rb'].should eq 'File'
|
79
|
-
record.paths[path]['a_directory'].should eq 'Dir'
|
80
|
-
record.paths["#{path}/a_directory"]['file.txt'].should eq 'File'
|
128
|
+
record.paths[path]['file.rb'].type.should eq 'File'
|
129
|
+
record.paths[path]['a_directory'].type.should eq 'Dir'
|
130
|
+
record.paths["#{path}/a_directory"]['file.txt'].type.should eq 'File'
|
81
131
|
end
|
82
132
|
end
|
83
133
|
|
@@ -89,7 +139,7 @@ describe Listen::DirectoryRecord do
|
|
89
139
|
touch 'ignored_directory/file.txt'
|
90
140
|
|
91
141
|
record = described_class.new(path)
|
92
|
-
record.ignore
|
142
|
+
record.ignore %r{^ignored_directory/}
|
93
143
|
record.build
|
94
144
|
|
95
145
|
record.paths[path]['/a_ignored_directory'].should be_nil
|
@@ -103,7 +153,7 @@ describe Listen::DirectoryRecord do
|
|
103
153
|
touch 'ignored_file.rb'
|
104
154
|
|
105
155
|
record = described_class.new(path)
|
106
|
-
record.ignore
|
156
|
+
record.ignore %r{^ignored_file.rb$}
|
107
157
|
record.build
|
108
158
|
|
109
159
|
record.paths[path]['ignored_file.rb'].should be_nil
|
@@ -125,15 +175,26 @@ describe Listen::DirectoryRecord do
|
|
125
175
|
record.build
|
126
176
|
|
127
177
|
record.paths[path]['file.rb'].should be_nil
|
128
|
-
record.paths[path]['file.zip'].should eq 'File'
|
129
|
-
record.paths[path]['a_directory'].should eq 'Dir'
|
130
|
-
record.paths["#{path}/a_directory"]['file.txt'].should eq 'File'
|
178
|
+
record.paths[path]['file.zip'].type.should eq 'File'
|
179
|
+
record.paths[path]['a_directory'].type.should eq 'Dir'
|
180
|
+
record.paths["#{path}/a_directory"]['file.txt'].type.should eq 'File'
|
131
181
|
record.paths["#{path}/a_directory"]['file.rb'].should be_nil
|
132
182
|
end
|
133
183
|
end
|
134
184
|
end
|
135
185
|
end
|
136
186
|
|
187
|
+
describe '#relative_to_base' do
|
188
|
+
it 'removes the path of the base-directory from the passed path' do
|
189
|
+
path = 'dir/to/app/file.rb'
|
190
|
+
subject.relative_to_base(File.join(base_directory, path)).should eq path
|
191
|
+
end
|
192
|
+
|
193
|
+
it 'returns nil when the passed path is not inside the base-directory' do
|
194
|
+
subject.relative_to_base('/tmp/some_random_path').should be_nil
|
195
|
+
end
|
196
|
+
end
|
197
|
+
|
137
198
|
describe '#fetch_changes' do
|
138
199
|
context 'with single file changes' do
|
139
200
|
context 'when a file is created' do
|
@@ -211,7 +272,7 @@ describe Listen::DirectoryRecord do
|
|
211
272
|
fixtures do |path|
|
212
273
|
mkdir 'ignored_directory'
|
213
274
|
|
214
|
-
modified, added, removed = changes(path, :ignore =>
|
275
|
+
modified, added, removed = changes(path, :ignore => %r{^ignored_directory/}, :recursive => true) do
|
215
276
|
touch 'ignored_directory/new_file.rb'
|
216
277
|
end
|
217
278
|
|
@@ -225,7 +286,7 @@ describe Listen::DirectoryRecord do
|
|
225
286
|
fixtures do |path|
|
226
287
|
mkdir 'ignored_directory'
|
227
288
|
|
228
|
-
modified, added, removed = changes(path, :paths => ["#{path}/ignored_directory"], :ignore =>
|
289
|
+
modified, added, removed = changes(path, :paths => ["#{path}/ignored_directory"], :ignore => %r{^ignored_directory/}, :recursive => true) do
|
229
290
|
touch 'ignored_directory/new_file.rb'
|
230
291
|
end
|
231
292
|
|
@@ -253,6 +314,39 @@ describe Listen::DirectoryRecord do
|
|
253
314
|
end
|
254
315
|
end
|
255
316
|
end
|
317
|
+
|
318
|
+
context 'given a directory with subdirectories' do
|
319
|
+
it 'detects the added file' do
|
320
|
+
fixtures do |path|
|
321
|
+
mkdir_p 'a_directory/subdirectory'
|
322
|
+
|
323
|
+
modified, added, removed = changes(path, :recursive => true) do
|
324
|
+
touch 'a_directory/subdirectory/new_file.rb'
|
325
|
+
end
|
326
|
+
|
327
|
+
added.should =~ %w(a_directory/subdirectory/new_file.rb)
|
328
|
+
modified.should be_empty
|
329
|
+
removed.should be_empty
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
333
|
+
context 'with an ignored directory' do
|
334
|
+
it "doesn't detect added files in neither the directory nor the subdirectory" do
|
335
|
+
fixtures do |path|
|
336
|
+
mkdir_p 'ignored_directory/subdirectory'
|
337
|
+
|
338
|
+
modified, added, removed = changes(path, :ignore => %r{^ignored_directory/}, :recursive => true) do
|
339
|
+
touch 'ignored_directory/new_file.rb'
|
340
|
+
touch 'ignored_directory/subdirectory/new_file.rb'
|
341
|
+
end
|
342
|
+
|
343
|
+
added.should be_empty
|
344
|
+
modified.should be_empty
|
345
|
+
removed.should be_empty
|
346
|
+
end
|
347
|
+
end
|
348
|
+
end
|
349
|
+
end
|
256
350
|
end
|
257
351
|
|
258
352
|
context 'when a file is modified' do
|
@@ -261,7 +355,7 @@ describe Listen::DirectoryRecord do
|
|
261
355
|
touch 'existing_file.txt'
|
262
356
|
|
263
357
|
modified, added, removed = changes(path) do
|
264
|
-
sleep 1.5 # make a
|
358
|
+
sleep 1.5 # make a difference in the mtime of the file
|
265
359
|
touch 'existing_file.txt'
|
266
360
|
end
|
267
361
|
|
@@ -271,14 +365,17 @@ describe Listen::DirectoryRecord do
|
|
271
365
|
end
|
272
366
|
end
|
273
367
|
|
274
|
-
context 'during the same second' do
|
368
|
+
context 'during the same second at which we are checking for changes' do
|
275
369
|
before { ensure_same_second }
|
276
370
|
|
277
|
-
|
371
|
+
# The following test can only be run on systems that report
|
372
|
+
# modification times in milliseconds.
|
373
|
+
it 'always detects the modified file the first time', :if => described_class::HIGH_PRECISION_SUPPORTED do
|
278
374
|
fixtures do |path|
|
279
375
|
touch 'existing_file.txt'
|
280
376
|
|
281
377
|
modified, added, removed = changes(path) do
|
378
|
+
sleep 0.3 # make sure the mtime is changed a bit
|
282
379
|
touch 'existing_file.txt'
|
283
380
|
end
|
284
381
|
|
@@ -288,6 +385,23 @@ describe Listen::DirectoryRecord do
|
|
288
385
|
end
|
289
386
|
end
|
290
387
|
|
388
|
+
context '#27 - when a file is created and then checked for modifications at the same second' do
|
389
|
+
# This issue was the result of checking a file for content changes when
|
390
|
+
# the mtime and the checking time are the same. In this case there
|
391
|
+
# is no checksum saved, so the file was reported as being changed.
|
392
|
+
it ' does not report any changes' do
|
393
|
+
fixtures do |path|
|
394
|
+
touch 'a_file.rb'
|
395
|
+
|
396
|
+
modified, added, removed = changes(path)
|
397
|
+
|
398
|
+
added.should be_empty
|
399
|
+
modified.should be_empty
|
400
|
+
removed.should be_empty
|
401
|
+
end
|
402
|
+
end
|
403
|
+
end
|
404
|
+
|
291
405
|
it "doesn't detects the modified file the second time if the content haven't changed" do
|
292
406
|
fixtures do |path|
|
293
407
|
touch 'existing_file.txt'
|
@@ -306,7 +420,7 @@ describe Listen::DirectoryRecord do
|
|
306
420
|
end
|
307
421
|
end
|
308
422
|
|
309
|
-
it
|
423
|
+
it 'detects the modified file the second time if the content have changed' do
|
310
424
|
fixtures do |path|
|
311
425
|
touch 'existing_file.txt'
|
312
426
|
|
@@ -331,6 +445,7 @@ describe Listen::DirectoryRecord do
|
|
331
445
|
touch '.hidden'
|
332
446
|
|
333
447
|
modified, added, removed = changes(path) do
|
448
|
+
small_time_difference
|
334
449
|
touch '.hidden'
|
335
450
|
end
|
336
451
|
|
@@ -345,7 +460,7 @@ describe Listen::DirectoryRecord do
|
|
345
460
|
it 'does not detect the mode change' do
|
346
461
|
fixtures do |path|
|
347
462
|
touch 'run.rb'
|
348
|
-
sleep 1.5 # make a
|
463
|
+
sleep 1.5 # make a difference in the mtime of the file
|
349
464
|
|
350
465
|
modified, added, removed = changes(path) do
|
351
466
|
chmod 0777, 'run.rb'
|
@@ -366,6 +481,7 @@ describe Listen::DirectoryRecord do
|
|
366
481
|
touch 'a_directory/existing_file.txt'
|
367
482
|
|
368
483
|
modified, added, removed = changes(path, :recursive => true) do
|
484
|
+
small_time_difference
|
369
485
|
touch 'a_directory/existing_file.txt'
|
370
486
|
end
|
371
487
|
|
@@ -383,6 +499,7 @@ describe Listen::DirectoryRecord do
|
|
383
499
|
touch 'a_directory/existing_file.txt'
|
384
500
|
|
385
501
|
modified, added, removed = changes(path, :recursive => false) do
|
502
|
+
small_time_difference
|
386
503
|
touch 'a_directory/existing_file.txt'
|
387
504
|
end
|
388
505
|
|
@@ -393,6 +510,43 @@ describe Listen::DirectoryRecord do
|
|
393
510
|
end
|
394
511
|
end
|
395
512
|
end
|
513
|
+
|
514
|
+
context 'given a directory with subdirectories' do
|
515
|
+
it 'detects the modified file' do
|
516
|
+
fixtures do |path|
|
517
|
+
mkdir_p 'a_directory/subdirectory'
|
518
|
+
touch 'a_directory/subdirectory/existing_file.txt'
|
519
|
+
|
520
|
+
modified, added, removed = changes(path, :recursive => true) do
|
521
|
+
small_time_difference
|
522
|
+
touch 'a_directory/subdirectory/existing_file.txt'
|
523
|
+
end
|
524
|
+
|
525
|
+
added.should be_empty
|
526
|
+
modified.should =~ %w(a_directory/subdirectory/existing_file.txt)
|
527
|
+
removed.should be_empty
|
528
|
+
end
|
529
|
+
end
|
530
|
+
|
531
|
+
context 'with an ignored subdirectory' do
|
532
|
+
it "doesn't detect the modified files in neither the directory nor the subdirectory" do
|
533
|
+
fixtures do |path|
|
534
|
+
mkdir_p 'ignored_directory/subdirectory'
|
535
|
+
touch 'ignored_directory/existing_file.txt'
|
536
|
+
touch 'ignored_directory/subdirectory/existing_file.txt'
|
537
|
+
|
538
|
+
modified, added, removed = changes(path, :ignore => %r{^ignored_directory/}, :recursive => true) do
|
539
|
+
touch 'ignored_directory/existing_file.txt'
|
540
|
+
touch 'ignored_directory/subdirectory/existing_file.txt'
|
541
|
+
end
|
542
|
+
|
543
|
+
added.should be_empty
|
544
|
+
modified.should be_empty
|
545
|
+
removed.should be_empty
|
546
|
+
end
|
547
|
+
end
|
548
|
+
end
|
549
|
+
end
|
396
550
|
end
|
397
551
|
|
398
552
|
context 'when a file is moved' do
|
@@ -506,7 +660,43 @@ describe Listen::DirectoryRecord do
|
|
506
660
|
end
|
507
661
|
end
|
508
662
|
|
509
|
-
context '
|
663
|
+
context 'given a directory with subdirectories' do
|
664
|
+
it 'detects a file movement between two subdirectories' do
|
665
|
+
fixtures do |path|
|
666
|
+
mkdir_p 'a_directory/subdirectory'
|
667
|
+
mkdir_p 'b_directory/subdirectory'
|
668
|
+
touch 'a_directory/subdirectory/move_me.txt'
|
669
|
+
|
670
|
+
modified, added, removed = changes(path, :recursive => true) do
|
671
|
+
mv 'a_directory/subdirectory/move_me.txt', 'b_directory/subdirectory'
|
672
|
+
end
|
673
|
+
|
674
|
+
added.should =~ %w(b_directory/subdirectory/move_me.txt)
|
675
|
+
modified.should be_empty
|
676
|
+
removed.should =~ %w(a_directory/subdirectory/move_me.txt)
|
677
|
+
end
|
678
|
+
end
|
679
|
+
|
680
|
+
context 'with an ignored subdirectory' do
|
681
|
+
it "doesn't detect the file movement between subdirectories" do
|
682
|
+
fixtures do |path|
|
683
|
+
mkdir_p 'a_ignored_directory/subdirectory'
|
684
|
+
mkdir_p 'b_ignored_directory/subdirectory'
|
685
|
+
touch 'a_ignored_directory/subdirectory/move_me.txt'
|
686
|
+
|
687
|
+
modified, added, removed = changes(path, :ignore => %r{^(?:a|b)_ignored_directory/}, :recursive => true) do
|
688
|
+
mv 'a_ignored_directory/subdirectory/move_me.txt', 'b_ignored_directory/subdirectory'
|
689
|
+
end
|
690
|
+
|
691
|
+
added.should be_empty
|
692
|
+
modified.should be_empty
|
693
|
+
removed.should be_empty
|
694
|
+
end
|
695
|
+
end
|
696
|
+
end
|
697
|
+
end
|
698
|
+
|
699
|
+
context 'with all paths passed as params' do
|
510
700
|
it 'detects the file movement into the directory' do
|
511
701
|
fixtures do |path|
|
512
702
|
mkdir 'a_directory'
|
@@ -635,6 +825,42 @@ describe Listen::DirectoryRecord do
|
|
635
825
|
end
|
636
826
|
end
|
637
827
|
end
|
828
|
+
|
829
|
+
context 'given a directory with subdirectories' do
|
830
|
+
it 'detects the file removal in subdirectories' do
|
831
|
+
fixtures do |path|
|
832
|
+
mkdir_p 'a_directory/subdirectory'
|
833
|
+
touch 'a_directory/subdirectory/do_not_use.rb'
|
834
|
+
|
835
|
+
modified, added, removed = changes(path, :recursive => true) do
|
836
|
+
rm 'a_directory/subdirectory/do_not_use.rb'
|
837
|
+
end
|
838
|
+
|
839
|
+
added.should be_empty
|
840
|
+
modified.should be_empty
|
841
|
+
removed.should =~ %w(a_directory/subdirectory/do_not_use.rb)
|
842
|
+
end
|
843
|
+
end
|
844
|
+
|
845
|
+
context 'with an ignored subdirectory' do
|
846
|
+
it "doesn't detect files removals in neither the directory nor its subdirectories" do
|
847
|
+
fixtures do |path|
|
848
|
+
mkdir_p 'ignored_directory/subdirectory'
|
849
|
+
touch 'ignored_directory/do_not_use.rb'
|
850
|
+
touch 'ignored_directory/subdirectory/do_not_use.rb'
|
851
|
+
|
852
|
+
modified, added, removed = changes(path, :ignore => %r{^ignored_directory/}, :recursive => true) do
|
853
|
+
rm 'ignored_directory/do_not_use.rb'
|
854
|
+
rm 'ignored_directory/subdirectory/do_not_use.rb'
|
855
|
+
end
|
856
|
+
|
857
|
+
added.should be_empty
|
858
|
+
modified.should be_empty
|
859
|
+
removed.should be_empty
|
860
|
+
end
|
861
|
+
end
|
862
|
+
end
|
863
|
+
end
|
638
864
|
end
|
639
865
|
end
|
640
866
|
|
@@ -662,7 +888,8 @@ describe Listen::DirectoryRecord do
|
|
662
888
|
mkdir 'a_directory'
|
663
889
|
touch 'a_directory/a_file.rb'
|
664
890
|
touch 'a_directory/b_file.rb'
|
665
|
-
|
891
|
+
|
892
|
+
small_time_difference
|
666
893
|
|
667
894
|
modified, added, removed = changes(path) do
|
668
895
|
touch 'b_file.rb'
|
@@ -682,7 +909,6 @@ describe Listen::DirectoryRecord do
|
|
682
909
|
mkdir 'a_directory'
|
683
910
|
touch 'a_directory/a_file.rb'
|
684
911
|
touch 'a_directory/b_file.rb'
|
685
|
-
sleep 1.5 # make files mtime old
|
686
912
|
|
687
913
|
modified, added, removed = changes(path) do
|
688
914
|
rm 'b_file.rb'
|
@@ -751,16 +977,16 @@ describe Listen::DirectoryRecord do
|
|
751
977
|
context 'with nested paths' do
|
752
978
|
it 'detects removals without crashing - #18' do
|
753
979
|
fixtures do |path|
|
754
|
-
mkdir_p 'a_directory/
|
755
|
-
touch
|
980
|
+
mkdir_p 'a_directory/subdirectory'
|
981
|
+
touch 'a_directory/subdirectory/do_not_use.rb'
|
756
982
|
|
757
|
-
modified, added, removed = changes(path
|
983
|
+
modified, added, removed = changes(path) do
|
758
984
|
rm_r 'a_directory'
|
759
985
|
end
|
760
986
|
|
761
987
|
added.should be_empty
|
762
988
|
modified.should be_empty
|
763
|
-
removed.should =~ %w(a_directory/
|
989
|
+
removed.should =~ %w(a_directory/subdirectory/do_not_use.rb)
|
764
990
|
end
|
765
991
|
end
|
766
992
|
end
|
@@ -790,6 +1016,7 @@ describe Listen::DirectoryRecord do
|
|
790
1016
|
touch 'b_file.rb'
|
791
1017
|
|
792
1018
|
modified, added, removed = changes(path, :relative_paths => false) do
|
1019
|
+
small_time_difference
|
793
1020
|
rm 'a_file.rb'
|
794
1021
|
touch 'b_file.rb'
|
795
1022
|
touch 'c_file.rb'
|