middleman 2.0.16.1 → 3.0.0.alpha.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. data/.gitignore +2 -1
  2. data/CHANGELOG +16 -8
  3. data/features/builder.feature +2 -5
  4. data/features/cache_buster.feature +1 -1
  5. data/features/clean_build.feature +0 -1
  6. data/features/coffee-script.feature +3 -3
  7. data/features/custom_layout_engines.feature +10 -0
  8. data/features/directory_index.feature +0 -1
  9. data/features/dynamic_pages.feature +0 -1
  10. data/features/fonts.feature +0 -1
  11. data/features/{padrino_helpers.feature → former_padrino_helpers.feature} +1 -1
  12. data/features/sprockets.feature +34 -5
  13. data/features/sprockets_gems.feature +7 -4
  14. data/features/step_definitions/asset_host_steps.rb +7 -6
  15. data/features/step_definitions/builder_steps.rb +4 -0
  16. data/features/step_definitions/middleman_steps.rb +22 -16
  17. data/features/step_definitions/page_layout_steps.rb +10 -8
  18. data/fixtures/custom-layout-app/config.rb +1 -0
  19. data/fixtures/custom-layout-app/source/index.html.erb +1 -0
  20. data/fixtures/custom-layout-app/source/layout.haml +6 -0
  21. data/fixtures/sprockets-app/config.rb +2 -1
  22. data/fixtures/sprockets-app/source/library/css/bootstrap_include.css.scss +1 -0
  23. data/fixtures/sprockets-app/source/library/css/plain.css +3 -0
  24. data/fixtures/sprockets-app/source/library/css/sprockets_base1.css.scss +1 -0
  25. data/fixtures/sprockets-app/source/library/css/sprockets_base2.css.scss +1 -0
  26. data/fixtures/sprockets-app/source/library/css/sprockets_sub.css.scss +1 -0
  27. data/fixtures/sprockets-app/source/{jquery_include.js → library/js/jquery_include.js} +0 -0
  28. data/fixtures/sprockets-app/source/library/js/plain.js +3 -0
  29. data/fixtures/sprockets-app/source/library/{javascripts → js}/sprockets_base.js +0 -0
  30. data/fixtures/sprockets-app/source/library/{javascripts → js}/sprockets_sub.js +0 -0
  31. data/fixtures/test-app/config.rb +5 -4
  32. data/fixtures/test-app/source/{padrino_test.html.haml → former_padrino_test.html.haml} +0 -0
  33. data/fixtures/test-app/source/stylesheets/sprockets_base1.css.scss +1 -0
  34. data/fixtures/test-app/source/stylesheets/sprockets_base2.css.scss +1 -0
  35. data/fixtures/test-app/source/stylesheets/sprockets_sub.css.scss +1 -0
  36. data/lib/middleman.rb +27 -25
  37. data/lib/middleman/base.rb +408 -166
  38. data/lib/middleman/builder.rb +78 -162
  39. data/lib/middleman/cli.rb +61 -32
  40. data/lib/middleman/core_extensions/assets.rb +4 -44
  41. data/lib/middleman/core_extensions/builder.rb +12 -16
  42. data/lib/middleman/core_extensions/compass.rb +28 -57
  43. data/lib/middleman/core_extensions/data.rb +65 -49
  44. data/lib/middleman/core_extensions/default_helpers.rb +33 -18
  45. data/lib/middleman/core_extensions/features.rb +48 -26
  46. data/lib/middleman/core_extensions/file_watcher.rb +66 -0
  47. data/lib/middleman/core_extensions/front_matter.rb +91 -86
  48. data/lib/middleman/core_extensions/rendering.rb +9 -8
  49. data/lib/middleman/core_extensions/routing.rb +19 -53
  50. data/lib/middleman/core_extensions/sitemap.rb +229 -0
  51. data/lib/middleman/core_extensions/sprockets.rb +53 -37
  52. data/lib/middleman/features/asset_host.rb +20 -10
  53. data/lib/middleman/features/automatic_image_sizes.rb +12 -9
  54. data/lib/middleman/features/cache_buster.rb +38 -25
  55. data/lib/middleman/features/directory_indexes.rb +31 -28
  56. data/lib/middleman/features/minify_css.rb +3 -2
  57. data/lib/middleman/features/minify_css/cssmin.rb +55 -0
  58. data/lib/middleman/features/minify_javascript.rb +12 -5
  59. data/lib/middleman/features/relative_assets.rb +28 -25
  60. data/lib/middleman/features/sitemap_tree.rb +34 -0
  61. data/lib/middleman/guard.rb +57 -23
  62. data/lib/middleman/renderers/erb.rb +29 -0
  63. data/lib/middleman/renderers/liquid.rb +3 -12
  64. data/lib/middleman/renderers/markdown.rb +16 -15
  65. data/lib/middleman/renderers/sass.rb +34 -38
  66. data/lib/middleman/vendor/hooks-0.2.0/CHANGES.textile +9 -0
  67. data/lib/middleman/vendor/hooks-0.2.0/Gemfile +3 -0
  68. data/lib/middleman/vendor/hooks-0.2.0/README.rdoc +107 -0
  69. data/lib/middleman/vendor/hooks-0.2.0/Rakefile +12 -0
  70. data/lib/middleman/vendor/hooks-0.2.0/hooks.gemspec +22 -0
  71. data/lib/middleman/vendor/hooks-0.2.0/lib/hooks.rb +109 -0
  72. data/lib/middleman/vendor/hooks-0.2.0/lib/hooks/inheritable_attribute.rb +33 -0
  73. data/lib/middleman/vendor/hooks-0.2.0/test/hooks_test.rb +141 -0
  74. data/lib/middleman/vendor/hooks-0.2.0/test/inheritable_attribute_test.rb +55 -0
  75. data/lib/middleman/vendor/hooks-0.2.0/test/test_helper.rb +10 -0
  76. data/lib/middleman/vendor/padrino-core-0.10.5/.document +5 -0
  77. data/lib/middleman/vendor/padrino-core-0.10.5/.gitignore +22 -0
  78. data/lib/middleman/vendor/padrino-core-0.10.5/.yardopts +1 -0
  79. data/lib/middleman/vendor/padrino-core-0.10.5/LICENSE.txt +20 -0
  80. data/lib/middleman/vendor/padrino-core-0.10.5/README.rdoc +294 -0
  81. data/lib/middleman/vendor/padrino-core-0.10.5/Rakefile +5 -0
  82. data/lib/middleman/vendor/padrino-core-0.10.5/bin/padrino +9 -0
  83. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core.rb +167 -0
  84. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/application.rb +270 -0
  85. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/application/rendering.rb +292 -0
  86. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/application/routing.rb +934 -0
  87. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/application/showexceptions.rb +20 -0
  88. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/caller.rb +53 -0
  89. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/cli/adapter.rb +24 -0
  90. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/cli/base.rb +151 -0
  91. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/cli/console.rb +20 -0
  92. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/cli/rake.rb +24 -0
  93. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/cli/rake_tasks.rb +59 -0
  94. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/command.rb +38 -0
  95. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/images/404.png +0 -0
  96. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/images/500.png +0 -0
  97. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/loader.rb +210 -0
  98. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/cs.yml +34 -0
  99. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/da.yml +34 -0
  100. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/de.yml +34 -0
  101. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/en.yml +34 -0
  102. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/es.yml +34 -0
  103. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/fr.yml +34 -0
  104. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/hu.yml +34 -0
  105. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/it.yml +40 -0
  106. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/ja.yml +34 -0
  107. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/lv.yml +34 -0
  108. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/nl.yml +34 -0
  109. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/no.yml +35 -0
  110. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/pl.yml +34 -0
  111. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/pt_br.yml +40 -0
  112. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/ru.yml +35 -0
  113. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/tr.yml +34 -0
  114. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/uk.yml +34 -0
  115. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/zh_cn.yml +34 -0
  116. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/zh_tw.yml +34 -0
  117. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/logger.rb +345 -0
  118. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/mounter.rb +224 -0
  119. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/reloader.rb +254 -0
  120. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/router.rb +98 -0
  121. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/server.rb +79 -0
  122. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/support_lite.rb +199 -0
  123. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/tasks.rb +21 -0
  124. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/version.rb +20 -0
  125. data/lib/middleman/vendor/padrino-core-0.10.5/padrino-core.gemspec +38 -0
  126. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/apps/.components +6 -0
  127. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/apps/.gitignore +7 -0
  128. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/apps/complex.rb +32 -0
  129. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/apps/simple.rb +33 -0
  130. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/a.rb +9 -0
  131. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/b.rb +4 -0
  132. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/c.rb +1 -0
  133. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/circular/e.rb +13 -0
  134. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/circular/f.rb +2 -0
  135. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/circular/g.rb +2 -0
  136. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/d.rb +4 -0
  137. data/lib/middleman/vendor/padrino-core-0.10.5/test/helper.rb +81 -0
  138. data/lib/middleman/vendor/padrino-core-0.10.5/test/mini_shoulda.rb +45 -0
  139. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_application.rb +108 -0
  140. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_core.rb +79 -0
  141. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_dependencies.rb +44 -0
  142. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_filters.rb +278 -0
  143. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_locale.rb +21 -0
  144. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_logger.rb +100 -0
  145. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_mounter.rb +177 -0
  146. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_reloader_complex.rb +75 -0
  147. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_reloader_simple.rb +98 -0
  148. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_rendering.rb +461 -0
  149. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_restful_routing.rb +33 -0
  150. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_router.rb +146 -0
  151. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_routing.rb +1673 -0
  152. data/lib/middleman/vendor/padrino-helpers-0.10.5/.document +5 -0
  153. data/lib/middleman/vendor/padrino-helpers-0.10.5/.gitignore +21 -0
  154. data/lib/middleman/vendor/padrino-helpers-0.10.5/.yardopts +1 -0
  155. data/lib/middleman/vendor/padrino-helpers-0.10.5/LICENSE.txt +20 -0
  156. data/lib/middleman/vendor/padrino-helpers-0.10.5/README.rdoc +239 -0
  157. data/lib/middleman/vendor/padrino-helpers-0.10.5/Rakefile +5 -0
  158. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers.rb +58 -0
  159. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/asset_tag_helpers.rb +420 -0
  160. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/form_builder/abstract_form_builder.rb +220 -0
  161. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/form_builder/standard_form_builder.rb +43 -0
  162. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/form_helpers.rb +602 -0
  163. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/format_helpers.rb +381 -0
  164. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/cs.yml +103 -0
  165. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/da.yml +91 -0
  166. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/de.yml +81 -0
  167. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/en.yml +103 -0
  168. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/es.yml +103 -0
  169. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/fr.yml +80 -0
  170. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/hu.yml +103 -0
  171. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/it.yml +89 -0
  172. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/ja.yml +103 -0
  173. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/lv.yml +103 -0
  174. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/nl.yml +82 -0
  175. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/no.yml +91 -0
  176. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/pl.yml +95 -0
  177. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/pt_br.yml +103 -0
  178. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/ru.yml +103 -0
  179. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/tr.yml +103 -0
  180. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/uk.yml +103 -0
  181. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/zh_cn.yml +104 -0
  182. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/zh_tw.yml +103 -0
  183. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/number_helpers.rb +288 -0
  184. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/output_helpers.rb +175 -0
  185. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/output_helpers/abstract_handler.rb +98 -0
  186. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/output_helpers/erb_handler.rb +79 -0
  187. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/output_helpers/haml_handler.rb +63 -0
  188. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/output_helpers/slim_handler.rb +81 -0
  189. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/render_helpers.rb +60 -0
  190. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/tag_helpers.rb +103 -0
  191. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/translation_helpers.rb +38 -0
  192. data/lib/middleman/vendor/padrino-helpers-0.10.5/padrino-helpers.gemspec +27 -0
  193. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/app.rb +73 -0
  194. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/capture_concat.erb +14 -0
  195. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/capture_concat.haml +12 -0
  196. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/capture_concat.slim +13 -0
  197. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_for.erb +14 -0
  198. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_for.haml +12 -0
  199. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_for.slim +12 -0
  200. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_tag.erb +11 -0
  201. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_tag.haml +9 -0
  202. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_tag.slim +9 -0
  203. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/current_engine.erb +5 -0
  204. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/current_engine.haml +5 -0
  205. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/current_engine.slim +5 -0
  206. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/fields_for.erb +20 -0
  207. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/fields_for.haml +15 -0
  208. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/fields_for.slim +15 -0
  209. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_for.erb +56 -0
  210. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_for.haml +47 -0
  211. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_for.slim +47 -0
  212. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_tag.erb +56 -0
  213. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_tag.haml +45 -0
  214. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_tag.slim +45 -0
  215. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/link_to.erb +5 -0
  216. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/link_to.haml +4 -0
  217. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/link_to.slim +4 -0
  218. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/mail_to.erb +3 -0
  219. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/mail_to.haml +3 -0
  220. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/mail_to.slim +3 -0
  221. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/meta_tag.erb +3 -0
  222. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/meta_tag.haml +3 -0
  223. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/meta_tag.slim +3 -0
  224. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/partials/_erb.erb +1 -0
  225. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/partials/_haml.haml +1 -0
  226. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/partials/_slim.slim +1 -0
  227. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/simple_partial.erb +1 -0
  228. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/simple_partial.haml +1 -0
  229. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/simple_partial.slim +1 -0
  230. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/app.rb +50 -0
  231. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/current_engine.haml +5 -0
  232. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/current_engines/_erb.erb +1 -0
  233. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/current_engines/_haml.haml +1 -0
  234. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/current_engines/_slim.slim +1 -0
  235. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/erb/test.erb +1 -0
  236. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/explicit_engine.haml +5 -0
  237. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/haml/test.haml +1 -0
  238. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/template/_user.haml +7 -0
  239. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/template/haml_template.haml +1 -0
  240. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/template/some_template.haml +2 -0
  241. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/helper.rb +66 -0
  242. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_asset_tag_helpers.rb +320 -0
  243. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_form_builder.rb +996 -0
  244. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_form_helpers.rb +645 -0
  245. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_format_helpers.rb +227 -0
  246. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_locale.rb +20 -0
  247. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_number_helpers.rb +136 -0
  248. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_output_helpers.rb +153 -0
  249. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_render_helpers.rb +76 -0
  250. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_tag_helpers.rb +105 -0
  251. data/lib/middleman/version.rb +1 -1
  252. data/middleman-x86-mingw32.gemspec +16 -33
  253. data/middleman.gemspec +16 -31
  254. metadata +590 -349
  255. data/features/sinatra.feature +0 -6
  256. data/lib/middleman/core_extensions/rack_map.rb +0 -35
  257. data/lib/middleman/renderers/coffee_script.rb +0 -8
  258. data/lib/middleman/renderers/haml.rb +0 -31
  259. data/lib/middleman/renderers/slim.rb +0 -8
