sass 3.3.0 → 3.4.25

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -1
  3. data/CODE_OF_CONDUCT.md +10 -0
  4. data/CONTRIBUTING.md +148 -0
  5. data/MIT-LICENSE +1 -1
  6. data/README.md +76 -62
  7. data/Rakefile +104 -24
  8. data/VERSION +1 -1
  9. data/VERSION_DATE +1 -1
  10. data/VERSION_NAME +1 -1
  11. data/bin/sass +1 -1
  12. data/bin/scss +1 -1
  13. data/extra/sass-spec-ref.sh +32 -0
  14. data/extra/update_watch.rb +1 -1
  15. data/lib/sass/cache_stores/filesystem.rb +9 -5
  16. data/lib/sass/cache_stores/memory.rb +4 -5
  17. data/lib/sass/callbacks.rb +2 -2
  18. data/lib/sass/css.rb +12 -13
  19. data/lib/sass/deprecation.rb +55 -0
  20. data/lib/sass/engine.rb +106 -70
  21. data/lib/sass/environment.rb +39 -19
  22. data/lib/sass/error.rb +17 -20
  23. data/lib/sass/exec/base.rb +199 -0
  24. data/lib/sass/exec/sass_convert.rb +283 -0
  25. data/lib/sass/exec/sass_scss.rb +440 -0
  26. data/lib/sass/exec.rb +5 -771
  27. data/lib/sass/features.rb +9 -2
  28. data/lib/sass/importers/base.rb +8 -3
  29. data/lib/sass/importers/filesystem.rb +30 -38
  30. data/lib/sass/logger/base.rb +8 -2
  31. data/lib/sass/logger/delayed.rb +50 -0
  32. data/lib/sass/logger.rb +8 -3
  33. data/lib/sass/media.rb +1 -4
  34. data/lib/sass/plugin/compiler.rb +224 -90
  35. data/lib/sass/plugin/configuration.rb +38 -22
  36. data/lib/sass/plugin/merb.rb +2 -2
  37. data/lib/sass/plugin/rack.rb +3 -3
  38. data/lib/sass/plugin/rails.rb +1 -1
  39. data/lib/sass/plugin/staleness_checker.rb +4 -4
  40. data/lib/sass/plugin.rb +6 -5
  41. data/lib/sass/script/css_lexer.rb +1 -1
  42. data/lib/sass/script/css_parser.rb +2 -3
  43. data/lib/sass/script/css_variable_warning.rb +52 -0
  44. data/lib/sass/script/functions.rb +739 -318
  45. data/lib/sass/script/lexer.rb +134 -54
  46. data/lib/sass/script/parser.rb +252 -56
  47. data/lib/sass/script/tree/funcall.rb +13 -6
  48. data/lib/sass/script/tree/interpolation.rb +127 -4
  49. data/lib/sass/script/tree/list_literal.rb +31 -4
  50. data/lib/sass/script/tree/literal.rb +4 -0
  51. data/lib/sass/script/tree/node.rb +21 -3
  52. data/lib/sass/script/tree/operation.rb +54 -1
  53. data/lib/sass/script/tree/selector.rb +26 -0
  54. data/lib/sass/script/tree/string_interpolation.rb +59 -38
  55. data/lib/sass/script/tree/variable.rb +1 -1
  56. data/lib/sass/script/tree.rb +1 -0
  57. data/lib/sass/script/value/base.rb +17 -14
  58. data/lib/sass/script/value/bool.rb +0 -5
  59. data/lib/sass/script/value/color.rb +78 -42
  60. data/lib/sass/script/value/helpers.rb +119 -2
  61. data/lib/sass/script/value/list.rb +0 -15
  62. data/lib/sass/script/value/map.rb +1 -1
  63. data/lib/sass/script/value/null.rb +0 -5
  64. data/lib/sass/script/value/number.rb +112 -31
  65. data/lib/sass/script/value/string.rb +102 -13
  66. data/lib/sass/script/value.rb +0 -1
  67. data/lib/sass/script.rb +3 -3
  68. data/lib/sass/scss/css_parser.rb +24 -4
  69. data/lib/sass/scss/parser.rb +290 -383
  70. data/lib/sass/scss/rx.rb +17 -9
  71. data/lib/sass/scss/static_parser.rb +306 -4
  72. data/lib/sass/scss.rb +0 -2
  73. data/lib/sass/selector/abstract_sequence.rb +35 -18
  74. data/lib/sass/selector/comma_sequence.rb +114 -19
  75. data/lib/sass/selector/pseudo.rb +266 -0
  76. data/lib/sass/selector/sequence.rb +146 -40
  77. data/lib/sass/selector/simple.rb +22 -33
  78. data/lib/sass/selector/simple_sequence.rb +122 -39
  79. data/lib/sass/selector.rb +57 -197
  80. data/lib/sass/shared.rb +2 -2
  81. data/lib/sass/source/map.rb +31 -14
  82. data/lib/sass/source/position.rb +4 -4
  83. data/lib/sass/stack.rb +2 -8
  84. data/lib/sass/supports.rb +10 -13
  85. data/lib/sass/tree/at_root_node.rb +1 -0
  86. data/lib/sass/tree/charset_node.rb +1 -1
  87. data/lib/sass/tree/comment_node.rb +1 -1
  88. data/lib/sass/tree/css_import_node.rb +9 -1
  89. data/lib/sass/tree/directive_node.rb +8 -2
  90. data/lib/sass/tree/error_node.rb +18 -0
  91. data/lib/sass/tree/extend_node.rb +1 -1
  92. data/lib/sass/tree/function_node.rb +9 -0
  93. data/lib/sass/tree/import_node.rb +6 -5
  94. data/lib/sass/tree/keyframe_rule_node.rb +15 -0
  95. data/lib/sass/tree/node.rb +5 -3
  96. data/lib/sass/tree/prop_node.rb +6 -7
  97. data/lib/sass/tree/rule_node.rb +26 -11
  98. data/lib/sass/tree/visitors/check_nesting.rb +56 -32
  99. data/lib/sass/tree/visitors/convert.rb +59 -44
  100. data/lib/sass/tree/visitors/cssize.rb +34 -30
  101. data/lib/sass/tree/visitors/deep_copy.rb +6 -1
  102. data/lib/sass/tree/visitors/extend.rb +15 -13
  103. data/lib/sass/tree/visitors/perform.rb +87 -50
  104. data/lib/sass/tree/visitors/set_options.rb +15 -1
  105. data/lib/sass/tree/visitors/to_css.rb +72 -43
  106. data/lib/sass/util/multibyte_string_scanner.rb +0 -2
  107. data/lib/sass/util/normalized_map.rb +0 -1
  108. data/lib/sass/util/subset_map.rb +2 -3
  109. data/lib/sass/util.rb +334 -154
  110. data/lib/sass/version.rb +7 -7
  111. data/lib/sass.rb +10 -8
  112. data/test/sass/cache_test.rb +62 -20
  113. data/test/sass/callbacks_test.rb +1 -1
  114. data/test/sass/compiler_test.rb +24 -11
  115. data/test/sass/conversion_test.rb +241 -50
  116. data/test/sass/css2sass_test.rb +73 -5
  117. data/test/sass/css_variable_test.rb +132 -0
  118. data/test/sass/encoding_test.rb +219 -0
  119. data/test/sass/engine_test.rb +343 -260
  120. data/test/sass/exec_test.rb +12 -2
  121. data/test/sass/extend_test.rb +333 -44
  122. data/test/sass/functions_test.rb +353 -260
  123. data/test/sass/importer_test.rb +40 -21
  124. data/test/sass/logger_test.rb +1 -1
  125. data/test/sass/more_results/more_import.css +1 -1
  126. data/test/sass/more_templates/more1.sass +10 -10
  127. data/test/sass/more_templates/more_import.sass +2 -2
  128. data/test/sass/plugin_test.rb +24 -21
  129. data/test/sass/results/compact.css +1 -1
  130. data/test/sass/results/complex.css +4 -4
  131. data/test/sass/results/expanded.css +1 -1
  132. data/test/sass/results/import.css +1 -1
  133. data/test/sass/results/import_charset_ibm866.css +2 -2
  134. data/test/sass/results/mixins.css +17 -17
  135. data/test/sass/results/nested.css +1 -1
  136. data/test/sass/results/parent_ref.css +2 -2
  137. data/test/sass/results/script.css +5 -5
  138. data/test/sass/results/scss_import.css +1 -1
  139. data/test/sass/script_conversion_test.rb +71 -39
  140. data/test/sass/script_test.rb +714 -123
  141. data/test/sass/scss/css_test.rb +213 -30
  142. data/test/sass/scss/rx_test.rb +8 -4
  143. data/test/sass/scss/scss_test.rb +766 -22
  144. data/test/sass/source_map_test.rb +263 -95
  145. data/test/sass/superselector_test.rb +210 -0
  146. data/test/sass/templates/_partial.sass +1 -1
  147. data/test/sass/templates/basic.sass +10 -10
  148. data/test/sass/templates/bork1.sass +1 -1
  149. data/test/sass/templates/bork5.sass +1 -1
  150. data/test/sass/templates/compact.sass +10 -10
  151. data/test/sass/templates/complex.sass +187 -187
  152. data/test/sass/templates/compressed.sass +10 -10
  153. data/test/sass/templates/expanded.sass +10 -10
  154. data/test/sass/templates/import.sass +2 -2
  155. data/test/sass/templates/importee.sass +3 -3
  156. data/test/sass/templates/mixins.sass +22 -22
  157. data/test/sass/templates/multiline.sass +4 -4
  158. data/test/sass/templates/nested.sass +13 -13
  159. data/test/sass/templates/parent_ref.sass +12 -12
  160. data/test/sass/templates/script.sass +70 -70
  161. data/test/sass/templates/scss_import.scss +2 -1
  162. data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +1 -1
  163. data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +2 -2
  164. data/test/sass/templates/subdir/subdir.sass +3 -3
  165. data/test/sass/templates/units.sass +10 -10
  166. data/test/sass/test_helper.rb +1 -1
  167. data/test/sass/util/multibyte_string_scanner_test.rb +11 -3
  168. data/test/sass/util/normalized_map_test.rb +1 -1
  169. data/test/sass/util/subset_map_test.rb +2 -2
  170. data/test/sass/util_test.rb +46 -45
  171. data/test/sass/value_helpers_test.rb +5 -7
  172. data/test/sass-spec.yml +3 -0
  173. data/test/test_helper.rb +7 -6
  174. data/vendor/listen/CHANGELOG.md +1 -228
  175. data/vendor/listen/Gemfile +5 -15
  176. data/vendor/listen/README.md +111 -77
  177. data/vendor/listen/Rakefile +0 -42
  178. data/vendor/listen/lib/listen/adapter.rb +195 -82
  179. data/vendor/listen/lib/listen/adapters/bsd.rb +27 -64
  180. data/vendor/listen/lib/listen/adapters/darwin.rb +21 -58
  181. data/vendor/listen/lib/listen/adapters/linux.rb +23 -55
  182. data/vendor/listen/lib/listen/adapters/polling.rb +25 -34
  183. data/vendor/listen/lib/listen/adapters/windows.rb +50 -46
  184. data/vendor/listen/lib/listen/directory_record.rb +96 -61
  185. data/vendor/listen/lib/listen/listener.rb +135 -37
  186. data/vendor/listen/lib/listen/turnstile.rb +9 -5
  187. data/vendor/listen/lib/listen/version.rb +1 -1
  188. data/vendor/listen/lib/listen.rb +33 -19
  189. data/vendor/listen/listen.gemspec +6 -0
  190. data/vendor/listen/spec/listen/adapter_spec.rb +43 -77
  191. data/vendor/listen/spec/listen/adapters/polling_spec.rb +8 -8
  192. data/vendor/listen/spec/listen/directory_record_spec.rb +81 -56
  193. data/vendor/listen/spec/listen/listener_spec.rb +128 -39
  194. data/vendor/listen/spec/listen_spec.rb +15 -21
  195. data/vendor/listen/spec/spec_helper.rb +4 -0
  196. data/vendor/listen/spec/support/adapter_helper.rb +52 -15
  197. data/vendor/listen/spec/support/directory_record_helper.rb +7 -5
  198. data/vendor/listen/spec/support/listeners_helper.rb +30 -7
  199. metadata +310 -300
  200. data/CONTRIBUTING +0 -3
  201. data/ext/mkrf_conf.rb +0 -27
  202. data/lib/sass/script/value/deprecated_false.rb +0 -55
  203. data/lib/sass/scss/script_lexer.rb +0 -15
  204. data/lib/sass/scss/script_parser.rb +0 -25
  205. data/vendor/listen/lib/listen/dependency_manager.rb +0 -126
  206. data/vendor/listen/lib/listen/multi_listener.rb +0 -143
  207. data/vendor/listen/spec/listen/dependency_manager_spec.rb +0 -107
  208. data/vendor/listen/spec/listen/multi_listener_spec.rb +0 -174
