sass 3.1.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. checksums.yaml +7 -0
  2. data/CONTRIBUTING +1 -1
  3. data/MIT-LICENSE +2 -2
  4. data/README.md +29 -17
  5. data/Rakefile +43 -9
  6. data/VERSION +1 -1
  7. data/VERSION_DATE +1 -0
  8. data/VERSION_NAME +1 -1
  9. data/bin/sass +6 -1
  10. data/bin/sass-convert +6 -1
  11. data/bin/scss +6 -1
  12. data/ext/mkrf_conf.rb +27 -0
  13. data/lib/sass/cache_stores/base.rb +7 -3
  14. data/lib/sass/cache_stores/chain.rb +3 -2
  15. data/lib/sass/cache_stores/filesystem.rb +5 -7
  16. data/lib/sass/cache_stores/memory.rb +1 -1
  17. data/lib/sass/cache_stores/null.rb +2 -2
  18. data/lib/sass/callbacks.rb +2 -1
  19. data/lib/sass/css.rb +168 -53
  20. data/lib/sass/engine.rb +502 -174
  21. data/lib/sass/environment.rb +151 -111
  22. data/lib/sass/error.rb +7 -7
  23. data/lib/sass/exec.rb +176 -60
  24. data/lib/sass/features.rb +40 -0
  25. data/lib/sass/importers/base.rb +46 -7
  26. data/lib/sass/importers/deprecated_path.rb +51 -0
  27. data/lib/sass/importers/filesystem.rb +113 -30
  28. data/lib/sass/importers.rb +1 -0
  29. data/lib/sass/logger/base.rb +30 -0
  30. data/lib/sass/logger/log_level.rb +45 -0
  31. data/lib/sass/logger.rb +12 -0
  32. data/lib/sass/media.rb +213 -0
  33. data/lib/sass/plugin/compiler.rb +194 -104
  34. data/lib/sass/plugin/configuration.rb +18 -25
  35. data/lib/sass/plugin/merb.rb +1 -1
  36. data/lib/sass/plugin/staleness_checker.rb +37 -11
  37. data/lib/sass/plugin.rb +10 -13
  38. data/lib/sass/railtie.rb +2 -1
  39. data/lib/sass/repl.rb +5 -6
  40. data/lib/sass/script/css_lexer.rb +8 -4
  41. data/lib/sass/script/css_parser.rb +5 -2
  42. data/lib/sass/script/functions.rb +1547 -618
  43. data/lib/sass/script/lexer.rb +122 -72
  44. data/lib/sass/script/parser.rb +304 -135
  45. data/lib/sass/script/tree/funcall.rb +306 -0
  46. data/lib/sass/script/{interpolation.rb → tree/interpolation.rb} +43 -13
  47. data/lib/sass/script/tree/list_literal.rb +77 -0
  48. data/lib/sass/script/tree/literal.rb +45 -0
  49. data/lib/sass/script/tree/map_literal.rb +64 -0
  50. data/lib/sass/script/{node.rb → tree/node.rb} +30 -12
  51. data/lib/sass/script/{operation.rb → tree/operation.rb} +33 -21
  52. data/lib/sass/script/{string_interpolation.rb → tree/string_interpolation.rb} +14 -4
  53. data/lib/sass/script/{unary_operation.rb → tree/unary_operation.rb} +21 -9
  54. data/lib/sass/script/tree/variable.rb +57 -0
  55. data/lib/sass/script/tree.rb +15 -0
  56. data/lib/sass/script/value/arg_list.rb +36 -0
  57. data/lib/sass/script/value/base.rb +238 -0
  58. data/lib/sass/script/value/bool.rb +40 -0
  59. data/lib/sass/script/{color.rb → value/color.rb} +256 -74
  60. data/lib/sass/script/value/deprecated_false.rb +55 -0
  61. data/lib/sass/script/value/helpers.rb +155 -0
  62. data/lib/sass/script/value/list.rb +128 -0
  63. data/lib/sass/script/value/map.rb +70 -0
  64. data/lib/sass/script/value/null.rb +49 -0
  65. data/lib/sass/script/{number.rb → value/number.rb} +115 -62
  66. data/lib/sass/script/{string.rb → value/string.rb} +9 -11
  67. data/lib/sass/script/value.rb +12 -0
  68. data/lib/sass/script.rb +35 -9
  69. data/lib/sass/scss/css_parser.rb +2 -12
  70. data/lib/sass/scss/parser.rb +657 -230
  71. data/lib/sass/scss/rx.rb +17 -12
  72. data/lib/sass/scss/static_parser.rb +37 -6
  73. data/lib/sass/scss.rb +0 -1
  74. data/lib/sass/selector/abstract_sequence.rb +35 -3
  75. data/lib/sass/selector/comma_sequence.rb +29 -14
  76. data/lib/sass/selector/sequence.rb +371 -74
  77. data/lib/sass/selector/simple.rb +28 -13
  78. data/lib/sass/selector/simple_sequence.rb +163 -36
  79. data/lib/sass/selector.rb +138 -36
  80. data/lib/sass/shared.rb +3 -5
  81. data/lib/sass/source/map.rb +196 -0
  82. data/lib/sass/source/position.rb +39 -0
  83. data/lib/sass/source/range.rb +41 -0
  84. data/lib/sass/stack.rb +126 -0
  85. data/lib/sass/supports.rb +228 -0
  86. data/lib/sass/tree/at_root_node.rb +82 -0
  87. data/lib/sass/tree/comment_node.rb +34 -29
  88. data/lib/sass/tree/content_node.rb +9 -0
  89. data/lib/sass/tree/css_import_node.rb +60 -0
  90. data/lib/sass/tree/debug_node.rb +3 -3
  91. data/lib/sass/tree/directive_node.rb +33 -3
  92. data/lib/sass/tree/each_node.rb +9 -9
  93. data/lib/sass/tree/extend_node.rb +20 -6
  94. data/lib/sass/tree/for_node.rb +6 -6
  95. data/lib/sass/tree/function_node.rb +12 -4
  96. data/lib/sass/tree/if_node.rb +2 -15
  97. data/lib/sass/tree/import_node.rb +11 -5
  98. data/lib/sass/tree/media_node.rb +27 -11
  99. data/lib/sass/tree/mixin_def_node.rb +15 -4
  100. data/lib/sass/tree/mixin_node.rb +27 -7
  101. data/lib/sass/tree/node.rb +69 -35
  102. data/lib/sass/tree/prop_node.rb +47 -31
  103. data/lib/sass/tree/return_node.rb +4 -3
  104. data/lib/sass/tree/root_node.rb +20 -4
  105. data/lib/sass/tree/rule_node.rb +37 -26
  106. data/lib/sass/tree/supports_node.rb +38 -0
  107. data/lib/sass/tree/trace_node.rb +33 -0
  108. data/lib/sass/tree/variable_node.rb +10 -4
  109. data/lib/sass/tree/visitors/base.rb +5 -8
  110. data/lib/sass/tree/visitors/check_nesting.rb +67 -52
  111. data/lib/sass/tree/visitors/convert.rb +134 -53
  112. data/lib/sass/tree/visitors/cssize.rb +245 -51
  113. data/lib/sass/tree/visitors/deep_copy.rb +102 -0
  114. data/lib/sass/tree/visitors/extend.rb +68 -0
  115. data/lib/sass/tree/visitors/perform.rb +331 -105
  116. data/lib/sass/tree/visitors/set_options.rb +125 -0
  117. data/lib/sass/tree/visitors/to_css.rb +259 -95
  118. data/lib/sass/tree/warn_node.rb +3 -3
  119. data/lib/sass/tree/while_node.rb +3 -3
  120. data/lib/sass/util/cross_platform_random.rb +19 -0
  121. data/lib/sass/util/multibyte_string_scanner.rb +157 -0
  122. data/lib/sass/util/normalized_map.rb +130 -0
  123. data/lib/sass/util/ordered_hash.rb +192 -0
  124. data/lib/sass/util/subset_map.rb +11 -2
  125. data/lib/sass/util/test.rb +9 -0
  126. data/lib/sass/util.rb +565 -39
  127. data/lib/sass/version.rb +27 -15
  128. data/lib/sass.rb +39 -4
  129. data/test/sass/cache_test.rb +15 -0
  130. data/test/sass/compiler_test.rb +223 -0
  131. data/test/sass/conversion_test.rb +901 -107
  132. data/test/sass/css2sass_test.rb +94 -0
  133. data/test/sass/engine_test.rb +1059 -164
  134. data/test/sass/exec_test.rb +86 -0
  135. data/test/sass/extend_test.rb +933 -837
  136. data/test/sass/fixtures/test_staleness_check_across_importers.css +1 -0
  137. data/test/sass/fixtures/test_staleness_check_across_importers.scss +1 -0
  138. data/test/sass/functions_test.rb +995 -136
  139. data/test/sass/importer_test.rb +338 -18
  140. data/test/sass/logger_test.rb +58 -0
  141. data/test/sass/more_results/more_import.css +2 -2
  142. data/test/sass/plugin_test.rb +114 -30
  143. data/test/sass/results/cached_import_option.css +3 -0
  144. data/test/sass/results/filename_fn.css +3 -0
  145. data/test/sass/results/import.css +2 -2
  146. data/test/sass/results/import_charset.css +1 -0
  147. data/test/sass/results/import_charset_1_8.css +1 -0
  148. data/test/sass/results/import_charset_ibm866.css +1 -0
  149. data/test/sass/results/import_content.css +1 -0
  150. data/test/sass/results/script.css +1 -1
  151. data/test/sass/results/scss_import.css +2 -2
  152. data/test/sass/results/units.css +2 -2
  153. data/test/sass/script_conversion_test.rb +43 -1
  154. data/test/sass/script_test.rb +380 -36
  155. data/test/sass/scss/css_test.rb +257 -75
  156. data/test/sass/scss/scss_test.rb +2322 -110
  157. data/test/sass/source_map_test.rb +887 -0
  158. data/test/sass/templates/_cached_import_option_partial.scss +1 -0
  159. data/test/sass/templates/_double_import_loop2.sass +1 -0
  160. data/test/sass/templates/_filename_fn_import.scss +11 -0
  161. data/test/sass/templates/_imported_content.sass +3 -0
  162. data/test/sass/templates/_same_name_different_partiality.scss +1 -0
  163. data/test/sass/templates/bork5.sass +3 -0
  164. data/test/sass/templates/cached_import_option.scss +3 -0
  165. data/test/sass/templates/double_import_loop1.sass +1 -0
  166. data/test/sass/templates/filename_fn.scss +18 -0
  167. data/test/sass/templates/import_charset.sass +2 -0
  168. data/test/sass/templates/import_charset_1_8.sass +2 -0
  169. data/test/sass/templates/import_charset_ibm866.sass +2 -0
  170. data/test/sass/templates/import_content.sass +4 -0
  171. data/test/sass/templates/same_name_different_ext.sass +2 -0
  172. data/test/sass/templates/same_name_different_ext.scss +1 -0
  173. data/test/sass/templates/same_name_different_partiality.scss +1 -0
  174. data/test/sass/templates/single_import_loop.sass +1 -0
  175. data/test/sass/templates/subdir/import_up1.scss +1 -0
  176. data/test/sass/templates/subdir/import_up2.scss +1 -0
  177. data/test/sass/test_helper.rb +1 -1
  178. data/test/sass/util/multibyte_string_scanner_test.rb +147 -0
  179. data/test/sass/util/normalized_map_test.rb +51 -0
  180. data/test/sass/util_test.rb +183 -0
  181. data/test/sass/value_helpers_test.rb +181 -0
  182. data/test/test_helper.rb +45 -5
  183. data/vendor/listen/CHANGELOG.md +228 -0
  184. data/vendor/listen/CONTRIBUTING.md +38 -0
  185. data/vendor/listen/Gemfile +30 -0
  186. data/vendor/listen/Guardfile +8 -0
  187. data/vendor/{fssm → listen}/LICENSE +1 -1
  188. data/vendor/listen/README.md +315 -0
  189. data/vendor/listen/Rakefile +47 -0
  190. data/vendor/listen/Vagrantfile +96 -0
  191. data/vendor/listen/lib/listen/adapter.rb +214 -0
  192. data/vendor/listen/lib/listen/adapters/bsd.rb +112 -0
  193. data/vendor/listen/lib/listen/adapters/darwin.rb +85 -0
  194. data/vendor/listen/lib/listen/adapters/linux.rb +113 -0
  195. data/vendor/listen/lib/listen/adapters/polling.rb +67 -0
  196. data/vendor/listen/lib/listen/adapters/windows.rb +87 -0
  197. data/vendor/listen/lib/listen/dependency_manager.rb +126 -0
  198. data/vendor/listen/lib/listen/directory_record.rb +371 -0
  199. data/vendor/listen/lib/listen/listener.rb +225 -0
  200. data/vendor/listen/lib/listen/multi_listener.rb +143 -0
  201. data/vendor/listen/lib/listen/turnstile.rb +28 -0
  202. data/vendor/listen/lib/listen/version.rb +3 -0
  203. data/vendor/listen/lib/listen.rb +40 -0
  204. data/vendor/listen/listen.gemspec +22 -0
  205. data/vendor/listen/spec/listen/adapter_spec.rb +183 -0
  206. data/vendor/listen/spec/listen/adapters/bsd_spec.rb +36 -0
  207. data/vendor/listen/spec/listen/adapters/darwin_spec.rb +37 -0
  208. data/vendor/listen/spec/listen/adapters/linux_spec.rb +47 -0
  209. data/vendor/listen/spec/listen/adapters/polling_spec.rb +68 -0
  210. data/vendor/listen/spec/listen/adapters/windows_spec.rb +30 -0
  211. data/vendor/listen/spec/listen/dependency_manager_spec.rb +107 -0
  212. data/vendor/listen/spec/listen/directory_record_spec.rb +1225 -0
  213. data/vendor/listen/spec/listen/listener_spec.rb +169 -0
  214. data/vendor/listen/spec/listen/multi_listener_spec.rb +174 -0
  215. data/vendor/listen/spec/listen/turnstile_spec.rb +56 -0
  216. data/vendor/listen/spec/listen_spec.rb +73 -0
  217. data/vendor/listen/spec/spec_helper.rb +21 -0
  218. data/vendor/listen/spec/support/adapter_helper.rb +629 -0
  219. data/vendor/listen/spec/support/directory_record_helper.rb +55 -0
  220. data/vendor/listen/spec/support/fixtures_helper.rb +29 -0
  221. data/vendor/listen/spec/support/listeners_helper.rb +156 -0
  222. data/vendor/listen/spec/support/platform_helper.rb +15 -0
  223. metadata +344 -271
  224. data/lib/sass/less.rb +0 -382
  225. data/lib/sass/script/bool.rb +0 -18
  226. data/lib/sass/script/funcall.rb +0 -162
  227. data/lib/sass/script/list.rb +0 -76
  228. data/lib/sass/script/literal.rb +0 -245
  229. data/lib/sass/script/variable.rb +0 -54
  230. data/lib/sass/scss/sass_parser.rb +0 -11
  231. data/test/sass/less_conversion_test.rb +0 -653
  232. data/vendor/fssm/README.markdown +0 -55
  233. data/vendor/fssm/Rakefile +0 -59
  234. data/vendor/fssm/VERSION.yml +0 -5
  235. data/vendor/fssm/example.rb +0 -9
  236. data/vendor/fssm/fssm.gemspec +0 -77
  237. data/vendor/fssm/lib/fssm/backends/fsevents.rb +0 -36
  238. data/vendor/fssm/lib/fssm/backends/inotify.rb +0 -26
  239. data/vendor/fssm/lib/fssm/backends/polling.rb +0 -25
  240. data/vendor/fssm/lib/fssm/backends/rubycocoa/fsevents.rb +0 -131
  241. data/vendor/fssm/lib/fssm/monitor.rb +0 -26
  242. data/vendor/fssm/lib/fssm/path.rb +0 -91
  243. data/vendor/fssm/lib/fssm/pathname.rb +0 -502
  244. data/vendor/fssm/lib/fssm/state/directory.rb +0 -57
  245. data/vendor/fssm/lib/fssm/state/file.rb +0 -24
  246. data/vendor/fssm/lib/fssm/support.rb +0 -63
  247. data/vendor/fssm/lib/fssm/tree.rb +0 -176
  248. data/vendor/fssm/lib/fssm.rb +0 -33
  249. data/vendor/fssm/profile/prof-cache.rb +0 -40
  250. data/vendor/fssm/profile/prof-fssm-pathname.html +0 -1231
  251. data/vendor/fssm/profile/prof-pathname.rb +0 -68
  252. data/vendor/fssm/profile/prof-plain-pathname.html +0 -988
  253. data/vendor/fssm/profile/prof.html +0 -2379
  254. data/vendor/fssm/spec/path_spec.rb +0 -75
  255. data/vendor/fssm/spec/root/duck/quack.txt +0 -0
  256. data/vendor/fssm/spec/root/file.css +0 -0
  257. data/vendor/fssm/spec/root/file.rb +0 -0
  258. data/vendor/fssm/spec/root/file.yml +0 -0
  259. data/vendor/fssm/spec/root/moo/cow.txt +0 -0
  260. data/vendor/fssm/spec/spec_helper.rb +0 -14