@@ -2,56 +2,16 @@ module Middleman::CoreExtensions::Assets
2
2
  class << self
3
3
  def registered(app)
4
4
  # Disable Padrino cache buster until explicitly enabled
5
- app.set :asset_stamp, false
5
+ # app.set :asset_stamp, false
6
6
 
7
- app.extend ClassMethods
8
-
9
- app.helpers Helpers
10
-
11
- app.register_asset_handler :base do |path, prefix, request|
12
- path.include?("://") ? path : File.join(app.http_prefix || "/", prefix, path)
13
- end
7
+ app.send :include, InstanceMethod
14
8
  end
15
9
  alias :included :registered
16
10
  end
17
11
 
18
- module ClassMethods
19
- def register_asset_handler(handler_name, &block)
20
- @asset_handler_map ||= []
21
- @asset_handler_stack ||= []
22
-
23
- if block_given?
24
- @asset_handler_stack << block
25
- @asset_handler_map << handler_name
26
- end
27
- end
28
-
29
- def asset_handler_get_url(path, prefix="", request=nil)
30
- @asset_handler_map ||= []
31
- @asset_handler_stack ||= []
32
-
33
- @asset_handler_stack.last.call(path, prefix, request)
34
- end
35
-
36
- def before_asset_handler(position, *args)
37
- @asset_handler_map ||= []
38
- @asset_handler_stack ||= []
39
-
40
- current_index = @asset_handler_map.index(position)
41
- return nil unless current_index
42
-
43
- previous = current_index - 1
44
- if (previous >= 0) && (previous < @asset_handler_map.length)
45
- @asset_handler_stack[previous].call(*args)
46
- else
47
- nil
48
- end
49
- end
50
- end
51
-
52
- module Helpers
12
+ module InstanceMethod
53
13
  def asset_url(path, prefix="")
