sass 3.3.0 → 3.3.1
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/VERSION_DATE +1 -1
- data/lib/sass/importers/filesystem.rb +3 -3
- data/lib/sass/plugin/compiler.rb +95 -52
- data/lib/sass/script/functions.rb +1 -1
- data/lib/sass/source/map.rb +3 -3
- data/lib/sass/util.rb +16 -1
- data/vendor/listen/CHANGELOG.md +175 -35
- data/vendor/listen/Gemfile +5 -15
- data/vendor/listen/README.md +111 -77
- data/vendor/listen/Rakefile +0 -42
- data/vendor/listen/lib/listen.rb +33 -19
- data/vendor/listen/lib/listen/adapter.rb +193 -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/listen.gemspec +6 -0
- data/vendor/listen/spec/listen/adapter_spec.rb +37 -82
- 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 +3 -23
- data/ext/mkrf_conf.rb +0 -27
- 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
@@ -1,64 +1,131 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Listen::Listener do
|
4
|
-
let(:adapter)
|
5
|
-
let(:
|
6
|
-
|
7
|
-
subject { described_class.new(watched_directory) }
|
4
|
+
let(:adapter) { double(Listen::Adapter, :start => true).as_null_object }
|
5
|
+
let(:watched_directories) { [File.dirname(__FILE__), File.expand_path('../..', __FILE__)] }
|
8
6
|
|
9
7
|
before do
|
10
8
|
Listen::Adapter.stub(:select_and_initialize) { adapter }
|
11
9
|
# Don't build a record of the files inside the base directory.
|
12
|
-
|
10
|
+
Listen::DirectoryRecord.any_instance.stub(:build)
|
11
|
+
Kernel.stub(:warn)
|
13
12
|
end
|
13
|
+
subject { described_class.new(watched_directories) }
|
14
14
|
|
15
15
|
it_should_behave_like 'a listener to changes on a file-system'
|
16
16
|
|
17
17
|
describe '#initialize' do
|
18
|
-
context '
|
19
|
-
|
20
|
-
|
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]
|
21
25
|
end
|
22
26
|
|
23
|
-
|
24
|
-
|
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
|
25
78
|
end
|
79
|
+
end
|
26
80
|
|
27
|
-
|
28
|
-
|
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)]
|
29
85
|
end
|
30
86
|
end
|
31
87
|
|
32
88
|
context 'with custom options' do
|
33
|
-
|
34
|
-
|
89
|
+
let(:watched_directory) { File.dirname(__FILE__) }
|
90
|
+
let(:adapter_class) { double('adapter class') }
|
35
91
|
|
36
|
-
|
37
|
-
|
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
|
+
}
|
38
98
|
end
|
99
|
+
subject { described_class.new(watched_directory, options) }
|
39
100
|
|
40
|
-
it 'passes the custom
|
41
|
-
subject.
|
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
|
42
105
|
end
|
43
106
|
|
44
|
-
it '
|
45
|
-
subject.
|
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
|
46
111
|
end
|
47
112
|
|
48
113
|
it 'sets adapter_options' do
|
49
|
-
subject.instance_variable_get(:@adapter_options).should eq(:latency => 0.5, :force_polling => true)
|
114
|
+
subject.instance_variable_get(:@adapter_options).should eq(:latency => 0.5, :force_polling => true, :force_adapter => adapter_class)
|
50
115
|
end
|
51
116
|
end
|
52
117
|
end
|
53
118
|
|
54
119
|
describe '#start' do
|
55
120
|
it 'selects and initializes an adapter' do
|
56
|
-
Listen::Adapter.should_receive(:select_and_initialize).with(
|
121
|
+
Listen::Adapter.should_receive(:select_and_initialize).with(watched_directories, {}) { adapter }
|
57
122
|
subject.start
|
58
123
|
end
|
59
124
|
|
60
125
|
it 'builds the directory record' do
|
61
|
-
subject.directory_record
|
126
|
+
subject.directories_records.each do |directory_record|
|
127
|
+
directory_record.should_receive(:build)
|
128
|
+
end
|
62
129
|
subject.start
|
63
130
|
end
|
64
131
|
end
|
@@ -71,7 +138,9 @@ describe Listen::Listener do
|
|
71
138
|
|
72
139
|
describe '#unpause' do
|
73
140
|
it 'rebuilds the directory record' do
|
74
|
-
subject.directory_record
|
141
|
+
subject.directories_records.each do |directory_record|
|
142
|
+
directory_record.should_receive(:build)
|
143
|
+
end
|
75
144
|
subject.unpause
|
76
145
|
end
|
77
146
|
end
|
@@ -79,33 +148,40 @@ describe Listen::Listener do
|
|
79
148
|
|
80
149
|
describe '#ignore'do
|
81
150
|
it 'delegates the work to the directory record' do
|
82
|
-
subject.
|
151
|
+
subject.directories_records.each do |directory_record|
|
152
|
+
directory_record.should_receive(:ignore).with 'some_directory'
|
153
|
+
end
|
83
154
|
subject.ignore 'some_directory'
|
84
155
|
end
|
85
156
|
end
|
86
157
|
|
87
158
|
describe '#ignore!'do
|
88
159
|
it 'delegates the work to the directory record' do
|
89
|
-
subject.
|
160
|
+
subject.directories_records.each do |directory_record|
|
161
|
+
directory_record.should_receive(:ignore!).with 'some_directory'
|
162
|
+
end
|
90
163
|
subject.ignore! 'some_directory'
|
91
164
|
end
|
92
165
|
end
|
93
166
|
|
94
167
|
describe '#filter' do
|
95
168
|
it 'delegates the work to the directory record' do
|
96
|
-
subject.
|
169
|
+
subject.directories_records.each do |directory_record|
|
170
|
+
directory_record.should_receive(:filter).with /\.txt$/
|
171
|
+
end
|
97
172
|
subject.filter /\.txt$/
|
98
173
|
end
|
99
174
|
end
|
100
175
|
|
101
176
|
describe '#filter!' do
|
102
177
|
it 'delegates the work to the directory record' do
|
103
|
-
subject.
|
178
|
+
subject.directories_records.each do |directory_record|
|
179
|
+
directory_record.should_receive(:filter!).with /\.txt$/
|
180
|
+
end
|
104
181
|
subject.filter! /\.txt$/
|
105
182
|
end
|
106
183
|
end
|
107
184
|
|
108
|
-
|
109
185
|
describe '#on_change' do
|
110
186
|
let(:directories) { %w{dir1 dir2 dir3} }
|
111
187
|
let(:changes) { {:modified => [], :added => [], :removed => []} }
|
@@ -113,23 +189,32 @@ describe Listen::Listener do
|
|
113
189
|
|
114
190
|
before do
|
115
191
|
@called = false
|
116
|
-
subject.
|
192
|
+
subject.stub(:fetch_records_changes => changes)
|
117
193
|
end
|
118
194
|
|
119
|
-
it 'fetches the changes of
|
120
|
-
subject.
|
121
|
-
|
122
|
-
|
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
|
123
201
|
subject.on_change(directories)
|
124
202
|
end
|
125
203
|
|
126
|
-
context
|
127
|
-
|
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
|
128
211
|
|
129
|
-
it
|
130
|
-
|
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:.*/)
|
131
215
|
subject.on_change(directories)
|
132
216
|
end
|
217
|
+
|
133
218
|
end
|
134
219
|
|
135
220
|
context 'with no changes to report' do
|
@@ -149,7 +234,11 @@ describe Listen::Listener do
|
|
149
234
|
end
|
150
235
|
|
151
236
|
context 'with changes to report' do
|
152
|
-
let(:changes)
|
237
|
+
let(:changes) do
|
238
|
+
{
|
239
|
+
:modified => %w{path1}, :added => [], :removed => %w{path2}
|
240
|
+
}
|
241
|
+
end
|
153
242
|
|
154
243
|
if RUBY_VERSION[/^1.8/]
|
155
244
|
it 'runs the callback passing it the changes' do
|
@@ -2,21 +2,20 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Listen do
|
4
4
|
describe '#to' do
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
before { listener_class.stub(:new => listener) }
|
5
|
+
let(:listener) { double(Listen::Listener) }
|
6
|
+
let(:listener_class) { Listen::Listener }
|
7
|
+
before { listener_class.stub(:new => listener) }
|
10
8
|
|
9
|
+
context 'with one path to listen to' do
|
11
10
|
context 'without options' do
|
12
|
-
it 'creates an instance of
|
11
|
+
it 'creates an instance of Listener' do
|
13
12
|
listener_class.should_receive(:new).with('/path')
|
14
13
|
described_class.to('/path')
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
18
17
|
context 'with options' do
|
19
|
-
it 'creates an instance of
|
18
|
+
it 'creates an instance of Listener with the passed params' do
|
20
19
|
listener_class.should_receive(:new).with('/path', :filter => '**/*')
|
21
20
|
described_class.to('/path', :filter => '**/*')
|
22
21
|
end
|
@@ -29,7 +28,7 @@ describe Listen do
|
|
29
28
|
end
|
30
29
|
|
31
30
|
context 'with a block' do
|
32
|
-
it 'starts the
|
31
|
+
it 'starts the listener after creating it' do
|
33
32
|
listener.should_receive(:start)
|
34
33
|
described_class.to('/path', :filter => '**/*') { |modified, added, removed| }
|
35
34
|
end
|
@@ -37,34 +36,29 @@ describe Listen do
|
|
37
36
|
end
|
38
37
|
|
39
38
|
context 'with multiple paths to listen to' do
|
40
|
-
let(:multi_listener) { mock(Listen::MultiListener) }
|
41
|
-
let(:multi_listener_class) { Listen::MultiListener }
|
42
|
-
|
43
|
-
before { multi_listener_class.stub(:new => multi_listener) }
|
44
|
-
|
45
39
|
context 'without options' do
|
46
|
-
it 'creates an instance of
|
47
|
-
|
40
|
+
it 'creates an instance of Listener' do
|
41
|
+
listener_class.should_receive(:new).with('path1', 'path2')
|
48
42
|
described_class.to('path1', 'path2')
|
49
43
|
end
|
50
44
|
end
|
51
45
|
|
52
46
|
context 'with options' do
|
53
|
-
it 'creates an instance of
|
54
|
-
|
47
|
+
it 'creates an instance of Listener with the passed params' do
|
48
|
+
listener_class.should_receive(:new).with('path1', 'path2', :filter => '**/*')
|
55
49
|
described_class.to('path1', 'path2', :filter => '**/*')
|
56
50
|
end
|
57
51
|
end
|
58
52
|
|
59
53
|
context 'without a block' do
|
60
|
-
it 'returns a
|
61
|
-
described_class.to('path1', 'path2', :filter => '**/*').should eq
|
54
|
+
it 'returns a Listener instance created with the passed params' do
|
55
|
+
described_class.to('path1', 'path2', :filter => '**/*').should eq listener
|
62
56
|
end
|
63
57
|
end
|
64
58
|
|
65
59
|
context 'with a block' do
|
66
|
-
it 'starts a
|
67
|
-
|
60
|
+
it 'starts a Listener instance after creating it with the passed params' do
|
61
|
+
listener.should_receive(:start)
|
68
62
|
described_class.to('path1', 'path2', :filter => '**/*') { |modified, added, removed| }
|
69
63
|
end
|
70
64
|
end
|
@@ -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
|