@@ -0,0 +1,181 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
+
4
+ class ValueHelpersTest < Test::Unit::TestCase
5
+ include Sass::Script
6
+ include Sass::Script::Value::Helpers
7
+
8
+ def test_bool
9
+ assert_same Value::Bool::TRUE, bool(true)
10
+ assert_same Value::Bool::FALSE, bool(false)
11
+ assert_same Value::Bool::FALSE, bool(nil)
12
+ assert_same Value::Bool::TRUE, bool(Object.new)
13
+ end
14
+
15
+ def test_hex_color_with_three_digits
16
+ color = hex_color("F07")
17
+ assert_equal 255, color.red
18
+ assert_equal 0, color.green
19
+ assert_equal 119, color.blue
20
+ assert_equal 1, color.alpha
21
+ end
22
+
23
+ def test_hex_color_without_hash
24
+ color_without_hash = hex_color("FF007F")
25
+ assert_equal 255, color_without_hash.red
26
+ assert_equal 0, color_without_hash.green
27
+ assert_equal 127, color_without_hash.blue
28
+ assert_equal 1, color_without_hash.alpha
29
+ end
30
+
31
+ def test_hex_color_with_hash
32
+ color_with_hash = hex_color("#FF007F")
33
+ assert_equal 255, color_with_hash.red
34
+ assert_equal 0, color_with_hash.green
35
+ assert_equal 127, color_with_hash.blue
36
+ assert_equal 1, color_with_hash.alpha
37
+ end
38
+
39
+ def test_malformed_hex_color
40
+ assert_raises ArgumentError do
41
+ hex_color("green")
42
+ end
43
+ assert_raises ArgumentError do
44
+ hex_color("#abcd")
45
+ end
46
+ end
47
+
48
+
49
+ def test_hex_color_with_alpha
50
+ color_with_alpha = hex_color("FF007F", 0.5)
51
+ assert_equal 0.5, color_with_alpha.alpha
52
+ end
53
+
54
+ def test_hex_color_alpha_enforces_0_to_1
55
+ assert_raises ArgumentError do
56
+ hex_color("FF007F", 50)
57
+ end
58
+ end
59
+
60
+ def test_hsl_color_without_alpha
61
+ no_alpha = hsl_color(1, 0.5, 1)
62
+ assert_equal 1, no_alpha.hue
63
+ assert_equal 0.5, no_alpha.saturation
64
+ assert_equal 1, no_alpha.lightness
65
+ assert_equal 1, no_alpha.alpha
66
+ end
67
+
68
+ def test_hsl_color_with_alpha
69
+ has_alpha = hsl_color(1, 0.5, 1, 0.5)
70
+ assert_equal 1, has_alpha.hue
71
+ assert_equal 0.5, has_alpha.saturation
72
+ assert_equal 1, has_alpha.lightness
73
+ assert_equal 0.5, has_alpha.alpha
74
+ end
75
+
76
+ def test_rgb_color_without_alpha
77
+ no_alpha = rgb_color(255, 0, 0)
78
+ assert_equal 255, no_alpha.red
79
+ assert_equal 0, no_alpha.green
80
+ assert_equal 0, no_alpha.blue
81
+ assert_equal 1, no_alpha.alpha
82
+ end
83
+
84
+ def test_rgb_color_with_alpha
85
+ has_alpha = rgb_color(255, 255, 255, 0.5)
86
+ assert_equal 255, has_alpha.red
87
+ assert_equal 255, has_alpha.green
88
+ assert_equal 255, has_alpha.blue
89
+ assert_equal 0.5, has_alpha.alpha
90
+ end
91
+
92
+ def test_number
93
+ n = number(1)
94
+ assert_equal 1, n.value
95
+ assert_equal "1", n.to_sass
96
+ end
97
+
98
+ def test_number_with_single_unit
99
+ n = number(1, "px")
100
+ assert_equal 1, n.value
101
+ assert_equal "1px", n.to_sass
102
+ end
103
+
104
+ def test_number_with_singal_numerator_and_denominator
105
+ ratio = number(1, "px/em")
106
+ assert_equal "1px/em", ratio.to_sass
107
+ end
108
+
109
+ def test_number_with_many_numerator_and_denominator_units
110
+ complex = number(1, "px*in/em*%")
111
+ assert_equal "1in*px/%*em", complex.to_sass
112
+ end
113
+
114
+ def test_number_with_many_numerator_and_denominator_units_with_spaces
115
+ complex = number(1, "px * in / em * %")
116
+ assert_equal "1in*px/%*em", complex.to_sass
117
+ end
118
+
119
+ def test_number_with_malformed_units
120
+ assert_raises ArgumentError do
121
+ number(1, "px/em/%")
122
+ end
123
+ assert_raises ArgumentError do
124
+ number(1, "/")
125
+ end
126
+ assert_raises ArgumentError do
127
+ number(1, "px/")
128
+ end
129
+ end
130
+
131
+ def test_space_list
132
+ l = list(number(1, "px"), hex_color("#f71"), :space)
133
+ l.options = {}
134
+ assert_kind_of Sass::Script::Value::List, l
135
+ assert_equal "1px #ff7711", l.to_sass
136
+ end
137
+
138
+ def test_comma_list
139
+ l = list(number(1, "px"), hex_color("#f71"), :comma)
140
+ l.options = {}
141
+ assert_kind_of Sass::Script::Value::List, l
142
+ assert_equal "1px, #ff7711", l.to_sass
143
+ end
144
+
145
+ def test_missing_list_type
146
+ assert_raises ArgumentError do
147
+ list(number(1, "px"), hex_color("#f71"))
148
+ end
149
+ end
150
+
151
+ def test_null
152
+ assert_kind_of Sass::Script::Value::Null, null
153
+ end
154
+
155
+ def test_quoted_string
156
+ s = quoted_string("sassy string")
157
+ s.options = {}
158
+ assert_kind_of Sass::Script::Value::String, s
159
+ assert_equal "sassy string", s.value
160
+ assert_equal :string, s.type
161
+ assert_equal '"sassy string"', s.to_sass
162
+ end
163
+
164
+ def test_identifier
165
+ s = identifier("a-sass-ident")
166
+ s.options = {}
167
+ assert_kind_of Sass::Script::Value::String, s
168
+ assert_equal "a-sass-ident", s.value
169
+ assert_equal :identifier, s.type
170
+ assert_equal "a-sass-ident", s.to_sass
171
+ end
172
+
173
+ def test_unquoted_string
174
+ s = unquoted_string("a-sass-ident")
175
+ s.options = {}
176
+ assert_kind_of Sass::Script::Value::String, s
177
+ assert_equal "a-sass-ident", s.value
178
+ assert_equal :identifier, s.type
179
+ assert_equal "a-sass-ident", s.to_sass
180
+ end
181
+ end
data/test/test_helper.rb CHANGED
@@ -4,30 +4,47 @@ require 'test/unit'
4
4
  require 'fileutils'