54
- self.class.asset_handler_get_url(path, prefix, request)
14
+ path.include?("://") ? path : File.join(self.http_prefix || "/", prefix, path)
55
15
  end
56
16
  end
57
17
  end
@@ -1,34 +1,30 @@
1
1
  module Middleman::CoreExtensions::Builder
2
2
  class << self
3
3
  def registered(app)
4
+ app.define_hook :after_build
4
5
  app.extend ClassMethods
6
+ app.send :include, InstanceMethods
5
7
  end
6
8
  end
7
9
 
8
10
  module ClassMethods
9
- # Add a block/proc to be run after features have been setup
10
- def after_build(&block)
11
- @run_after_build ||= []
12
- @run_after_build << block
13
- end
14
-
15
- def after_build_callbacks
16
- @run_after_build ||= []
17
- @run_after_build
18
- end
19
-
20
11
  def build_reroute(&block)
21
12
  @build_rerouters ||= []
22
- @build_rerouters << block
13
+ @build_rerouters << block if block_given?
14
+ @build_rerouters
15
+ end
16
+ end
17
+
18
+ module InstanceMethods
19
+ def build_reroute(&block)
20
+ self.class.build_reroute(&block)
23
21
  end
24
22
 
25
23
  def reroute_builder(desination, request_path)