@@ -4,13 +4,24 @@
4
4
  # @param [String] path the path to watch
5
5
  #
6
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)
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 = Proc.new { sleep(10); puts "Forcing stop"; @adapter.stop; forced_stop = true }
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(false)
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
- context 'with the blocking param set to true' do
38
- it 'blocks the current thread after starting the workers' do
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(true); @called = true }
62
+ t = Thread.new { subject.start; @called = true }
41
63
  sleep(test_latency * 3)
42
64
  Thread.kill(t) if t
43
- @called.should be_false
65
+ @called.should be_true
44
66
  end
45
67
  end
68
+ end
46
69
 
47
- context 'with the blocking param set to false' do
48
- it 'does not block the current thread after starting the workers' do
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(false); @called = true }
87
+ t = Thread.new { subject.start!; @called = true }
51
88
  sleep(test_latency * 3)
52
89
  Thread.kill(t) if t
53
- @called.should be_true
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(false); subject.stop }
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(false) }
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) { mock(Listen::Listener) }
123
+ let(:listener) { double(Listen::Listener) }
87
124
  before { described_class.stub(:works?) { true } }
88
125
 
89
126
  context 'single file operations' do
@@ -24,7 +24,7 @@ def changes(root_path, options = {})
24
24
  paths = options.delete(:paths) || [root_path]
