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
data/lib/sass/plugin/listener.rb
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
# A wrapper around the Listen gem. Adds support for listening to individual
|
2
|
-
# files, as well as a somewhat cleaner event dispatch API.
|
3
|
-
#
|
4
|
-
# @private
|
5
|
-
class Sass::Plugin::Listener
|
6
|
-
def initialize
|
7
|
-
@directories = {}
|
8
|
-
yield self
|
9
|
-
begin
|
10
|
-
start!
|
11
|
-
rescue Exception => e
|
12
|
-
raise e unless e.is_a?(Interrupt)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
def directory(path, events)
|
17
|
-
(@directories[File.expand_path(path)] ||= []) << events
|
18
|
-
end
|
19
|
-
|
20
|
-
def file(path, events)
|
21
|
-
file_base = File.basename(path)
|
22
|
-
directory(File.dirname(path), {
|
23
|
-
:modified => file_event_fn(events[:modified], file_base),
|
24
|
-
:added => file_event_fn(events[:added], file_base),
|
25
|
-
:removed => file_event_fn(events[:removed], file_base)
|
26
|
-
})
|
27
|
-
end
|
28
|
-
|
29
|
-
def start!
|
30
|
-
args = @directories.keys.dup
|
31
|
-
args << {:force_polling => Sass::Util.windows?}
|
32
|
-
listener = Listen::MultiListener.new(*args) do |modified, added, removed|
|
33
|
-
modified = modified.group_by {|path| File.dirname(path)}
|
34
|
-
added = added.group_by {|path| File.dirname(path)}
|
35
|
-
removed = removed.group_by {|path| File.dirname(path)}
|
36
|
-
|
37
|
-
@directories.each do |dir, events|
|
38
|
-
events.each do |e|
|
39
|
-
run_events(modified[dir], e[:modified], dir)
|
40
|
-
run_events(added[dir], e[:added], dir)
|
41
|
-
run_events(removed[dir], e[:removed], dir)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end.start
|
45
|
-
end
|
46
|
-
|
47
|
-
private
|
48
|
-
|
49
|
-
def file_event_fn(event, file_base)
|
50
|
-
lambda do |dir, base|
|
51
|
-
next unless event
|
52
|
-
next unless base == file_base
|
53
|
-
event.call
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
def run_events(paths, event, path)
|
58
|
-
return if paths.nil? || event.nil?
|
59
|
-
paths.each {|p| event[File.dirname(p), File.basename(p)]}
|
60
|
-
end
|
61
|
-
end
|