26
- @build_rerouters ||= []
27
-
28
24
  result = [desination, request_path]
29
25
 
30
- @build_rerouters.each do |block|
31
- output = block.call(desination, request_path)
26
+ build_reroute.each do |block|
27
+ output = instance_exec(desination, request_path, &block)
32
28
  if output
33
29
  result = output
34
30
  break
@@ -1,18 +1,12 @@
1
+ require "compass"
2
+
1
3
  module Middleman::CoreExtensions::Compass
2
4
  class << self
3
5
  def registered(app)
4
6
  # Where to look for fonts
5
7
  app.set :fonts_dir, "fonts"
6
-
7
- app.extend ClassMethods
8
-
9
- require "compass"
10
-
11
- # Susy grids
12
- begin
13
- require "susy"
14
- rescue LoadError
15
- end
8
+ app.define_hook :compass_config
9
+ app.define_hook :after_compass_config
16
10
 
17
11
  app.after_configuration do
18
12
  # Support a stand-alone compass config file
@@ -24,60 +18,51 @@ module Middleman::CoreExtensions::Compass
24
18
  # * line_comments
25
19
  # * sprite_engine
26
20
  # * chunky_png_options
27
- compass_config_file = File.join(app.root, "compass.config")
21
+ compass_config_file = File.join(self.root, "compass.config")
28
22
  if File.exists?(compass_config_file)
