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.
Files changed (49) hide show
  1. data/REVISION +1 -1
  2. data/Rakefile +2 -2
  3. data/VERSION +1 -1
  4. data/lib/sass/engine.rb +8 -1
  5. data/lib/sass/exec.rb +2 -2
  6. data/lib/sass/plugin/compiler.rb +51 -43
  7. data/lib/sass/script/color.rb +4 -9
  8. data/lib/sass/script/funcall.rb +11 -2
  9. data/lib/sass/script/functions.rb +16 -30
  10. data/lib/sass/script/lexer.rb +7 -1
  11. data/lib/sass/script/list.rb +2 -2
  12. data/lib/sass/script/literal.rb +8 -0
  13. data/lib/sass/script/null.rb +34 -0
  14. data/lib/sass/script/operation.rb +4 -0
  15. data/lib/sass/script/parser.rb +4 -2
  16. data/lib/sass/scss/parser.rb +1 -5
  17. data/lib/sass/scss/rx.rb +1 -1
  18. data/lib/sass/tree/directive_node.rb +5 -0
  19. data/lib/sass/tree/media_node.rb +3 -0
  20. data/lib/sass/tree/prop_node.rb +7 -3
  21. data/lib/sass/tree/visitors/base.rb +1 -1
  22. data/lib/sass/tree/visitors/check_nesting.rb +21 -18
  23. data/lib/sass/tree/visitors/convert.rb +1 -0
  24. data/lib/sass/tree/visitors/perform.rb +3 -2
  25. data/lib/sass/tree/visitors/to_css.rb +1 -0
  26. data/lib/sass/util.rb +28 -0
  27. data/test/sass/conversion_test.rb +33 -0
  28. data/test/sass/engine_test.rb +118 -3
  29. data/test/sass/functions_test.rb +56 -24
  30. data/test/sass/script_test.rb +60 -4
  31. data/test/sass/scss/scss_test.rb +10 -0
  32. data/vendor/listen/CHANGELOG.md +19 -1
  33. data/vendor/listen/README.md +27 -12
  34. data/vendor/listen/lib/listen/adapter.rb +9 -1
  35. data/vendor/listen/lib/listen/adapters/linux.rb +18 -7
  36. data/vendor/listen/lib/listen/adapters/windows.rb +7 -8
  37. data/vendor/listen/lib/listen/directory_record.rb +108 -48
  38. data/vendor/listen/lib/listen/listener.rb +28 -11
  39. data/vendor/listen/lib/listen/multi_listener.rb +6 -6
  40. data/vendor/listen/lib/listen/version.rb +1 -1
  41. data/vendor/listen/spec/listen/adapters/linux_spec.rb +11 -0
  42. data/vendor/listen/spec/listen/directory_record_spec.rb +268 -41
  43. data/vendor/listen/spec/listen/listener_spec.rb +8 -4
  44. data/vendor/listen/spec/listen/multi_listener_spec.rb +9 -4
  45. data/vendor/listen/spec/support/adapter_helper.rb +178 -0
  46. data/vendor/listen/spec/support/directory_record_helper.rb +24 -4
  47. data/vendor/listen/spec/support/listeners_helper.rb +11 -0
  48. metadata +11 -11
  49. data/lib/sass/plugin/listener.rb +0 -61
@@ -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