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
@@ -0,0 +1,60 @@
1
+ module Padrino
2
+ module Helpers
3
+ ##
4
+ # Helpers related to rendering within templates (i.e partials).
5
+ #
6
+ module RenderHelpers
7
+ ##
8
+ # Render a partials with collections support
9
+ #
10
+ # @param [String] template
11
+ # Relative path to partial template.
12
+ # @param [Hash] options
13
+ # Options hash for rendering options.
14
+ # @option options [Object] :object
15
+ # Object rendered in partial.
16
+ # @option options [Array<Object>] :collection
17
+ # Partial is rendered for each object in this collection.
18
+ # @option options [Hash] :locals ({})
19
+ # Local variables accessible in the partial.
20
+ # @option options [Symbol] :engine
21
+ # Explicit rendering engine to use for this partial
22
+ #
23
+ # @return [String] The html generated from this partial.
24
+ #
25
+ # @example
26
+ # partial 'photo/item', :object => @photo
27
+ # partial 'photo/item', :collection => @photos
28
+ # partial 'photo/item', :locals => { :foo => :bar }
29
+ # partial 'photo/item', :engine => :erb
30
+ #
31
+ # @note If using this from Sinatra, pass explicit +:engine+ option
32
+ #
33
+ # @api public
34
+ def partial(template, options={})
35
+ options.reverse_merge!(:locals => {}, :layout => false)
36
+ path = template.to_s.split(File::SEPARATOR)
37
+ object_name = path[-1].to_sym
38
+ path[-1] = "_#{path[-1]}"
39
+ explicit_engine = options.delete(:engine)
40
+ template_path = File.join(path).to_sym
41
+ raise 'Partial collection specified but is nil' if options.has_key?(:collection) && options[:collection].nil?
42
+ if collection = options.delete(:collection)
43
+ options.delete(:object)
44
+ counter = 0
45
+ collection.map { |member|
46
+ counter += 1
47
+ options[:locals].merge!(object_name => member, "#{object_name}_counter".to_sym => counter)
48
+ render(explicit_engine, template_path, options.dup)
49
+ }.join("\n")
50
+ else
51
+ if member = options.delete(:object)
52
+ options[:locals].merge!(object_name => member)
53
+ end
54
+ render(explicit_engine, template_path, options.dup)
55
+ end
56
+ end
57
+ alias :render_partial :partial
58
+ end # RenderHelpers
59
+ end # Helpers
60
+ end # Padrino
@@ -0,0 +1,103 @@
1
+ module Padrino
2
+ module Helpers
3
+ ##
4
+ # Helpers related to producing html tags within templates.
5
+ #
6
+ module TagHelpers
7
+ ##
8
+ # Tag values escaped to html entities
9
+ #
10
+ ESCAPE_VALUES = {
11
+ "<" => "&lt;",
12
+ ">" => "&gt;",
13
+ '"' => "&quot;"
14
+ }
15
+
16
+ ##
17
+ # Creates an html tag with given name, content and options
18
+ #
19
+ # @overload content_tag(name, content, options)
20
+ # @param [Symbol] name The html type of tag.
21
+ # @param [String] content The contents in the tag.
22
+ # @param [Hash] options The html options to include in this tag.
23
+ # @overload content_tag(name, options, &block)
24
+ # @param [Symbol] name The html type of tag.
25
+ # @param [Hash] options The html options to include in this tag.
26
+ # @param [Proc] block The block returning html content
27
+ #
28
+ # @return [String] The html generated for the tag.
29
+ #
30
+ # @example
31
+ # content_tag(:p, "hello", :class => 'light')
32
+ # content_tag(:p, :class => 'dark') { ... }
33
+ #
34
+ # @api public
35
+ def content_tag(*args, &block)
36
+ name = args.first
37
+ options = args.extract_options!
38
+ tag_html = block_given? ? capture_html(&block) : args[1]
39
+ tag_result = tag(name, options.merge(:content => tag_html))
40
+ block_is_template?(block) ? concat_content(tag_result) : tag_result
41
+ end
42
+
43
+ ##
44
+ # Creates an html input field with given type and options
45
+ #
46
+ # @param [Symbol] type
47
+ # The html type of tag to create.
48
+ # @param [Hash] options
49
+ # The html options to include in this tag.
50
+ #
51
+ # @return [String] The html for the input tag.
52
+ #
53
+ # @example
54
+ # input_tag :text, :class => "test"
55
+ # input_tag :password, :size => "20"
56
+ #
57
+ # @api semipublic
58
+ def input_tag(type, options = {})
59
+ options.reverse_merge!(:type => type)
60
+ tag(:input, options)
61
+ end
62
+
63
+ ##
64
+ # Creates an html tag with the given name and options
65
+ #
66
+ # @param [Symbol] type
67
+ # The html type of tag to create.
68
+ # @param [Hash] options
69
+ # The html options to include in this tag.
70
+ #
71
+ # @return [String] The html for the input tag.
72
+ #
73
+ # @example
74
+ # tag(:br, :style => 'clear:both')
75
+ # tag(:p, :content => "hello", :class => 'large')
76
+ #
77
+ # @api public
78
+ def tag(name, options={})
79
+ content, open_tag = options.delete(:content), options.delete(:open)
80
+ content = content.join("\n") if content.respond_to?(:join)
81
+ identity_tag_attributes.each { |attr| options[attr] = attr.to_s if options[attr] }
82
+ html_attrs = options.map { |a, v| v.nil? || v == false ? nil : "#{a}=\"#{escape_value(v)}\"" }.compact.join(" ")
83
+ base_tag = (html_attrs.present? ? "<#{name} #{html_attrs}" : "<#{name}")
84
+ base_tag << (open_tag ? ">" : (content ? ">#{content}</#{name}>" : " />"))
85
+ end
86
+
87
+ private
88
+ ##
89
+ # Returns a list of attributes which can only contain an identity value (i.e selected)
90
+ #
91
+ def identity_tag_attributes
92
+ [:checked, :disabled, :selected, :multiple]
93
+ end
94
+
95
+ ##
96
+ # Escape tag values to their HTML/XML entities.
97
+ #
98
+ def escape_value(string)
99
+ string.to_s.gsub(Regexp.union(*ESCAPE_VALUES.keys)){|c| ESCAPE_VALUES[c] }
100
+ end
101
+ end # TagHelpers
102
+ end # Helpers
103
+ end # Padrino
@@ -0,0 +1,38 @@
1
+ module Padrino
2
+ module Helpers
3
+ ##
4
+ # Helpers related to locale1 i18n translation within templates.
5
+ #
6
+ module TranslationHelpers
7
+ ##
8
+ # Delegates to I18n.translate with no additional functionality.
9
+ #
10
+ # @param [Symbol] *args
11
+ # The keys to retrieve.
12
+ #
13
+ # @return [String]
14
+ # The translation for the specified keys.
15
+ #
16
+ # @api public
17
+ def translate(*args)
18
+ I18n.translate(*args)
19
+ end
20
+ alias :t :translate
21
+
22
+ ##
23
+ # Delegates to I18n.localize with no additional functionality.
24
+ #
25
+ # @param [Symbol] *args
26
+ # The keys to retrieve.
27
+ #
28
+ # @return [String]
29
+ # The translation for the specified keys.
30
+ #
31
+ # @api public
32
+ def localize(*args)
33
+ I18n.localize(*args)
34
+ end
35
+ alias :l :localize
36
+ end # TranslationHelpers
37
+ end # Helpers
38
+ end # Padrino
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env gem build
2
+ # encoding: utf-8
3
+
4
+ require File.expand_path("../../padrino-core/lib/padrino-core/version.rb", __FILE__)
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "padrino-helpers"
8
+ s.rubyforge_project = "padrino-helpers"
9
+ s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
10
+ s.email = "padrinorb@gmail.com"
11
+ s.summary = "Helpers for padrino"
12
+ s.homepage = "http://www.padrinorb.com"
13
+ s.description = "Tag helpers, asset helpers, form helpers, form builders and many more helpers for padrino"
14
+ s.required_rubygems_version = ">= 1.3.6"
15
+ s.version = Padrino.version
16
+ s.date = Time.now.strftime("%Y-%m-%d")
17
+
18
+ s.extra_rdoc_files = Dir["*.rdoc"]
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ s.require_paths = ["lib"]
23
+ s.rdoc_options = ["--charset=UTF-8"]
24
+
25
+ s.add_dependency("padrino-core", Padrino.version)
26
+ s.add_dependency("i18n", "~> 0.6")
27
+ end
@@ -0,0 +1,73 @@
1
+ require 'sinatra/base'
2
+ require 'haml'
3
+ require 'erubis'
4
+ require 'slim'
5
+
6
+ class MarkupDemo < Sinatra::Base
7
+ register Padrino::Helpers
8
+
9
+ configure do
10
+ set :root, File.dirname(__FILE__)
11
+ end
12
+
13
+ get '/:engine/:file' do
14
+ show(params[:engine], params[:file].to_sym)
15
+ end
16
+
17
+ helpers do
18
+ # show :erb, :index
19
+ # show :haml, :index
20
+ def show(kind, template)
21
+ send kind.to_sym, template.to_sym
22
+ end
23
+
24
+ def captured_content(&block)
25
+ content_html = capture_html(&block)
26
+ "<p>#{content_html}</p>"
27
+ end
28
+
29
+ def concat_in_p(content_html)
30
+ concat_content "<p>#{content_html}</p>"
31
+ end
32
+
33
+ def determine_block_is_template(name, &block)
34
+ concat_content "<p class='is_template'>The #{name} block passed in is a template</p>" if block_is_template?(block)
35
+ end
36
+
37
+ def ruby_not_template_block
38
+ determine_block_is_template('ruby') do
39
+ content_tag(:span, "This not a template block")
40
+ end
41
+ end
42
+ end
43
+ end
44
+
45
+ class MarkupUser
46
+ def errors; { :fake => "must be valid", :second => "must be present", :third => "must be a number", :email => "must be a email"}; end
47
+ def session_id; 45; end
48
+ def gender; 'male'; end
49
+ def remember_me; '1'; end
50
+ def permission; Permission.new; end
51
+ def telephone; Telephone.new; end
52
+ def addresses; [Address.new('Greenfield', true), Address.new('Willowrun', false)]; end
53
+ end
54
+
55
+ class Telephone
56
+ def number; "62634576545"; end
57
+ end
58
+
59
+ class Address
60
+ attr_accessor :name
61
+ def initialize(name, existing); @name, @existing = name, existing; end
62
+ def new_record?; !@existing; end
63
+ def id; @existing ? 25 : nil; end
64
+ end
65
+
66
+ class Permission
67
+ def can_edit; true; end
68
+ def can_delete; false; end
69
+ end
70
+
71
+ module Outer
72
+ class UserAccount; end
73
+ end
@@ -0,0 +1,14 @@
1
+ <% @content = captured_content do %>
2
+ <span>Captured Line 1</span>
3
+ <span>Captured Line 2</span>
4
+ <% end %>
5
+ <%= @content %>
6
+
7
+ <% concat_in_p('Concat Line 3') %>
8
+
9
+ <% determine_block_is_template('erb') do %>
10
+ <span>This is erb</span>
11
+ <span>This is erb</span>
12
+ <% end %>
13
+
14
+ <% ruby_not_template_block %>
@@ -0,0 +1,12 @@
1
+ - @content = captured_content do
2
+ %span Captured Line 1
3
+ %span Captured Line 2
4
+ = @content
5
+
6
+ - concat_in_p('Concat Line 3')
7
+
8
+ - determine_block_is_template('haml') do
9
+ %span This is haml
10
+ %span This is haml
11
+
12
+ - ruby_not_template_block
@@ -0,0 +1,13 @@
1
+ -@content = captured_content do
2
+ span Captured Line 1
3
+ span Captured Line 2
4
+
5
+ ==@content
6
+
7
+ ==determine_block_is_template('slim') do
8
+ span This is slim
9
+ span This is slim
10
+
11
+ ==concat_in_p('Concat Line 3')
12
+
13
+ ==ruby_not_template_block
@@ -0,0 +1,14 @@
1
+ <% content_for :demo do %>
2
+ <h1>This is content yielded from a content_for</h1>
3
+ <% end %>
4
+
5
+ <div class='demo'><%= yield_content :demo %></div>
6
+
7
+ <% content_for :demo2 do |fname, lname| %>
8
+ <h1>This is content yielded with name <%= fname + " " + lname %></h1>
9
+ <% end %>
10
+
11
+ <div class='demo2'><%= yield_content :demo2, "Johnny", "Smith" %></div>
12
+
13
+ <div class="demo_has_content"><%= content_for?(:demo).to_s %>
14
+ <div class="fake_has_content"><%= content_for?(:fake).to_s %>
@@ -0,0 +1,12 @@
1
+ - content_for :demo do
2
+ %h1 This is content yielded from a content_for
3
+
4
+ .demo= yield_content :demo
5
+
6
+ - content_for :demo2 do |fname, lname|
7
+ %h1 This is content yielded with name #{fname + " " + lname}
8
+
9
+ .demo2= yield_content :demo2, "Johnny", "Smith"
10
+
11
+ .demo_has_content= content_for?(:demo)
12
+ .fake_has_content= content_for?(:fake)
@@ -0,0 +1,12 @@
1
+ - content_for :demo do
2
+ h1 This is content yielded from a content_for
3
+
4
+ .demo== yield_content :demo
5
+
6
+ - content_for :demo2 do |fname, lname|
7
+ h1 This is content yielded with name #{fname + " " + lname}
8
+
9
+ .demo2== yield_content :demo2, "Johnny", "Smith"
10
+
11
+ .demo_has_content== content_for?(:demo)
12
+ .fake_has_content== content_for?(:fake)
@@ -0,0 +1,11 @@
1
+ <%= content_tag :p, "Test 1", :class => 'test', :id => "test1" %>
2
+
3
+ <%= content_tag :p, "Test 2" %>
4
+
5
+ <% content_tag(:p, :class => 'test', :id => 'test3') do %>
6
+ <span>Test 3</span>
7
+ <% end %>
8
+
9
+ <% content_tag(:p) do %>
10
+ <span>Test 4</span>
11
+ <% end %>
@@ -0,0 +1,9 @@
1
+ = content_tag :p, "Test 1", :class => 'test', :id => "test1"
2
+
3
+ = content_tag :p, "Test 2"
4
+
5
+ - content_tag(:p, :class => 'test', :id => 'test3') do
6
+ %span Test 3
7
+
8
+ - content_tag(:p) do
9
+ %span Test 4
@@ -0,0 +1,9 @@
1
+ ==content_tag :p, "Test 1", :class => 'test', :id => "test1"
2
+
3
+ == content_tag :p, "Test 2"
4
+
5
+ ==content_tag(:p, :class => 'test', :id => 'test3') do
6
+ span Test 3
7
+
8
+ ==content_tag(:p) do
9
+ span Test 4
@@ -0,0 +1,5 @@
1
+ <p class="start"><%= current_engine %></p>
2
+ <p class="haml"><%= haml :'partials/_haml' %></p>
3
+ <p class="erb"><%= erb :'partials/_erb' %></p>
4
+ <p class="slim"><%= slim :'partials/_slim' %></p>
5
+ <p class="end"><%= current_engine %></p>
@@ -0,0 +1,5 @@
1
+ %p.start= current_engine
2
+ %p.haml= haml :'partials/_haml'
3
+ %p.erb= erb :'partials/_erb'
4
+ %p.slim= slim :'partials/_slim'
5
+ %p.end= current_engine