29
23
  ::Compass.add_project_configuration(compass_config_file)
30
24
  end
31
25
 
32
26
  ::Compass.configuration do |config|
33
- config.project_path = app.root
27
+ config.project_path = self.root
34
28
  config.environment = :development
35
- config.cache_path = File.join(app.root, ".sass-cache")
29
+ config.cache_path = File.join(self.root, ".sass-cache")
36
30
 
37
- views_root = File.basename(app.views)
38
- config.sass_dir = File.join(views_root, app.css_dir)
39
- config.css_dir = File.join(views_root, app.css_dir)
40
- config.javascripts_dir = File.join(views_root, app.js_dir)
41
- config.fonts_dir = File.join(views_root, app.fonts_dir)
42
- config.images_dir = File.join(views_root, app.images_dir)
31
+ views_root = File.basename(self.views)
32
+ config.sass_dir = File.join(views_root, self.css_dir)
33
+ config.css_dir = File.join(views_root, self.css_dir)
34
+ config.javascripts_dir = File.join(views_root, self.js_dir)
35
+ config.fonts_dir = File.join(views_root, self.fonts_dir)
36
+ config.images_dir = File.join(views_root, self.images_dir)
43
37
 
44
- config.http_images_path = if app.respond_to? :http_images_path
45
- app.http_images_path
38
+ config.http_images_path = if self.respond_to? :http_images_path
39
+ self.http_images_path
46
40
  else