5
5
  $:.unshift lib_dir unless $:.include?(lib_dir)
6
6
  require 'sass'
7
+ require 'mathn' if ENV['MATHN'] == 'true'
7
8
 
8
9
  Sass::RAILS_LOADED = true unless defined?(Sass::RAILS_LOADED)
9
10
 
11
+ Sass.tests_running = true
12
+
13
+ if defined?(Encoding)
14
+ $-w, w = false, $-w
15
+ Encoding.default_external = 'UTF-8'
16
+ $-w = w
17
+ end
18
+
10
19
  module Sass::Script::Functions
11
20
  def option(name)
12
- Sass::Script::String.new(@options[name.value.to_sym].to_s)
21
+ Sass::Script::Value::String.new(@options[name.value.to_sym].to_s)
13
22
  end
14
23
  end
15
24
 
16
25
  class Test::Unit::TestCase
17
26
  def munge_filename(opts = {})
18
- return if opts.has_key?(:filename)
19
- opts[:filename] = filename_for_test(opts[:syntax] || :sass)
27
+ opts[:filename] ||= filename_for_test(opts[:syntax] || :sass)
28
+ opts[:sourcemap_filename] ||= sourcemap_filename_for_test
29
+ opts
20
30
  end
21
31
 
22
- def filename_for_test(syntax = :sass)
23
- test_name = caller.
32
+ def test_name
33
+ caller.
24
34
  map {|c| Sass::Util.caller_info(c)[2]}.
