haml_ejs 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (358) hide show
  1. data/.yardopts +11 -0
  2. data/CONTRIBUTING +3 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.md +68 -0
  5. data/Rakefile +419 -0
  6. data/VERSION +1 -0
  7. data/VERSION_NAME +1 -0
  8. data/bin/haml +9 -0
  9. data/bin/html2haml +7 -0
  10. data/extra/update_watch.rb +13 -0
  11. data/init.rb +18 -0
  12. data/lib/haml.rb +49 -0
  13. data/lib/haml/buffer.rb +297 -0
  14. data/lib/haml/compiler.rb +486 -0
  15. data/lib/haml/engine.rb +312 -0
  16. data/lib/haml/error.rb +22 -0
  17. data/lib/haml/exec.rb +362 -0
  18. data/lib/haml/filters.rb +388 -0
  19. data/lib/haml/haml_ejs.rb +57 -0
  20. data/lib/haml/helpers.rb +608 -0
  21. data/lib/haml/helpers/action_view_extensions.rb +57 -0
  22. data/lib/haml/helpers/action_view_mods.rb +257 -0
  23. data/lib/haml/helpers/xss_mods.rb +165 -0
  24. data/lib/haml/html.rb +412 -0
  25. data/lib/haml/html/erb.rb +141 -0
  26. data/lib/haml/parser.rb +760 -0
  27. data/lib/haml/railtie.rb +19 -0
  28. data/lib/haml/root.rb +7 -0
  29. data/lib/haml/shared.rb +78 -0
  30. data/lib/haml/template.rb +99 -0
  31. data/lib/haml/template/options.rb +16 -0
  32. data/lib/haml/template/patch.rb +58 -0
  33. data/lib/haml/template/plugin.rb +123 -0
  34. data/lib/haml/util.rb +842 -0
  35. data/lib/haml/version.rb +109 -0
  36. data/lib/sass.rb +8 -0
  37. data/lib/sass/plugin.rb +10 -0
  38. data/lib/sass/rails2_shim.rb +9 -0
  39. data/lib/sass/rails3_shim.rb +16 -0
  40. data/rails/init.rb +1 -0
  41. data/test/benchmark.rb +91 -0
  42. data/test/gemfiles/Gemfile.rails-2.0.x +8 -0
  43. data/test/gemfiles/Gemfile.rails-2.0.x.lock +38 -0
  44. data/test/gemfiles/Gemfile.rails-2.1.x +8 -0
  45. data/test/gemfiles/Gemfile.rails-2.1.x.lock +38 -0
  46. data/test/gemfiles/Gemfile.rails-2.2.x +8 -0
  47. data/test/gemfiles/Gemfile.rails-2.2.x.lock +38 -0
  48. data/test/gemfiles/Gemfile.rails-2.3.x +8 -0
  49. data/test/gemfiles/Gemfile.rails-2.3.x.lock +40 -0
  50. data/test/gemfiles/Gemfile.rails-3.0.x +8 -0
  51. data/test/gemfiles/Gemfile.rails-3.0.x.lock +85 -0
  52. data/test/gemfiles/Gemfile.rails-3.1.x +8 -0
  53. data/test/gemfiles/Gemfile.rails-3.1.x.lock +98 -0
  54. data/test/gemfiles/Gemfile.rails-xss-2.3.x +9 -0
  55. data/test/gemfiles/Gemfile.rails-xss-2.3.x.lock +42 -0
  56. data/test/haml-ejs/haml-ejs_test.rb +22 -0
  57. data/test/haml-ejs/templates/conditional.input +3 -0
  58. data/test/haml-ejs/templates/conditional.output +3 -0
  59. data/test/haml-ejs/templates/conditional_and_interpolation.input +2 -0
  60. data/test/haml-ejs/templates/conditional_and_interpolation.output +3 -0
  61. data/test/haml-ejs/templates/conditional_else.input +5 -0
  62. data/test/haml-ejs/templates/conditional_else.output +5 -0
  63. data/test/haml-ejs/templates/conditional_else_elsif.input +7 -0
  64. data/test/haml-ejs/templates/conditional_else_elsif.output +7 -0
  65. data/test/haml-ejs/templates/conditional_elsif.input +5 -0
  66. data/test/haml-ejs/templates/conditional_elsif.output +5 -0
  67. data/test/haml-ejs/templates/conditional_unless.input +3 -0
  68. data/test/haml-ejs/templates/conditional_unless.output +3 -0
  69. data/test/haml-ejs/templates/conditional_unless_else.input +5 -0
  70. data/test/haml-ejs/templates/conditional_unless_else.output +5 -0
  71. data/test/haml-ejs/templates/conditional_unless_elsif_else.input +5 -0
  72. data/test/haml-ejs/templates/conditional_unless_elsif_else.output +5 -0
  73. data/test/haml-ejs/templates/interpolation.input +2 -0
  74. data/test/haml-ejs/templates/interpolation.output +1 -0
  75. data/test/haml-ejs/templates/iteration.input +2 -0
  76. data/test/haml-ejs/templates/iteration.output +3 -0
  77. data/test/haml-ejs/templates/suite.input +26 -0
  78. data/test/haml-ejs/templates/suite.output +27 -0
  79. data/test/haml/engine_test.rb +1925 -0
  80. data/test/haml/erb/_av_partial_1.erb +12 -0
  81. data/test/haml/erb/_av_partial_2.erb +8 -0
  82. data/test/haml/erb/action_view.erb +62 -0
  83. data/test/haml/erb/standard.erb +55 -0
  84. data/test/haml/helper_test.rb +454 -0
  85. data/test/haml/html2haml/erb_tests.rb +440 -0
  86. data/test/haml/html2haml_test.rb +336 -0
  87. data/test/haml/markaby/standard.mab +52 -0
  88. data/test/haml/mocks/article.rb +6 -0
  89. data/test/haml/results/content_for_layout.xhtml +12 -0
  90. data/test/haml/results/eval_suppressed.xhtml +9 -0
  91. data/test/haml/results/filters.xhtml +62 -0
  92. data/test/haml/results/helpers.xhtml +70 -0
  93. data/test/haml/results/helpful.xhtml +10 -0
  94. data/test/haml/results/just_stuff.xhtml +70 -0
  95. data/test/haml/results/list.xhtml +12 -0
  96. data/test/haml/results/nuke_inner_whitespace.xhtml +40 -0
  97. data/test/haml/results/nuke_outer_whitespace.xhtml +148 -0
  98. data/test/haml/results/original_engine.xhtml +20 -0
  99. data/test/haml/results/partial_layout.xhtml +5 -0
  100. data/test/haml/results/partials.xhtml +21 -0
  101. data/test/haml/results/render_layout.xhtml +3 -0
  102. data/test/haml/results/silent_script.xhtml +74 -0
  103. data/test/haml/results/standard.xhtml +162 -0
  104. data/test/haml/results/tag_parsing.xhtml +23 -0
  105. data/test/haml/results/very_basic.xhtml +5 -0
  106. data/test/haml/results/whitespace_handling.xhtml +89 -0
  107. data/test/haml/spec/README.md +97 -0
  108. data/test/haml/spec/lua_haml_spec.lua +30 -0
  109. data/test/haml/spec/ruby_haml_test.rb +19 -0
  110. data/test/haml/spec/tests.json +534 -0
  111. data/test/haml/spec_test.rb +44 -0
  112. data/test/haml/template_test.rb +419 -0
  113. data/test/haml/templates/_av_partial_1.haml +9 -0
  114. data/test/haml/templates/_av_partial_1_ugly.haml +9 -0
  115. data/test/haml/templates/_av_partial_2.haml +5 -0
  116. data/test/haml/templates/_av_partial_2_ugly.haml +5 -0
  117. data/test/haml/templates/_layout.erb +3 -0
  118. data/test/haml/templates/_layout_for_partial.haml +3 -0
  119. data/test/haml/templates/_partial.haml +8 -0
  120. data/test/haml/templates/_text_area.haml +3 -0
  121. data/test/haml/templates/action_view.haml +47 -0
  122. data/test/haml/templates/action_view_ugly.haml +47 -0
  123. data/test/haml/templates/breakage.haml +8 -0
  124. data/test/haml/templates/content_for_layout.haml +8 -0
  125. data/test/haml/templates/eval_suppressed.haml +11 -0
  126. data/test/haml/templates/filters.haml +66 -0
  127. data/test/haml/templates/helpers.haml +55 -0
  128. data/test/haml/templates/helpful.haml +11 -0
  129. data/test/haml/templates/just_stuff.haml +85 -0
  130. data/test/haml/templates/list.haml +12 -0
  131. data/test/haml/templates/nuke_inner_whitespace.haml +32 -0
  132. data/test/haml/templates/nuke_outer_whitespace.haml +144 -0
  133. data/test/haml/templates/original_engine.haml +17 -0
  134. data/test/haml/templates/partial_layout.haml +10 -0
  135. data/test/haml/templates/partialize.haml +1 -0
  136. data/test/haml/templates/partials.haml +12 -0
  137. data/test/haml/templates/render_layout.haml +2 -0
  138. data/test/haml/templates/silent_script.haml +40 -0
  139. data/test/haml/templates/standard.haml +43 -0
  140. data/test/haml/templates/standard_ugly.haml +43 -0
  141. data/test/haml/templates/tag_parsing.haml +21 -0
  142. data/test/haml/templates/very_basic.haml +4 -0
  143. data/test/haml/templates/whitespace_handling.haml +87 -0
  144. data/test/haml/util_test.rb +300 -0
  145. data/test/linked_rails.rb +42 -0
  146. data/test/test_helper.rb +75 -0
  147. data/vendor/sass/CONTRIBUTING +3 -0
  148. data/vendor/sass/MIT-LICENSE +20 -0
  149. data/vendor/sass/README.md +201 -0
  150. data/vendor/sass/Rakefile +339 -0
  151. data/vendor/sass/TODO +39 -0
  152. data/vendor/sass/VERSION +1 -0
  153. data/vendor/sass/VERSION_NAME +1 -0
  154. data/vendor/sass/bin/sass +8 -0
  155. data/vendor/sass/bin/sass-convert +7 -0
  156. data/vendor/sass/bin/scss +8 -0
  157. data/vendor/sass/doc-src/FAQ.md +35 -0
  158. data/vendor/sass/doc-src/INDENTED_SYNTAX.md +210 -0
  159. data/vendor/sass/doc-src/SASS_CHANGELOG.md +2214 -0
  160. data/vendor/sass/doc-src/SASS_REFERENCE.md +1957 -0
  161. data/vendor/sass/doc-src/SCSS_FOR_SASS_USERS.md +155 -0
  162. data/vendor/sass/ext/extconf.rb +10 -0
  163. data/vendor/sass/extra/update_watch.rb +13 -0
  164. data/vendor/sass/init.rb +18 -0
  165. data/vendor/sass/lib/sass.rb +72 -0
  166. data/vendor/sass/lib/sass/cache_stores.rb +15 -0
  167. data/vendor/sass/lib/sass/cache_stores/base.rb +84 -0
  168. data/vendor/sass/lib/sass/cache_stores/chain.rb +33 -0
  169. data/vendor/sass/lib/sass/cache_stores/filesystem.rb +58 -0
  170. data/vendor/sass/lib/sass/cache_stores/memory.rb +47 -0
  171. data/vendor/sass/lib/sass/cache_stores/null.rb +25 -0
  172. data/vendor/sass/lib/sass/callbacks.rb +66 -0
  173. data/vendor/sass/lib/sass/css.rb +294 -0
  174. data/vendor/sass/lib/sass/engine.rb +862 -0
  175. data/vendor/sass/lib/sass/environment.rb +155 -0
  176. data/vendor/sass/lib/sass/error.rb +201 -0
  177. data/vendor/sass/lib/sass/exec.rb +659 -0
  178. data/vendor/sass/lib/sass/importers.rb +22 -0
  179. data/vendor/sass/lib/sass/importers/base.rb +138 -0
  180. data/vendor/sass/lib/sass/importers/filesystem.rb +144 -0
  181. data/vendor/sass/lib/sass/less.rb +382 -0
  182. data/vendor/sass/lib/sass/plugin.rb +136 -0
  183. data/vendor/sass/lib/sass/plugin/compiler.rb +358 -0
  184. data/vendor/sass/lib/sass/plugin/configuration.rb +125 -0
  185. data/vendor/sass/lib/sass/plugin/generic.rb +15 -0
  186. data/vendor/sass/lib/sass/plugin/merb.rb +48 -0
  187. data/vendor/sass/lib/sass/plugin/rack.rb +60 -0
  188. data/vendor/sass/lib/sass/plugin/rails.rb +47 -0
  189. data/vendor/sass/lib/sass/plugin/staleness_checker.rb +173 -0
  190. data/vendor/sass/lib/sass/railtie.rb +9 -0
  191. data/vendor/sass/lib/sass/repl.rb +58 -0
  192. data/vendor/sass/lib/sass/root.rb +7 -0
  193. data/vendor/sass/lib/sass/script.rb +40 -0
  194. data/vendor/sass/lib/sass/script/bool.rb +18 -0
  195. data/vendor/sass/lib/sass/script/color.rb +480 -0
  196. data/vendor/sass/lib/sass/script/css_lexer.rb +29 -0
  197. data/vendor/sass/lib/sass/script/css_parser.rb +31 -0
  198. data/vendor/sass/lib/sass/script/funcall.rb +162 -0
  199. data/vendor/sass/lib/sass/script/functions.rb +1343 -0
  200. data/vendor/sass/lib/sass/script/interpolation.rb +70 -0
  201. data/vendor/sass/lib/sass/script/lexer.rb +334 -0
  202. data/vendor/sass/lib/sass/script/list.rb +76 -0
  203. data/vendor/sass/lib/sass/script/literal.rb +245 -0
  204. data/vendor/sass/lib/sass/script/node.rb +91 -0
  205. data/vendor/sass/lib/sass/script/number.rb +429 -0
  206. data/vendor/sass/lib/sass/script/operation.rb +91 -0
  207. data/vendor/sass/lib/sass/script/parser.rb +467 -0
  208. data/vendor/sass/lib/sass/script/string.rb +51 -0
  209. data/vendor/sass/lib/sass/script/string_interpolation.rb +94 -0
  210. data/vendor/sass/lib/sass/script/unary_operation.rb +57 -0
  211. data/vendor/sass/lib/sass/script/variable.rb +54 -0
  212. data/vendor/sass/lib/sass/scss.rb +17 -0
  213. data/vendor/sass/lib/sass/scss/css_parser.rb +46 -0
  214. data/vendor/sass/lib/sass/scss/parser.rb +920 -0
  215. data/vendor/sass/lib/sass/scss/rx.rb +127 -0
  216. data/vendor/sass/lib/sass/scss/sass_parser.rb +11 -0
  217. data/vendor/sass/lib/sass/scss/script_lexer.rb +15 -0
  218. data/vendor/sass/lib/sass/scss/script_parser.rb +25 -0
  219. data/vendor/sass/lib/sass/scss/static_parser.rb +40 -0
  220. data/vendor/sass/lib/sass/selector.rb +361 -0
  221. data/vendor/sass/lib/sass/selector/abstract_sequence.rb +62 -0
  222. data/vendor/sass/lib/sass/selector/comma_sequence.rb +81 -0
  223. data/vendor/sass/lib/sass/selector/sequence.rb +233 -0
  224. data/vendor/sass/lib/sass/selector/simple.rb +113 -0
  225. data/vendor/sass/lib/sass/selector/simple_sequence.rb +134 -0
  226. data/vendor/sass/lib/sass/shared.rb +78 -0
  227. data/vendor/sass/lib/sass/tree/charset_node.rb +22 -0
  228. data/vendor/sass/lib/sass/tree/comment_node.rb +77 -0
  229. data/vendor/sass/lib/sass/tree/debug_node.rb +18 -0
  230. data/vendor/sass/lib/sass/tree/directive_node.rb +23 -0
  231. data/vendor/sass/lib/sass/tree/each_node.rb +24 -0
  232. data/vendor/sass/lib/sass/tree/extend_node.rb +29 -0
  233. data/vendor/sass/lib/sass/tree/for_node.rb +36 -0
  234. data/vendor/sass/lib/sass/tree/function_node.rb +27 -0
  235. data/vendor/sass/lib/sass/tree/if_node.rb +65 -0
  236. data/vendor/sass/lib/sass/tree/import_node.rb +68 -0
  237. data/vendor/sass/lib/sass/tree/media_node.rb +32 -0
  238. data/vendor/sass/lib/sass/tree/mixin_def_node.rb +27 -0
  239. data/vendor/sass/lib/sass/tree/mixin_node.rb +32 -0
  240. data/vendor/sass/lib/sass/tree/node.rb +204 -0
  241. data/vendor/sass/lib/sass/tree/prop_node.rb +155 -0
  242. data/vendor/sass/lib/sass/tree/return_node.rb +18 -0
  243. data/vendor/sass/lib/sass/tree/root_node.rb +28 -0
  244. data/vendor/sass/lib/sass/tree/rule_node.rb +129 -0
  245. data/vendor/sass/lib/sass/tree/variable_node.rb +30 -0
  246. data/vendor/sass/lib/sass/tree/visitors/base.rb +75 -0
  247. data/vendor/sass/lib/sass/tree/visitors/check_nesting.rb +134 -0
  248. data/vendor/sass/lib/sass/tree/visitors/convert.rb +255 -0
  249. data/vendor/sass/lib/sass/tree/visitors/cssize.rb +175 -0
  250. data/vendor/sass/lib/sass/tree/visitors/perform.rb +301 -0
  251. data/vendor/sass/lib/sass/tree/visitors/to_css.rb +216 -0
  252. data/vendor/sass/lib/sass/tree/warn_node.rb +18 -0
  253. data/vendor/sass/lib/sass/tree/while_node.rb +18 -0
  254. data/vendor/sass/lib/sass/util.rb +669 -0
  255. data/vendor/sass/lib/sass/util/subset_map.rb +101 -0
  256. data/vendor/sass/lib/sass/version.rb +112 -0
  257. data/vendor/sass/rails/init.rb +1 -0
  258. data/vendor/sass/sass.gemspec +32 -0
  259. data/vendor/sass/test/sass/cache_test.rb +74 -0
  260. data/vendor/sass/test/sass/callbacks_test.rb +61 -0
  261. data/vendor/sass/test/sass/conversion_test.rb +1203 -0
  262. data/vendor/sass/test/sass/css2sass_test.rb +364 -0
  263. data/vendor/sass/test/sass/data/hsl-rgb.txt +319 -0
  264. data/vendor/sass/test/sass/engine_test.rb +2469 -0
  265. data/vendor/sass/test/sass/extend_test.rb +1348 -0
  266. data/vendor/sass/test/sass/functions_test.rb +1025 -0
  267. data/vendor/sass/test/sass/importer_test.rb +82 -0
  268. data/vendor/sass/test/sass/less_conversion_test.rb +653 -0
  269. data/vendor/sass/test/sass/mock_importer.rb +49 -0
  270. data/vendor/sass/test/sass/more_results/more1.css +9 -0
  271. data/vendor/sass/test/sass/more_results/more1_with_line_comments.css +26 -0
  272. data/vendor/sass/test/sass/more_results/more_import.css +29 -0
  273. data/vendor/sass/test/sass/more_templates/_more_partial.sass +2 -0
  274. data/vendor/sass/test/sass/more_templates/more1.sass +23 -0
  275. data/vendor/sass/test/sass/more_templates/more_import.sass +11 -0
  276. data/vendor/sass/test/sass/plugin_test.rb +469 -0
  277. data/vendor/sass/test/sass/results/alt.css +4 -0
  278. data/vendor/sass/test/sass/results/basic.css +9 -0
  279. data/vendor/sass/test/sass/results/compact.css +5 -0
  280. data/vendor/sass/test/sass/results/complex.css +86 -0
  281. data/vendor/sass/test/sass/results/compressed.css +1 -0
  282. data/vendor/sass/test/sass/results/expanded.css +19 -0
  283. data/vendor/sass/test/sass/results/if.css +3 -0
  284. data/vendor/sass/test/sass/results/import.css +31 -0
  285. data/vendor/sass/test/sass/results/import_charset.css +4 -0
  286. data/vendor/sass/test/sass/results/import_charset_1_8.css +4 -0
  287. data/vendor/sass/test/sass/results/import_charset_ibm866.css +4 -0
  288. data/vendor/sass/test/sass/results/line_numbers.css +49 -0
  289. data/vendor/sass/test/sass/results/mixins.css +95 -0
  290. data/vendor/sass/test/sass/results/multiline.css +24 -0
  291. data/vendor/sass/test/sass/results/nested.css +22 -0
  292. data/vendor/sass/test/sass/results/options.css +1 -0
  293. data/vendor/sass/test/sass/results/parent_ref.css +13 -0
  294. data/vendor/sass/test/sass/results/script.css +16 -0
  295. data/vendor/sass/test/sass/results/scss_import.css +31 -0
  296. data/vendor/sass/test/sass/results/scss_importee.css +2 -0
  297. data/vendor/sass/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
  298. data/vendor/sass/test/sass/results/subdir/subdir.css +3 -0
  299. data/vendor/sass/test/sass/results/units.css +11 -0
  300. data/vendor/sass/test/sass/results/warn.css +0 -0
  301. data/vendor/sass/test/sass/results/warn_imported.css +0 -0
  302. data/vendor/sass/test/sass/script_conversion_test.rb +283 -0
  303. data/vendor/sass/test/sass/script_test.rb +496 -0
  304. data/vendor/sass/test/sass/scss/css_test.rb +916 -0
  305. data/vendor/sass/test/sass/scss/rx_test.rb +156 -0
  306. data/vendor/sass/test/sass/scss/scss_test.rb +1249 -0
  307. data/vendor/sass/test/sass/scss/test_helper.rb +37 -0
  308. data/vendor/sass/test/sass/templates/_imported_charset_ibm866.sass +4 -0
  309. data/vendor/sass/test/sass/templates/_imported_charset_utf8.sass +4 -0
  310. data/vendor/sass/test/sass/templates/_partial.sass +2 -0
  311. data/vendor/sass/test/sass/templates/alt.sass +16 -0
  312. data/vendor/sass/test/sass/templates/basic.sass +23 -0
  313. data/vendor/sass/test/sass/templates/bork1.sass +2 -0
  314. data/vendor/sass/test/sass/templates/bork2.sass +2 -0
  315. data/vendor/sass/test/sass/templates/bork3.sass +2 -0
  316. data/vendor/sass/test/sass/templates/bork4.sass +2 -0
  317. data/vendor/sass/test/sass/templates/compact.sass +17 -0
  318. data/vendor/sass/test/sass/templates/complex.sass +305 -0
  319. data/vendor/sass/test/sass/templates/compressed.sass +15 -0
  320. data/vendor/sass/test/sass/templates/expanded.sass +17 -0
  321. data/vendor/sass/test/sass/templates/if.sass +11 -0
  322. data/vendor/sass/test/sass/templates/import.sass +12 -0
  323. data/vendor/sass/test/sass/templates/import_charset.sass +7 -0
  324. data/vendor/sass/test/sass/templates/import_charset_1_8.sass +4 -0
  325. data/vendor/sass/test/sass/templates/import_charset_ibm866.sass +9 -0
  326. data/vendor/sass/test/sass/templates/importee.less +2 -0
  327. data/vendor/sass/test/sass/templates/importee.sass +19 -0
  328. data/vendor/sass/test/sass/templates/line_numbers.sass +13 -0
  329. data/vendor/sass/test/sass/templates/mixin_bork.sass +5 -0
  330. data/vendor/sass/test/sass/templates/mixins.sass +76 -0
  331. data/vendor/sass/test/sass/templates/multiline.sass +20 -0
  332. data/vendor/sass/test/sass/templates/nested.sass +25 -0
  333. data/vendor/sass/test/sass/templates/nested_bork1.sass +2 -0
  334. data/vendor/sass/test/sass/templates/nested_bork2.sass +2 -0
  335. data/vendor/sass/test/sass/templates/nested_bork3.sass +2 -0
  336. data/vendor/sass/test/sass/templates/nested_bork4.sass +2 -0
  337. data/vendor/sass/test/sass/templates/nested_import.sass +2 -0
  338. data/vendor/sass/test/sass/templates/nested_mixin_bork.sass +6 -0
  339. data/vendor/sass/test/sass/templates/options.sass +2 -0
  340. data/vendor/sass/test/sass/templates/parent_ref.sass +25 -0
  341. data/vendor/sass/test/sass/templates/script.sass +101 -0
  342. data/vendor/sass/test/sass/templates/scss_import.scss +11 -0
  343. data/vendor/sass/test/sass/templates/scss_importee.scss +1 -0
  344. data/vendor/sass/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +2 -0
  345. data/vendor/sass/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
  346. data/vendor/sass/test/sass/templates/subdir/subdir.sass +6 -0
  347. data/vendor/sass/test/sass/templates/units.sass +11 -0
  348. data/vendor/sass/test/sass/templates/warn.sass +3 -0
  349. data/vendor/sass/test/sass/templates/warn_imported.sass +4 -0
  350. data/vendor/sass/test/sass/test_helper.rb +8 -0
  351. data/vendor/sass/test/sass/util/subset_map_test.rb +91 -0
  352. data/vendor/sass/test/sass/util_test.rb +254 -0
  353. data/vendor/sass/test/test_helper.rb +69 -0
  354. data/vendor/sass/yard/callbacks.rb +29 -0
  355. data/vendor/sass/yard/default/fulldoc/html/css/common.sass +26 -0
  356. data/vendor/sass/yard/default/layout/html/footer.erb +12 -0
  357. data/vendor/sass/yard/inherited_hash.rb +41 -0
  358. metadata +458 -0