47
- File.join(app.http_prefix || "/", app.images_dir)
48
- end
49
-
50
- # Correctly support HTTP paths with generated sprites
51
- if config.respond_to? :http_generated_images_path
52
- config.http_generated_images_path = if app.respond_to? :http_generated_images_path
53
- app.http_generated_images_path
54
- else
55
- File.join(app.http_prefix || "/", app.images_dir)
56
- end
41
+ File.join(self.http_prefix || "/", self.images_dir)
57
42
  end
58
43
 
59
- config.http_stylesheets_path = if app.respond_to? :http_css_path
60
- app.http_css_path
44
+ config.http_stylesheets_path = if self.respond_to? :http_css_path
45
+ self.http_css_path
61
46
  else
62
- File.join(app.http_prefix || "/", app.css_dir)
47
+ File.join(self.http_prefix || "/", self.css_dir)
63
48
  end
64
49
 
65
- config.http_javascripts_path = if app.respond_to? :http_js_path
66
- app.http_js_path
50
+ config.http_javascripts_path = if self.respond_to? :http_js_path
51
+ self.http_js_path
67
52
  else
68
- File.join(app.http_prefix || "/", app.js_dir)
53
+ File.join(self.http_prefix || "/", self.js_dir)
69
54
  end
70
55
 
71
- config.http_fonts_path = if app.respond_to? :http_fonts_path
72
- app.http_fonts_path
56
+ config.http_fonts_path = if self.respond_to? :http_fonts_path
57
+ self.http_fonts_path
73
58
  else
74
- File.join(app.http_prefix || "/", app.fonts_dir)
59
+ File.join(self.http_prefix || "/", self.fonts_dir)
75
60
  end
76
61
 
77
62
  config.asset_cache_buster :none
78
63
  config.output_style = :nested
79
64
 
80
- config.add_import_path(config.sass_dir)
65
+ # config.add_import_path(config.sass_dir)
81
66
  end
82
67
 
83
68
  # Required for relative paths
@@ -92,24 +77,10 @@ module Middleman::CoreExtensions::Compass
92
77
  end
93
78
  end
94
79
 
95
- app.execute_after_compass_init!
96
-
97
- app.set :sass, ::Compass.configuration.to_sass_engine_options
80
+ run_hook :compass_config, ::Compass.configuration
81
+ run_hook :after_compass_config
98
82
  end
99
83
  end
100
84
  alias :included :registered
101
85
  end
102
-
103
- module ClassMethods
104
- # Add a block/proc to be run after features have been setup
105
- def compass_config(&block)
106
- @run_after_compass ||= []
107
- @run_after_compass << block
108
- end
109
-
110
- def execute_after_compass_init!
111
- @run_after_compass ||= []
112
- @run_after_compass.each { |block| block.call(::Compass.configuration) }
113
- end
114
- end
115
86
  end
@@ -6,21 +6,70 @@ module Middleman::CoreExtensions::Data
6
6
  class << self
7
7
  def registered(app)
8
8
  app.set :data_dir, "data"
9
- app.extend ClassMethods
10
- app.helpers Helpers
9
+ app.send :include, InstanceMethods
11
10
  end
12
11
  alias :included :registered
13
12
  end
14
13
 