25
35
  compact.
26
36
  map {|c| c.sub(/^(block|rescue) in /, '')}.
27
37
  find {|c| c =~ /^test_/}
38
+ end
39
+
40
+ def filename_for_test(syntax = :sass)
28
41
  "#{test_name}_inline.#{syntax}"
29
42
  end
30
43
 
44
+ def sourcemap_filename_for_test(syntax = :sass)
45
+ "#{test_name}_inline.css.map"
46
+ end
47
+
31
48
  def clean_up_sassc
32
49
  path = File.dirname(__FILE__) + "/../.sass-cache"
33
50
  FileUtils.rm_r(path) if File.exist?(path)
@@ -46,6 +63,15 @@ class Test::Unit::TestCase
46
63
  $stderr = the_real_stderr
47
64
  end
48
65
 
66
+ def assert_no_warning
67
+ the_real_stderr, $stderr = $stderr, StringIO.new
68
+ yield
69
+
70
+ assert_equal '', $stderr.string
71
+ ensure
72
+ $stderr = the_real_stderr
73
+ end
74
+
49
75
  def silence_warnings(&block)
50
76
  Sass::Util.silence_warnings(&block)
51
77
  end
@@ -67,3 +93,17 @@ class Test::Unit::TestCase
67
93
  flunk "Expected exception on line #{line}, none raised"