25
25
  options[:recursive] = true if options[:recursive].nil?
26
26
 
27
- changes = @record.fetch_changes(paths, {:relative_paths => true}.merge(options))
27
+ changes = @record.fetch_changes(paths, { :relative_paths => true }.merge(options))
28
28
 
29
29
  [changes[:modified], changes[:added], changes[:removed]]
30
30
  end
@@ -32,14 +32,15 @@ end
32
32
  # Generates a small time difference before performing a time sensitive
33
33
  # task (like comparing mtimes of files).
34
34
  #
35
- # @note Modification time for files only includes the milliseconds on Linux with MRI > 1.9.2,
35
+ # @note Modification time for files only includes the milliseconds on Linux with MRI > 1.9.2
36
+ # and platform that support it (OS X 10.8 not included),
36
37
  # that's why we generate a difference that's greater than 1 second.
37
38
  #
38
39
  def small_time_difference
39
40
  t = Time.now
40
41
  diff = t.to_f - t.to_i
41
42
 
42
- sleep( 1.5 - (diff < 0.5 ? diff : 0.4) )
43
+ sleep(1.05 - diff)
43
44
  end
44
45
 
45
46
  # Ensures that the test runs at almost the same second at which
@@ -49,7 +50,8 @@ def ensure_same_second
49
50
  t = Time.now