@@ -0,0 +1,136 @@
1
+ require 'fileutils'
2
+
3
+ require 'sass'
4
+ require 'sass/plugin/compiler'
5
+
6
+ module Sass
7
+ # This module provides a single interface to the compilation of Sass/SCSS files
8
+ # for an application. It provides global options and checks whether CSS files
9
+ # need to be updated.
10
+ #
11
+ # This module is used as the primary interface with Sass
12
+ # when it's used as a plugin for various frameworks.
13
+ # All Rack-enabled frameworks are supported out of the box.
14
+ # The plugin is {file:SASS_REFERENCE.md#rails_merb_plugin automatically activated for Rails and Merb}.
15
+ # Other frameworks must enable it explicitly; see {Sass::Plugin::Rack}.
16
+ #
17
+ # This module has a large set of callbacks available
18
+ # to allow users to run code (such as logging) when certain things happen.
19
+ # All callback methods are of the form `on_#{name}`,
20
+ # and they all take a block that's called when the given action occurs.
21
+ #
22
+ # Note that this class proxies almost all methods to its {Sass::Plugin::Compiler} instance.
23
+ # See \{#compiler}.
24
+ #
25
+ # @example Using a callback
26
+ # Sass::Plugin.on_updating_stylesheet do |template, css|
27
+ # puts "Compiling #{template} to #{css}"
28
+ # end
29
+ # Sass::Plugin.update_stylesheets
30
+ # #=> Compiling app/sass/screen.scss to public/stylesheets/screen.css
31
+ # #=> Compiling app/sass/print.scss to public/stylesheets/print.css
32
+ # #=> Compiling app/sass/ie.scss to public/stylesheets/ie.css
33
+ # @see Sass::Plugin::Compiler
34
+ module Plugin
35
+ include Sass::Util
36
+ extend self
37
+
38
+ @checked_for_updates = false
39
+
40
+ # Whether or not Sass has **ever** checked if the stylesheets need to be updated
41
+ # (in this Ruby instance).
42
+ #
43
+ # @return [Boolean]
44
+ attr_accessor :checked_for_updates
45
+
46
+ # Same as \{#update\_stylesheets}, but respects \{#checked\_for\_updates}
47
+ # and the {file:SASS_REFERENCE.md#always_update-option `:always_update`}
48
+ # and {file:SASS_REFERENCE.md#always_check-option `:always_check`} options.
49
+ #
50
+ # @see #update_stylesheets
51
+ def check_for_updates
52
+ return unless !Sass::Plugin.checked_for_updates ||
53
+ Sass::Plugin.options[:always_update] || Sass::Plugin.options[:always_check]
54
+ update_stylesheets
55
+ end
56
+
57
+ # Returns the singleton compiler instance.
58
+ # This compiler has been pre-configured according
59
+ # to the plugin configuration.
60
+ #
61
+ # @return [Sass::Plugin::Compiler]
62
+ def compiler
63
+ @compiler ||= Compiler.new
64
+ end
65
+
66
+ # Updates out-of-date stylesheets.
67
+ #
68
+ # Checks each Sass/SCSS file in {file:SASS_REFERENCE.md#template_location-option `:template_location`}
69
+ # to see if it's been modified more recently than the corresponding CSS file
70
+ # in {file:SASS_REFERENCE.md#css_location-option `:css_location`}.
71
+ # If it has, it updates the CSS file.
72
+ #
73
+ # @param individual_files [Array<(String, String)>]
74
+ # A list of files to check for updates
75
+ # **in addition to those specified by the
76
+ # {file:SASS_REFERENCE.md#template_location-option `:template_location` option}.**
77
+ # The first string in each pair is the location of the Sass/SCSS file,
78
+ # the second is the location of the CSS file that it should be compiled to.
79
+ def update_stylesheets(individual_files = [])
80
+ return if options[:never_update]
81
+ compiler.update_stylesheets(individual_files)
82
+ end
83
+
84
+ # Updates all stylesheets, even those that aren't out-of-date.
85
+ # Ignores the cache.
86
+ #
87
+ # @param individual_files [Array<(String, String)>]
88
+ # A list of files to check for updates
89
+ # **in addition to those specified by the
90
+ # {file:SASS_REFERENCE.md#template_location-option `:template_location` option}.**
91
+ # The first string in each pair is the location of the Sass/SCSS file,
92
+ # the second is the location of the CSS file that it should be compiled to.
93
+ # @see #update_stylesheets
94
+ def force_update_stylesheets(individual_files = [])
95
+ old_options = options
96
+ self.options = options.dup
97
+ options[:never_update] = false
98
+ options[:always_update] = true
99
+ options[:cache] = false
100
+ update_stylesheets(individual_files)
101
+ ensure
102
+ self.options = old_options
103
+ end
104
+
105
+ # All other method invocations are proxied to the \{#compiler}.
106
+ #
107
+ # @see #compiler
108
+ # @see Sass::Plugin::Compiler
109
+ def method_missing(method, *args, &block)
110
+ if compiler.respond_to?(method)
111
+ compiler.send(method, *args, &block)
112
+ else
113
+ super
114
+ end
115
+ end
116
+
117
+ # For parity with method_missing
118
+ def respond_to?(method)
119
+ super || compiler.respond_to?(method)
120
+ end
121
+
122
+ # There's a small speedup by not using method missing for frequently delegated methods.
123
+ def options
124
+ compiler.options
125
+ end
126
+
127
+ end
128
+ end
129
+
130
+ if defined?(ActionController)
131
+ require 'sass/plugin/rails'
132
+ elsif defined?(Merb::Plugins)
133
+ require 'sass/plugin/merb'
134
+ else
135
+ require 'sass/plugin/generic'
136
+ end
@@ -0,0 +1,358 @@
1
+ require 'fileutils'
2
+
3
+ require 'sass'
4
+ # XXX CE: is this still necessary now that we have the compiler class?
5
+ require 'sass/callbacks'
6
+ require 'sass/plugin/configuration'
7
+ require 'sass/plugin/staleness_checker'
8
+
9
+ module Sass::Plugin
10
+
11
+ # The Compiler class handles compilation of multiple files and/or directories,
12
+ # including checking which CSS files are out-of-date and need to be updated
13
+ # and calling Sass to perform the compilation on those files.
14
+ #
15
+ # {Sass::Plugin} uses this class to update stylesheets for a single application.
16
+ # Unlike {Sass::Plugin}, though, the Compiler class has no global state,
17
+ # and so multiple instances may be created and used independently.
18
+ #
19
+ # If you need to compile a Sass string into CSS,
20
+ # please see the {Sass::Engine} class.
21
+ #
22
+ # Unlike {Sass::Plugin}, this class doesn't keep track of
23
+ # whether or how many times a stylesheet should be updated.
24
+ # Therefore, the following `Sass::Plugin` options are ignored by the Compiler:
25
+ #
26
+ # * `:never_update`
27
+ # * `:always_check`
28
+ class Compiler
29
+ include Sass::Util
30
+ include Configuration
31
+ extend Sass::Callbacks
32
+
33
+ # Creates a new compiler.
34
+ #
35
+ # @param options [{Symbol => Object}]
36
+ # See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.
37
+ def initialize(options = {})
38
+ self.options.merge!(options)
39
+ end
40
+
41
+ # Register a callback to be run before stylesheets are mass-updated.
42
+ # This is run whenever \{#update\_stylesheets} is called,
43
+ # unless the \{file:SASS_REFERENCE.md#never_update-option `:never_update` option}
44
+ # is enabled.
45
+ #
46
+ # @yield [individual_files]
47
+ # @yieldparam individual_files [<(String, String)>]
48
+ # Individual files to be updated, in addition to the directories
49
+ # specified in the options.
50
+ # The first element of each pair is the source file,
51
+ # the second is the target CSS file.
52
+ define_callback :updating_stylesheets
53
+
54
+ # Register a callback to be run before a single stylesheet is updated.
55
+ # The callback is only run if the stylesheet is guaranteed to be updated;
56
+ # if the CSS file is fresh, this won't be run.
57
+ #
58
+ # Even if the \{file:SASS_REFERENCE.md#full_exception-option `:full_exception` option}
59
+ # is enabled, this callback won't be run
60
+ # when an exception CSS file is being written.
61
+ # To run an action for those files, use \{#on\_compilation\_error}.
62
+ #
63
+ # @yield [template, css]
64
+ # @yieldparam template [String]
65
+ # The location of the Sass/SCSS file being updated.
66
+ # @yieldparam css [String]
67
+ # The location of the CSS file being generated.
68
+ define_callback :updating_stylesheet
69
+
70
+ # Register a callback to be run when Sass decides not to update a stylesheet.
71
+ # In particular, the callback is run when Sass finds that
72
+ # the template file and none of its dependencies
73
+ # have been modified since the last compilation.
74
+ #
75
+ # Note that this is **not** run when the
76
+ # \{file:SASS_REFERENCE.md#never-update_option `:never_update` option} is set,
77
+ # nor when Sass decides not to compile a partial.
78
+ #
79
+ # @yield [template, css]
80
+ # @yieldparam template [String]
81
+ # The location of the Sass/SCSS file not being updated.
82
+ # @yieldparam css [String]
83
+ # The location of the CSS file not being generated.
84
+ define_callback :not_updating_stylesheet
85
+
86
+ # Register a callback to be run when there's an error
87
+ # compiling a Sass file.
88
+ # This could include not only errors in the Sass document,
89
+ # but also errors accessing the file at all.
90
+ #
91
+ # @yield [error, template, css]
92
+ # @yieldparam error [Exception] The exception that was raised.
93
+ # @yieldparam template [String]
94
+ # The location of the Sass/SCSS file being updated.
95
+ # @yieldparam css [String]
96
+ # The location of the CSS file being generated.
97
+ define_callback :compilation_error
98
+
99
+ # Register a callback to be run when Sass creates a directory
100
+ # into which to put CSS files.
101
+ #
102
+ # Note that even if multiple levels of directories need to be created,
103
+ # the callback may only be run once.
104
+ # For example, if "foo/" exists and "foo/bar/baz/" needs to be created,
105
+ # this may only be run for "foo/bar/baz/".
106
+ # This is not a guarantee, however;
107
+ # it may also be run for "foo/bar/".
108
+ #
109
+ # @yield [dirname]
110
+ # @yieldparam dirname [String]
111
+ # The location of the directory that was created.
112
+ define_callback :creating_directory
113
+
114
+ # Register a callback to be run when Sass detects
115
+ # that a template has been modified.
116
+ # This is only run when using \{#watch}.
117
+ #
118
+ # @yield [template]
119
+ # @yieldparam template [String]
120
+ # The location of the template that was modified.
121
+ define_callback :template_modified
122
+
123
+ # Register a callback to be run when Sass detects
124
+ # that a new template has been created.
125
+ # This is only run when using \{#watch}.
126
+ #
127
+ # @yield [template]
128
+ # @yieldparam template [String]
129
+ # The location of the template that was created.
130
+ define_callback :template_created
131
+
132
+ # Register a callback to be run when Sass detects
133
+ # that a template has been deleted.
134
+ # This is only run when using \{#watch}.
135
+ #
136
+ # @yield [template]
137
+ # @yieldparam template [String]
138
+ # The location of the template that was deleted.
139
+ define_callback :template_deleted
140
+
141
+ # Register a callback to be run when Sass deletes a CSS file.
142
+ # This happens when the corresponding Sass/SCSS file has been deleted.
143
+ #
144
+ # @yield [filename]
145
+ # @yieldparam filename [String]
146
+ # The location of the CSS file that was deleted.
147
+ define_callback :deleting_css
148
+
149
+ # Updates out-of-date stylesheets.
150
+ #
151
+ # Checks each Sass/SCSS file in {file:SASS_REFERENCE.md#template_location-option `:template_location`}
152
+ # to see if it's been modified more recently than the corresponding CSS file
153
+ # in {file:SASS_REFERENCE.md#css_location-option `:css_location`}.
154
+ # If it has, it updates the CSS file.
155
+ #
156
+ # @param individual_files [Array<(String, String)>]
157
+ # A list of files to check for updates
158
+ # **in addition to those specified by the
159
+ # {file:SASS_REFERENCE.md#template_location-option `:template_location` option}.**
160
+ # The first string in each pair is the location of the Sass/SCSS file,
161
+ # the second is the location of the CSS file that it should be compiled to.
162
+ def update_stylesheets(individual_files = [])
163
+ run_updating_stylesheets individual_files
164
+ Sass::Plugin.checked_for_updates = true
165
+ staleness_checker = StalenessChecker.new(engine_options)
166
+
167
+ individual_files.each do |t, c|
168
+ if options[:always_update] || staleness_checker.stylesheet_needs_update?(c, t)
169
+ update_stylesheet(t, c)
170
+ end
171
+ end
172
+
173
+ template_location_array.each do |template_location, css_location|
174
+
175
+ Dir.glob(File.join(template_location, "**", "[^_]*.s[ca]ss")).sort.each do |file|
176
+ # Get the relative path to the file
177
+ name = file.sub(template_location.to_s.sub(/\/*$/, '/'), "")
178
+ css = css_filename(name, css_location)
179
+
180
+ if options[:always_update] || staleness_checker.stylesheet_needs_update?(css, file)
181
+ update_stylesheet file, css
182
+ else
183
+ run_not_updating_stylesheet file, css
184
+ end
185
+ end
186
+ end
187
+ end
188
+
189
+ # Watches the template directory (or directories)
190
+ # and updates the CSS files whenever the related Sass/SCSS files change.
191
+ # `watch` never returns.
192
+ #
193
+ # Whenever a change is detected to a Sass/SCSS file in
194
+ # {file:SASS_REFERENCE.md#template_location-option `:template_location`},
195
+ # the corresponding CSS file in {file:SASS_REFERENCE.md#css_location-option `:css_location`}
196
+ # will be recompiled.
197
+ # The CSS files of any Sass/SCSS files that import the changed file will also be recompiled.
198
+ #
199
+ # Before the watching starts in earnest, `watch` calls \{#update\_stylesheets}.
200
+ #
201
+ # Note that `watch` uses the [FSSM](http://github.com/ttilley/fssm) library
202
+ # to monitor the filesystem for changes.
203
+ # FSSM isn't loaded until `watch` is run.
204
+ # The version of FSSM distributed with Sass is loaded by default,
205
+ # but if another version has already been loaded that will be used instead.
206
+ #
207
+ # @param individual_files [Array<(String, String)>]
208
+ # A list of files to watch for updates
209
+ # **in addition to those specified by the
210
+ # {file:SASS_REFERENCE.md#template_location-option `:template_location` option}.**
211
+ # The first string in each pair is the location of the Sass/SCSS file,
212
+ # the second is the location of the CSS file that it should be compiled to.
213
+ def watch(individual_files = [])
214
+ update_stylesheets(individual_files)
215
+
216
+ begin
217
+ require 'fssm'
218
+ rescue LoadError => e
219
+ dir = Sass::Util.scope("vendor/fssm/lib")
220
+ if $LOAD_PATH.include?(dir)
221
+ e.message << "\n" <<
222
+ if File.exists?(scope(".git"))
223
+ 'Run "git submodule update --init" to get the recommended version.'
224
+ else
225
+ 'Run "gem install fssm" to get it.'
226
+ end
227
+ raise e
228
+ else
229
+ $LOAD_PATH.unshift dir
230
+ retry
231
+ end
232
+ end
233
+
234
+ unless individual_files.empty? && FSSM::Backends::Default.name == "FSSM::Backends::FSEvents"
235
+ # As of FSSM 0.1.4, it doesn't support FSevents on individual files,
236
+ # but it also isn't smart enough to switch to polling itself.
237
+ require 'fssm/backends/polling'
238
+ Sass::Util.silence_warnings do
239
+ FSSM::Backends.const_set(:Default, FSSM::Backends::Polling)
240
+ end
241
+ end
242
+
243
+ # TODO: Keep better track of what depends on what
244
+ # so we don't have to run a global update every time anything changes.
245
+ FSSM.monitor do |mon|
246
+ template_location_array.each do |template_location, css_location|
247
+ mon.path template_location do |path|
248
+ path.glob '**/*.s[ac]ss'
249
+
250
+ path.update do |base, relative|
251
+ run_template_modified File.join(base, relative)
252
+ update_stylesheets(individual_files)
253
+ end
254
+
255
+ path.create do |base, relative|
256
+ run_template_created File.join(base, relative)
257
+ update_stylesheets(individual_files)
258
+ end
259
+
260
+ path.delete do |base, relative|
261
+ run_template_deleted File.join(base, relative)
262
+ css = File.join(css_location, relative.gsub(/\.s[ac]ss$/, '.css'))
263
+ try_delete_css css
264
+ update_stylesheets(individual_files)
265
+ end
266
+ end
267
+ end
268
+
269
+ individual_files.each do |template, css|
270
+ mon.file template do |path|
271
+ path.update do
272
+ run_template_modified template
273
+ update_stylesheets(individual_files)
274
+ end
275
+
276
+ path.create do
277
+ run_template_created template
278
+ update_stylesheets(individual_files)
279
+ end
280
+
281
+ path.delete do
282
+ run_template_deleted template
283
+ try_delete_css css
284
+ update_stylesheets(individual_files)
285
+ end
286
+ end
287
+ end
288
+ end
289
+ end
290
+
291
+ # Non-destructively modifies \{#options} so that default values are properly set,
292
+ # and returns the result.
293
+ #
294
+ # @param additional_options [{Symbol => Object}] An options hash with which to merge \{#options}
295
+ # @return [{Symbol => Object}] The modified options hash
296
+ def engine_options(additional_options = {})
297
+ opts = options.merge(additional_options)
298
+ opts[:load_paths] = load_paths(opts)
299
+ opts
300
+ end
301
+
302
+ # Compass expects this to exist
303
+ def stylesheet_needs_update?(css_file, template_file)
304
+ StalenessChecker.stylesheet_needs_update?(css_file, template_file)
305
+ end
306
+
307
+ private
308
+
309
+ def update_stylesheet(filename, css)
310
+ dir = File.dirname(css)
311
+ unless File.exists?(dir)
312
+ run_creating_directory dir
313
+ FileUtils.mkdir_p dir
314
+ end
315
+
316
+ begin
317
+ File.read(filename) unless File.readable?(filename) # triggers an error for handling
318
+ engine_opts = engine_options(:css_filename => css, :filename => filename)
319
+ result = Sass::Engine.for_file(filename, engine_opts).render
320
+ rescue Exception => e
321
+ run_compilation_error e, filename, css
322
+ result = Sass::SyntaxError.exception_to_css(e, options)
323
+ else
324
+ run_updating_stylesheet filename, css
325
+ end
326
+
327
+ # Finally, write the file
328
+ flag = 'w'
329
+ flag = 'wb' if Sass::Util.windows? && options[:unix_newlines]
330
+ File.open(css, flag) do |file|
331
+ file.set_encoding(result.encoding) unless Sass::Util.ruby1_8?
332
+ file.print(result)
333
+ end
334
+ end
335
+
336
+ def try_delete_css(css)
337
+ return unless File.exists?(css)
338
+ run_deleting_css css
339
+ File.delete css
340
+ end
341
+
342
+ def load_paths(opts = options)
343
+ (opts[:load_paths] || []) + template_locations
344
+ end
345
+
346
+ def template_locations
347
+ template_location_array.to_a.map {|l| l.first}
348
+ end
349
+
350
+ def css_locations
351
+ template_location_array.to_a.map {|l| l.last}
352
+ end
353
+
354
+ def css_filename(name, path)
355
+ "#{path}/#{name}".gsub(/\.s[ac]ss$/, '.css')
356
+ end
357
+ end
358
+ end