68
94
  end
69
95
  end
96
+
97
+ module PublicApiLinter
98
+ def lint_api(api_class, duck_type_class)
99
+ define_method :test_lint_instance do
100
+ assert lint_instance.is_a?(duck_type_class)
101
+ end
102
+ api_class.instance_methods.each do |meth|
103
+ define_method :"test_has_#{meth}" do
104
+ assert lint_instance.respond_to?(meth),
105
+ "#{duck_type_class.name} does not implement #{meth}"
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,228 @@
1
+ ## 0.7.3 - February 24, 2013
2
+
3
+ ### Bug fix
4
+
5
+ - [#88] Update wdm dependency. (fixed by [@mrbinky3000][])
6
+ - [#78] Depend on latest rb-inotify. (fixed by [@mbj][])
7
+
8
+ ## 0.7.2 - January 11, 2013
9
+
10
+ ### Bug fix
11
+
12
+ - [#76] Exception on filename which is not in UTF-8. (fixed by [@piotr-sokolowski][])
13
+
14
+ ## 0.7.1 - January 6, 2013
15
+
16
+ ### Bug fix
17
+
18
+ - [#75] Default high precision off if the mtime call fails. (fixed by [@zanker][])
19
+
20
+ ## 0.7.0 - December 29, 2012
21
+
22
+ ### Bug fixes
23
+
24
+ - [#73] Rescue Errno::EOPNOTSUPP on sha1_checksum generation. (fixed by [@thibaudgg][])
25
+
26
+ ### New feature
27
+
28
+ - Add support for *BSD with rb-kqueue. ([@mat813][])
29
+
30
+ ## 0.6.0 - November 21, 2012
31
+
32
+ ### New feature
33
+
34
+ - Add bang versions for filter and ignore listener methods. ([@tarsolya][])
35
+
36
+ ## 0.5.3 - October 3, 2012
37
+
38
+ ### Bug fixes
39
+
40
+ - [#65] Fix ruby warning in adapter.rb. (fixed by [@vongruenigen][])
41
+ - [#64] ENXIO raised when hashing UNIX domain socket file. (fixed by [@sunaku][])
42
+
43
+ ## 0.5.2 - Septemper 23, 2012
44
+
45
+ ### Bug fix
46
+
47
+ - [#62] Fix double change callback with polling adapter. (fixed by [@thibaudgg][])
48
+
49
+ ## 0.5.1 - Septemper 18, 2012
50
+
51
+ ### Bug fix
52
+
53
+ - [#61] Fix a synchronisation bug that caused constant fallback to polling. (fixed by [@Maher4Ever][])
54
+
55
+ ## 0.5.0 - Septemper 1, 2012
56
+
57
+ ### New features
58
+
59
+ - Add a dependency manager to handle platform-specific gems. So there is no need anymore to install
60
+ extra gems which will never be used on the user system. ([@Maher4Ever][])
61
+ - Add a manual reporting mode to the adapters. ([@Maher4Ever][])
62
+
63
+ ### Improvements
64
+
65
+ - [#28] Enhance the speed of detecting changes on Windows by using the [WDM][] library. ([@Maher4Ever][])
66
+
67
+ ## 0.4.7 - June 27, 2012
68
+
69
+ ### Bug fixes
70
+
71
+ - Increase latency to 0.25, to avoid useless polling fallback. (fixed by [@thibaudgg][])
72
+ - Change watched inotify events, to avoid duplication callback. (fixed by [@thibaudgg][])
73
+ - [#41](https://github.com/guard/listen/issues/41) Use lstat instead of stat when calculating mtime. (fixed by [@ebroder][])
74
+
75
+ ## 0.4.6 - June 20, 2012
76
+
77
+ ### Bug fix
78
+
79
+ - [#39](https://github.com/guard/listen/issues/39) Fix digest race condition. (fixed by [@dkubb][])
80
+
81
+ ## 0.4.5 - June 13, 2012
82
+
83
+ ### Bug fix
84
+
85
+ - [#39](https://github.com/guard/listen/issues/39) Rescue Errno::ENOENT when path inserted doesn't exist. (reported by [@textgoeshere][], fixed by [@thibaudgg][] and [@rymai][])
86
+
87
+ ## 0.4.4 - June 8, 2012
88
+
89
+ ### Bug fixes
90
+
91
+ - ~~[#39](https://github.com/guard/listen/issues/39) Non-existing path insertion bug. (reported by [@textgoeshere][], fixed by [@thibaudgg][])~~
92
+ - Fix relative path for directories containing special characters. (reported by [@napcs][], fixed by [@netzpirat][])
93
+
94
+ ## 0.4.3 - June 6, 2012
95
+
96
+ ### Bug fixes
97
+
98
+ - [#24](https://github.com/guard/listen/issues/24) Fail gracefully when the inotify limit is not enough for Listen to function. (reported by [@daemonza][], fixed by [@Maher4Ever][])
99
+ - [#32](https://github.com/guard/listen/issues/32) Fix a crash when trying to calculate the checksum of unreadable files. (reported by [@nex3][], fixed by [@Maher4Ever][])
100
+
101
+ ### Improvements
102
+
103
+ - Add `#relative_paths` method to listeners. ([@Maher4Ever][])
104
+ - Add `#started?` query-method to adapters. ([@Maher4Ever][])
105
+ - Dynamically detect the mtime precision used on a system. ([@Maher4Ever][] with help from [@nex3][])
106
+
107
+ ## 0.4.2 - May 1, 2012
108
+
109
+ ### Bug fixes
110
+
111
+ - [#21](https://github.com/guard/listen/issues/21) Issues when listening to changes in relative paths. (reported by [@akerbos][], fixed by [@Maher4Ever][])
112
+ - [#27](https://github.com/guard/listen/issues/27) Wrong reports for files modifications. (reported by [@cobychapple][], fixed by [@Maher4Ever][])
113
+ - Fix segmentation fault when profiling on Windows. ([@Maher4Ever][])
114
+ - Fix redundant watchers on Windows. ([@Maher4Ever][])
115
+
116
+ ### Improvements
117
+
118
+ - [#17](https://github.com/guard/listen/issues/17) Use regexp-patterns with the `ignore` method instead of supplying paths. (reported by [@fny][], added by [@Maher4Ever][])
119
+ - Speed improvement when listening to changes in directories with ignored paths. ([@Maher4Ever][])
120
+ - Added `.rbx` and `.svn` to ignored directories. ([@Maher4Ever][])
121
+
122
+ ## 0.4.1 - April 15, 2012
123
+
124
+ ### Bug fix
125
+
126
+ - [#18](https://github.com/guard/listen/issues/18) Listener crashes when removing directories with nested paths. (reported by [@daemonza][], fixed by [@Maher4Ever][])
127
+
128
+ ## 0.4.0 - April 9, 2012
129
+
130
+ ### New features
131
+
132
+ - Add `wait_for_callback` method to all adapters. ([@Maher4Ever][])
133
+ - Add `Listen::MultiListener` class to listen to multiple directories at once. ([@Maher4Ever][])
134
+ - Allow passing multiple directories to the `Listen.to` method. ([@Maher4Ever][])
135
+ - Add `blocking` option to `Listen#start` which can be used to disable blocking the current thread upon starting. ([@Maher4Ever][])
136
+ - Use absolute-paths in callbacks by default instead of relative-paths. ([@Maher4Ever][])
137
+ - Add `relative_paths` option to `Listen::Listener` to retain the old functionality. ([@Maher4Ever][])
138
+
139
+ ### Improvements
140
+
141
+ - Encapsulate thread spawning in the linux-adapter. ([@Maher4Ever][])
142
+ - Encapsulate thread spawning in the darwin-adapter. ([@Maher4Ever][] with [@scottdavis][] help)
143
+ - Encapsulate thread spawning in the windows-adapter. ([@Maher4Ever][])
144
+ - Fix linux-adapter bug where Listen would report file-modification events on the parent-directory. ([@Maher4Ever][])
145
+
146
+ ### Change
147
+
148
+ - Remove `wait_until_listening` as adapters doesn't need to run inside threads anymore ([@Maher4Ever][])
149
+
150
+ ## 0.3.3 - March 6, 2012
151
+
152
+ ### Improvement
153
+
154
+ - Improve pause/unpause. ([@thibaudgg][])
155
+
156
+ ## 0.3.2 - March 4, 2012
157
+
158
+ ### New feature
159
+
160
+ - Add pause/unpause listener's methods. ([@thibaudgg][])
161
+
162
+ ## 0.3.1 - February 22, 2012
163
+
164
+ ### Bug fix
165
+
166
+ - [#9](https://github.com/guard/listen/issues/9) Ignore doesn't seem to work. (reported by [@markiz][], fixed by [@thibaudgg][])
167
+
168
+ ## 0.3.0 - February 21, 2012
169
+
170
+ ### New features
171
+
172
+ - Add automatic fallback to polling if system adapter doesn't work (like a DropBox folder). ([@thibaudgg][])
173
+ - Add latency and force_polling options. ([@Maher4Ever][])
174
+
175
+ ## 0.2.0 - February 13, 2012
176
+
177
+ ### New features
178
+
179
+ - Add checksum comparaison support for detecting consecutive file modifications made during the same second. ([@thibaudgg][])
180
+ - Add rb-fchange support. ([@thibaudgg][])
181
+ - Add rb-inotify support. ([@thibaudgg][] with [@Maher4Ever][] help)
182
+ - Add rb-fsevent support. ([@thibaudgg][])
183
+ - Add non-recursive diff with multiple directories support. ([@thibaudgg][])
184
+ - Ignore .DS_Store by default. ([@thibaudgg][])
185
+
186
+ ## 0.1.0 - January 28, 2012
187
+
188
+ - First version with only a polling adapter and basic features set (ignore & filter). ([@thibaudgg][])
189
+
190
+ <!--- The following link definition list is generated by PimpMyChangelog --->
191
+ [#9]: https://github.com/guard/listen/issues/9
192
+ [#17]: https://github.com/guard/listen/issues/17
193
+ [#18]: https://github.com/guard/listen/issues/18
194
+ [#21]: https://github.com/guard/listen/issues/21
195
+ [#24]: https://github.com/guard/listen/issues/24
196
+ [#27]: https://github.com/guard/listen/issues/27
197
+ [#28]: https://github.com/guard/listen/issues/28
198
+ [#32]: https://github.com/guard/listen/issues/32
199
+ [#41]: https://github.com/guard/listen/issues/41
200
+ [#61]: https://github.com/guard/listen/issues/61
201
+ [#62]: https://github.com/guard/listen/issues/62
202
+ [#64]: https://github.com/guard/listen/issues/64
203
+ [#65]: https://github.com/guard/listen/issues/65
204
+ [#73]: https://github.com/guard/listen/issues/73
205
+ [#75]: https://github.com/guard/listen/issues/75
206
+ [#76]: https://github.com/guard/listen/issues/76
207
+ [@Maher4Ever]: https://github.com/Maher4Ever
208
+ [@dkubb]: https://github.com/dkubb
209
+ [@ebroder]: https://github.com/ebroder
210
+ [@akerbos]: https://github.com/akerbos
211
+ [@cobychapple]: https://github.com/cobychapple
212
+ [@daemonza]: https://github.com/daemonza
213
+ [@fny]: https://github.com/fny
214
+ [@markiz]: https://github.com/markiz
215
+ [@mat813]: https://github.com/mat813
216
+ [@napcs]: https://github.com/napcs
217
+ [@netzpirat]: https://github.com/netzpirat
218
+ [@nex3]: https://github.com/nex3
219
+ [@piotr-sokolowski]: https://github.com/piotr-sokolowski
220
+ [@rymai]: https://github.com/rymai
221
+ [@scottdavis]: https://github.com/scottdavis
222
+ [@sunaku]: https://github.com/sunaku
223
+ [@textgoeshere]: https://github.com/textgoeshere
224
+ [@thibaudgg]: https://github.com/thibaudgg
225
+ [@tarsolya]: https://github.com/tarsolya
226
+ [@vongruenigen]: https://github.com/vongruenigen
227
+ [@zanker]: https://github.com/zanker
228
+ [WDM]: https://github.com/Maher4Ever/wdm
@@ -0,0 +1,38 @@
1
+ Contribute to Listen
2
+ ===================
3
+
4
+ File an issue
5
+ -------------
6
+
7
+ You can report bugs and feature requests to [GitHub Issues](https://github.com/guard/listen/issues).
8
+
9
+ **Please don't ask question in the issue tracker**, instead ask them in our
10
+ [Google group](http://groups.google.com/group/guard-dev) or on `#guard` (irc.freenode.net).
11
+
12
+ Try to figure out where the issue belongs to: Is it an issue with Listen itself or with Guard?
13
+
14
+ When you file a bug, please try to follow these simple rules if applicable:
15
+
16
+ * Make sure you run Listen with `bundle exec` first.
17
+ * Add your `Guardfile` (if used) and `Gemfile` to the issue.
18
+ * Make sure that the issue is reproducible with your description.
19
+
20
+ **It's most likely that your bug gets resolved faster if you provide as much information as possible!**
21
+
22
+ Development
23
+ -----------
24
+
25
+ * Documentation hosted at [RubyDoc](http://rubydoc.info/github/guard/listen/master/frames).
26
+ * Source hosted at [GitHub](https://github.com/guard/listen).
27
+
28
+ Pull requests are very welcome! Please try to follow these simple rules if applicable:
29
+
30
+ * Please create a topic branch for every separate change you make.
31
+ * Make sure your patches are well tested. All specs run with `rake spec` must pass.
32
+ * Update the [Yard](http://yardoc.org/) documentation.
33
+ * Update the [README](https://github.com/guard/listen/blob/master/README.md).
34
+ * Update the [CHANGELOG](https://github.com/guard/listen/blob/master/CHANGELOG.md) for noteworthy changes.
35
+ * Please **do not change** the version number.
36
+
37
+ For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
38
+ `#guard` (irc.freenode.net).
@@ -0,0 +1,30 @@
1
+ require 'rbconfig'
2
+
3
+ source :rubygems
4
+
5
+ gemspec
6
+
7
+ gem 'rake'
8
+
9
+ gem 'rb-kqueue', '~> 0.2' if RbConfig::CONFIG['target_os'] =~ /freebsd/i
10
+ gem 'rb-fsevent', '~> 0.9.1' if RbConfig::CONFIG['target_os'] =~ /darwin(1.+)?$/i
11
+ gem 'rb-inotify', '~> 0.9.0' if RbConfig::CONFIG['target_os'] =~ /linux/i
12
+ gem 'wdm', '~> 0.0.3' if RbConfig::CONFIG['target_os'] =~ /mswin|mingw/i
13
+
14
+ group :development do
15
+ platform :ruby do
16
+ gem 'coolline'
17
+ end
18
+
19
+ gem 'guard'
20
+ gem 'guard-rspec'
21
+ gem 'yard'
22
+ gem 'redcarpet'
23
+ gem 'pry'
24
+
25
+ gem 'vagrant'
26
+ end
27
+
28
+ group :test do
29
+ gem 'rspec'
30
+ end
@@ -0,0 +1,8 @@
1
+ guard :rspec, :all_on_start => false, :all_after_pass => false do
2
+ watch(%r{^spec/.+_spec\.rb$})
3
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
4
+ watch('spec/support/adapter_helper.rb') { "spec/listen/adapters" }
5
+ watch('spec/support/listener_helper.rb') { "spec/listen/listener_spec.rb" }
6
+ watch('spec/support/fixtures_helper.rb') { "spec" }
7
+ watch('spec/spec_helper.rb') { "spec" }
8
+ end
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Travis Tilley
1
+ Copyright (c) 2013 Thibaud Guillaume-Gentil
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the