15
- module Helpers
14
+ module InstanceMethods
15
+ def initialize
16
+ file_changed DataStore.matcher do |file|
17
+ data.touch_file(file) if file.match(%r{^#{data_dir}\/})
18
+ end
19
+
20
+ file_deleted DataStore.matcher do |file|
21
+ data.remove_file(file) if file.match(%r{^#{data_dir}\/})
22
+ end
23
+
24
+ super
25
+ end
26
+
16
27
  def data
17
- self.class.data
28
+ @data ||= DataStore.new(self)
29
+ end
30
+
31
+ # Makes a hash available on the data var with a given name
32
+ def data_content(name, content)
33
+ DataStore.data_content(name, content)
34
+ end
35
+
36
+ # Makes a hash available on the data var with a given name
37
+ def data_callback(name, &block)
38
+ DataStore.data_callback(name, block)
18
39
  end
19
40
  end
20
41
 
21
- class DataObject
42
+ class DataStore
43
+ def self.matcher
44
+ %r{[\w-]+\.(yml|yaml|json)$}
45
+ end
46
+
22
47
  def initialize(app)
23
48
  @app = app
49
+ @local_data = {}
50
+ end
51
+
52
+ def touch_file(file)
53
+ file = File.expand_path(file, @app.root)
54
+ extension = File.extname(file)
55
+ basename = File.basename(file, extension)
56
+
57
+ if %w(.yaml .yml).include?(extension)
58
+ data = YAML.load_file(file)
59
+ elsif extension == ".json"
60
+ data = ActiveSupport::JSON.decode(File.read(file))
61
+ else
62
+ return
63
+ end
64
+
65
+ # @app.logger.debug :data_update, Time.now, basename if @app.logging?
66
+ @local_data[basename] = recursively_enhance(data)
67
+ end
68
+
69
+ def remove_file(file)
70
+ extension = File.extname(file)
71
+ basename = File.basename(file, extension)
72
+ @local_data.delete(basename) if @local_data.has_key?(basename)
24
73
  end
25
74
 
26
75
  def data_for_path(path)
@@ -33,32 +82,23 @@ module Middleman::CoreExtensions::Data
33
82
  response = @@local_sources[path.to_s]
34
83
  elsif @@callback_sources.has_key?(path.to_s)
35
84
  response = @@callback_sources[path.to_s].call()
36
- else
37
- file_path = File.join(@app.root, @app.data_dir, "#{path}.yml")
38
- if File.exists? file_path
39
- response = YAML.load_file(file_path)
40
- else
41
- file_path = File.join(@app.root, @app.data_dir, "#{path}.yaml")
42
- if File.exists? file_path
43
- response = YAML.load_file(file_path)
44
- else
45
- file_path = File.join(@app.root, @app.data_dir, "#{path}.json")
46
- response = ActiveSupport::JSON.decode(File.read(file_path)) if File.exists? file_path
47
- end
48
- end
49
85
  end
50
86
 
51
87
  response
52
88
  end
53
89
 
54
90
  def method_missing(path)
55
- result = data_for_path(path)
56
-
57
- if result
58
- recursively_enhance(result)
91
+ if @local_data.has_key?(path.to_s)
92
+ return @local_data[path.to_s]
59
93
  else
60
- super
94
+ result = data_for_path(path)
95
+
96
+ if result
97
+ return recursively_enhance(result)
98
+ end
61
99
  end
100
+
101
+ super
62
102
  end
63
103
 
64
104
  def to_h
@@ -75,16 +115,8 @@ module Middleman::CoreExtensions::Data
75
115
  data[k] = data_for_path(k)
76
116
  end
77
117
 
78
- yaml_path = File.join(@app.root, @app.data_dir, "*.{yaml,yml}")
79
- Dir[yaml_path].each do |f|
80
- p = f.split("/").last.gsub(".yml", "").gsub(".yaml", "")
81
- data[p] = data_for_path(p)
82
- end
83
-
84
- json_path = File.join(@app.root, @app.data_dir, "*.json")
85
- Dir[json_path].each do |f|
86
- p = f.split("/").last.gsub(".json", "")
87
- data[p] = data_for_path(p)
118
+ (@local_data || {}).each do |k, v|
119
+ data[k] = v
88
120
  end
89
121
 
90
122
  data
@@ -118,20 +150,4 @@ module Middleman::CoreExtensions::Data
118
150
  end
119
151
  end
120
152
  end
121
-
122
- module ClassMethods
123
- def data
124
- @data ||= DataObject.new(self)
125
- end
126
-
127
- # Makes a hash available on the data var with a given name
128
- def data_content(name, content)
129
- DataObject.data_content(name, content)
130
- end
131
-
132
- # Makes a hash available on the data var with a given name
133
- def data_callback(name, &block)
134
- DataObject.data_callback(name, block)
135
- end
136
- end
137
153
  end
@@ -1,12 +1,26 @@
1
- require "padrino-helpers"
1
+ require "middleman/vendor/padrino-core-0.10.5/lib/padrino-core/support_lite"
2
+ require 'i18n'
3
+ require 'enumerator'
4
+ require 'active_support/core_ext/string/conversions' # to_date
5
+ require 'active_support/core_ext/float/rounding' # round
6
+ require 'active_support/option_merger' # with_options
7
+ require 'active_support/core_ext/object/with_options' # with_options
8
+ require 'active_support/inflector' # humanize
9
+
10
+ FileSet.glob_require('../vendor/padrino-helpers-0.10.5/lib/padrino-helpers/**/*.rb', __FILE__)
2
11
 
3
12
  module Middleman::CoreExtensions::DefaultHelpers
4
13
  class << self
5
14
  def registered(app)
6
- # Use Padrino Helpers
7
- app.register Padrino::Helpers
15
+ app.helpers ::Padrino::Helpers::OutputHelpers
16
+ app.helpers ::Padrino::Helpers::TagHelpers
17
+ app.helpers ::Padrino::Helpers::AssetTagHelpers
18
+ app.helpers ::Padrino::Helpers::FormHelpers
19
+ app.helpers ::Padrino::Helpers::FormatHelpers
20
+ app.helpers ::Padrino::Helpers::RenderHelpers
21
+ app.helpers ::Padrino::Helpers::NumberHelpers
22
+ app.helpers ::Padrino::Helpers::TranslationHelpers
8
23
 
9
- # Middleman Helpers
10
24
  app.helpers Helpers
11
25
  end
12
26
  alias :included :registered
@@ -28,25 +42,27 @@ module Middleman::CoreExtensions::DefaultHelpers
28
42
  def auto_tag(asset_ext, separator="/", asset_dir=nil)
29
43
  if asset_dir.nil?
30
44
  asset_dir = case asset_ext
31
- when :js then self.class.js_dir
32
- when :css then self.class.css_dir
45
+ when :js then self.js_dir
46
+ when :css then self.css_dir
33
47
  end
34
48
  end
35
- path = request.path_info.dup
49
+
36
50
  # If the basename of the request as no extension, assume we are serving a
37
51
  # directory and join index_file to the path.
38
- path = File.join(path, self.class.index_file) if File.extname(path).empty?
39
- path = path.gsub(%r{^/}, '')
52
+ path = full_path(current_path.dup)
53
+
54
+ path = path.sub(%r{^/}, '')
40
55
  path = path.gsub(File.extname(path), ".#{asset_ext}")
41
56
  path = path.gsub("/", separator)
42
57
 
43
- view = File.join(self.class.views, asset_dir, path)
44
- yield path if File.exists?(view) or Dir["#{view}.*"].any?
58
+ matching_file = resolve_template(File.join(asset_dir, path))
59
+
60
+ yield path if matching_file
45
61
  end
46
62
 
47
63
  def page_classes
48
- path = request.path_info.dup
49
- path << settings.index_file if path.match(%r{/$})
64
+ path = current_path.dup
65
+ path << self.index_file if path.match(%r{/$})
50
66
  path = path.gsub(%r{^/}, '')
51
67
 
52
68
  classes = []
@@ -60,9 +76,9 @@ module Middleman::CoreExtensions::DefaultHelpers
60
76
  def asset_path(kind, source)
61
77
  return source if source =~ /^http/
62
78
  asset_folder = case kind
63
- when :css then settings.css_dir
64
- when :js then settings.js_dir
65
- when :images then settings.images_dir
79
+ when :css then self.css_dir
80
+ when :js then self.js_dir
81
+ when :images then self.images_dir
66
82
  else kind.to_s
67
83
  end
68
84
  source = source.to_s.gsub(/\s/, '')
@@ -70,8 +86,7 @@ module Middleman::CoreExtensions::DefaultHelpers
70
86
  source << ".#{kind}" unless ignore_extension or source =~ /\.#{kind}/
71
87
  result_path = source if source =~ %r{^/} # absolute path
72
88
  result_path ||= asset_url(source, asset_folder)
73
- timestamp = asset_timestamp(result_path)
74
- "#{result_path}#{timestamp}"
89
+ "#{result_path}"
75
90
  end
76
91
  end
77
92
  end