50
51
  diff = t.to_f - t.to_i
51
52
 
52
- if diff > 0.1 # We are not at the beginning of a second
53
- sleep 1.1 - diff # 1.1 is used instead of 1 to account for the processing time (estimated at 0.1 sec)
53
+ # We are not at the end of a second
54
+ if diff >= (1 - Listen::Adapter::DEFAULT_LATENCY)
55
+ sleep(1.05 - diff)
54
56
  end
55
57
  end
@@ -9,14 +9,37 @@ shared_examples_for 'a listener to changes on a file-system' do
9
9
  subject.start
10
10
  end
11
11
 
12
- context 'with the blocking param set to false' do
13
- it 'passes the blocking param to the adapter' do
14
- adapter.should_receive(:start).with(false)
12
+ context 'with the blocking deprecated param set to true' do
13
+ it 'displays a deprecation notice' do
14
+ Kernel.should_receive(:warn).with(/#{Listen::Listener::BLOCKING_PARAMETER_DEPRECATION_MESSAGE}/)
15
+ subject.start(true)
16
+ end
17
+ end
18
+
19
+ context 'with the blocking deprecated param set to false' do
20
+ it 'displays a deprecation notice' do
21
+ Kernel.should_receive(:warn).with(/#{Listen::Listener::BLOCKING_PARAMETER_DEPRECATION_MESSAGE}/)
15
22
  subject.start(false)
16
23
  end
17
24
  end
18
25
  end
19
26
 
27
+ describe '#start!' do
28
+ before do
29
+ subject.stub(:initialize_adapter) { adapter }
30
+ end
31
+
32
+ it 'starts the adapter' do
33
+ adapter.should_receive(:start!)
34
+ subject.start!
35
+ end
36
+
37
+ it 'passes the blocking param to the adapter' do
38
+ adapter.should_receive(:start!)
39
+ subject.start!
40
+ end
41
+ end
42
+
20
43
  context 'with a started listener' do
21
44
  before do
22
45
  subject.start
@@ -31,7 +54,7 @@ shared_examples_for 'a listener to changes on a file-system' do
31
54
 
32
55
  describe '#pause' do
33
56
  it 'sets adapter.paused to true' do
34
- adapter.should_receive(:paused=).with(true)
57
+ adapter.should_receive(:pause)
35
58
  subject.pause
36
59
  end
37
60
 
@@ -42,7 +65,7 @@ shared_examples_for 'a listener to changes on a file-system' do
42
65
 
43
66
  describe '#unpause' do
44
67
  it 'sets adapter.paused to false' do
45
- adapter.should_receive(:paused=).with(false)
68
+ adapter.should_receive(:unpause)
46
69
  subject.unpause
47
70
  end
48
71
 
@@ -58,12 +81,12 @@ shared_examples_for 'a listener to changes on a file-system' do
58
81
  end
59
82
 
60
83
  it 'returns true when adapter is paused' do
61
- adapter.should_receive(:paused) { true }
84
+ adapter.should_receive(:paused?) { true }
62
85
  subject.should be_paused
63
86
  end
64
87
 
65
88
  it 'returns false when adapter is not paused' do
66
- adapter.should_receive(:paused) { false }
89
+ adapter.should_receive(:paused?) { false }
67
90
  subject.should_not be_paused
68
91
  end
69
92
  end