middleman-core 3.0.0.beta.2 → 3.0.0.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (240) hide show
  1. data/features/cli_extension.feature +13 -0
  2. data/features/{cli.feature → cli_init.feature} +1 -10
  3. data/features/directory_index.feature +29 -1
  4. data/features/dynamic_pages.feature +1 -0
  5. data/features/extensionless_text_files.feature +0 -2
  6. data/features/front-matter.feature +17 -1
  7. data/features/frontmatter_page_settings.feature +16 -1
  8. data/features/helpers_relative_link_to.feature +68 -0
  9. data/features/unicode_filenames.feature +14 -0
  10. data/fixtures/csspie/config.rb +0 -0
  11. data/fixtures/csspie/source/stylesheets/PIE.htc +96 -0
  12. data/fixtures/dynamic-pages-app/config.rb +3 -0
  13. data/fixtures/frontmatter-app/source/front-matter-auto.erb +6 -0
  14. data/fixtures/frontmatter-app/source/front-matter.html.erb +2 -0
  15. data/fixtures/frontmatter-app/source/json-front-matter-2.php.erb +7 -0
  16. data/fixtures/frontmatter-app/source/json-front-matter-auto.erb +6 -0
  17. data/fixtures/frontmatter-app/source/json-front-matter.html.erb +6 -0
  18. data/fixtures/unicode-filenames-app/config.rb +1 -0
  19. data/fixtures/unicode-filenames-app/source/snowmen-rule-/342/230/203.html +4 -0
  20. data/lib/middleman-core/application.rb +43 -335
  21. data/lib/middleman-core/cli/build.rb +11 -4
  22. data/lib/middleman-core/cli/bundler.rb +40 -0
  23. data/lib/middleman-core/cli/extension.rb +36 -0
  24. data/lib/middleman-core/cli/server.rb +2 -2
  25. data/lib/middleman-core/cli.rb +2 -6
  26. data/lib/middleman-core/core_extensions/assets.rb +35 -31
  27. data/lib/middleman-core/core_extensions/builder.rb +14 -9
  28. data/lib/middleman-core/core_extensions/data.rb +150 -145
  29. data/lib/middleman-core/core_extensions/default_helpers.rb +159 -97
  30. data/lib/middleman-core/core_extensions/extensions.rb +103 -97
  31. data/lib/middleman-core/core_extensions/external_helpers.rb +27 -23
  32. data/lib/middleman-core/core_extensions/file_watcher.rb +140 -110
  33. data/lib/middleman-core/core_extensions/front_matter.rb +155 -175
  34. data/lib/middleman-core/core_extensions/i18n.rb +111 -102
  35. data/lib/middleman-core/core_extensions/rendering.rb +293 -295
  36. data/lib/middleman-core/core_extensions/request.rb +338 -0
  37. data/lib/middleman-core/core_extensions/routing.rb +72 -68
  38. data/lib/middleman-core/core_extensions/show_exceptions.rb +23 -18
  39. data/lib/middleman-core/core_extensions.rb +39 -0
  40. data/lib/middleman-core/extensions/directory_indexes.rb +1 -4
  41. data/lib/middleman-core/extensions/lorem.rb +10 -3
  42. data/lib/middleman-core/extensions.rb +2 -64
  43. data/lib/middleman-core/preview_server.rb +157 -0
  44. data/lib/middleman-core/sitemap/extensions/ignores.rb +73 -68
  45. data/lib/middleman-core/sitemap/extensions/on_disk.rb +65 -58
  46. data/lib/middleman-core/sitemap/extensions/proxies.rb +86 -75
  47. data/lib/middleman-core/sitemap/extensions/traversal.rb +68 -61
  48. data/lib/middleman-core/sitemap/resource.rb +123 -102
  49. data/lib/middleman-core/sitemap/store.rb +170 -149
  50. data/lib/middleman-core/sitemap.rb +57 -57
  51. data/lib/middleman-core/step_definitions/server_steps.rb +13 -3
  52. data/lib/middleman-core/templates/extension/Gemfile +4 -0
  53. data/lib/middleman-core/templates/extension/Rakefile +12 -0
  54. data/lib/middleman-core/templates/extension/features/support/env.rb +4 -0
  55. data/lib/middleman-core/templates/extension/gemspec +24 -0
  56. data/lib/middleman-core/templates/extension/lib/lib.rb +49 -0
  57. data/lib/middleman-core/templates/extension/lib/middleman_extension.rb +1 -0
  58. data/lib/middleman-core/templates/shared/gitignore +14 -0
  59. data/lib/middleman-core/templates.rb +14 -8
  60. data/lib/middleman-core/util.rb +31 -9
  61. data/lib/middleman-core/version.rb +1 -1
  62. data/lib/middleman-core.rb +6 -4
  63. data/middleman-core.gemspec +4 -6
  64. metadata +62 -203
  65. data/lib/middleman-core/vendor/padrino-core-0.10.6/.document +0 -5
  66. data/lib/middleman-core/vendor/padrino-core-0.10.6/.gitignore +0 -22
  67. data/lib/middleman-core/vendor/padrino-core-0.10.6/.yardopts +0 -1
  68. data/lib/middleman-core/vendor/padrino-core-0.10.6/LICENSE.txt +0 -20
  69. data/lib/middleman-core/vendor/padrino-core-0.10.6/README.rdoc +0 -294
  70. data/lib/middleman-core/vendor/padrino-core-0.10.6/Rakefile +0 -5
  71. data/lib/middleman-core/vendor/padrino-core-0.10.6/bin/padrino +0 -9
  72. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/rendering.rb +0 -292
  73. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/routing.rb +0 -943
  74. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/showexceptions.rb +0 -20
  75. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application.rb +0 -269
  76. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/caller.rb +0 -53
  77. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/adapter.rb +0 -24
  78. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/base.rb +0 -150
  79. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/console.rb +0 -20
  80. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/rake.rb +0 -24
  81. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/rake_tasks.rb +0 -59
  82. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/command.rb +0 -38
  83. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/images/404.png +0 -0
  84. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/images/500.png +0 -0
  85. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/loader.rb +0 -211
  86. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/cs.yml +0 -34
  87. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/da.yml +0 -34
  88. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/de.yml +0 -34
  89. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/en.yml +0 -34
  90. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/es.yml +0 -34
  91. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/fr.yml +0 -34
  92. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/hu.yml +0 -34
  93. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/it.yml +0 -40
  94. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/ja.yml +0 -34
  95. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/lv.yml +0 -34
  96. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/nl.yml +0 -34
  97. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/no.yml +0 -35
  98. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/pl.yml +0 -34
  99. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/pt_br.yml +0 -40
  100. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/ru.yml +0 -35
  101. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/tr.yml +0 -34
  102. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/uk.yml +0 -34
  103. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/zh_cn.yml +0 -34
  104. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/zh_tw.yml +0 -34
  105. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/logger.rb +0 -428
  106. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/mounter.rb +0 -224
  107. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/reloader.rb +0 -254
  108. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/router.rb +0 -98
  109. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/server.rb +0 -79
  110. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/support_lite.rb +0 -199
  111. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/tasks.rb +0 -21
  112. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/version.rb +0 -20
  113. data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core.rb +0 -152
  114. data/lib/middleman-core/vendor/padrino-core-0.10.6/padrino-core.gemspec +0 -38
  115. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/.components +0 -6
  116. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/.gitignore +0 -7
  117. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/complex.rb +0 -32
  118. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/simple.rb +0 -33
  119. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/a.rb +0 -9
  120. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/b.rb +0 -4
  121. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/c.rb +0 -1
  122. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/e.rb +0 -13
  123. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/f.rb +0 -2
  124. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/g.rb +0 -2
  125. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/d.rb +0 -4
  126. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/helper.rb +0 -83
  127. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/mini_shoulda.rb +0 -45
  128. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_application.rb +0 -108
  129. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_core.rb +0 -77
  130. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_dependencies.rb +0 -44
  131. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_filters.rb +0 -278
  132. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_locale.rb +0 -21
  133. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_logger.rb +0 -154
  134. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_mounter.rb +0 -177
  135. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_reloader_complex.rb +0 -75
  136. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_reloader_simple.rb +0 -98
  137. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_rendering.rb +0 -461
  138. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_restful_routing.rb +0 -33
  139. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_router.rb +0 -146
  140. data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_routing.rb +0 -1680
  141. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.document +0 -5
  142. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.gitignore +0 -21
  143. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.yardopts +0 -1
  144. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/LICENSE.txt +0 -20
  145. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/README.rdoc +0 -239
  146. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/Rakefile +0 -5
  147. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/asset_tag_helpers.rb +0 -417
  148. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_builder/abstract_form_builder.rb +0 -251
  149. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_builder/standard_form_builder.rb +0 -43
  150. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_helpers.rb +0 -787
  151. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/format_helpers.rb +0 -381
  152. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/cs.yml +0 -103
  153. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/da.yml +0 -91
  154. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/de.yml +0 -81
  155. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/en.yml +0 -103
  156. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/es.yml +0 -103
  157. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/fr.yml +0 -80
  158. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/hu.yml +0 -103
  159. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/it.yml +0 -89
  160. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/ja.yml +0 -103
  161. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/lv.yml +0 -103
  162. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/nl.yml +0 -82
  163. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/no.yml +0 -91
  164. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/pl.yml +0 -95
  165. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/pt_br.yml +0 -103
  166. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/ru.yml +0 -103
  167. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/tr.yml +0 -103
  168. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/uk.yml +0 -103
  169. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/zh_cn.yml +0 -104
  170. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/zh_tw.yml +0 -103
  171. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/number_helpers.rb +0 -288
  172. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/abstract_handler.rb +0 -98
  173. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/erb_handler.rb +0 -79
  174. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/haml_handler.rb +0 -63
  175. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/slim_handler.rb +0 -81
  176. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers.rb +0 -175
  177. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/render_helpers.rb +0 -60
  178. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/tag_helpers.rb +0 -260
  179. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/translation_helpers.rb +0 -38
  180. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers.rb +0 -59
  181. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/padrino-helpers.gemspec +0 -27
  182. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/app.rb +0 -73
  183. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.erb +0 -14
  184. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.haml +0 -12
  185. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.slim +0 -13
  186. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.erb +0 -14
  187. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.haml +0 -12
  188. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.slim +0 -12
  189. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.erb +0 -11
  190. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.haml +0 -9
  191. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.slim +0 -9
  192. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.erb +0 -5
  193. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.haml +0 -5
  194. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.slim +0 -5
  195. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.erb +0 -20
  196. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.haml +0 -15
  197. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.slim +0 -15
  198. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.erb +0 -72
  199. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.haml +0 -59
  200. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.slim +0 -59
  201. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.erb +0 -86
  202. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.haml +0 -70
  203. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.slim +0 -70
  204. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.erb +0 -5
  205. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.haml +0 -4
  206. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.slim +0 -4
  207. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.erb +0 -3
  208. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.haml +0 -3
  209. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.slim +0 -3
  210. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.erb +0 -3
  211. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.haml +0 -3
  212. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.slim +0 -3
  213. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_erb.erb +0 -1
  214. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_haml.haml +0 -1
  215. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_slim.slim +0 -1
  216. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.erb +0 -1
  217. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.haml +0 -1
  218. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.slim +0 -1
  219. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/app.rb +0 -50
  220. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engine.haml +0 -5
  221. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_erb.erb +0 -1
  222. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_haml.haml +0 -1
  223. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_slim.slim +0 -1
  224. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/erb/test.erb +0 -1
  225. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/explicit_engine.haml +0 -5
  226. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/haml/test.haml +0 -1
  227. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/_user.haml +0 -7
  228. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/haml_template.haml +0 -1
  229. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/some_template.haml +0 -2
  230. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/helper.rb +0 -66
  231. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_asset_tag_helpers.rb +0 -328
  232. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_builder.rb +0 -1106
  233. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_helpers.rb +0 -770
  234. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_format_helpers.rb +0 -227
  235. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_locale.rb +0 -20
  236. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_number_helpers.rb +0 -139
  237. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_output_helpers.rb +0 -153
  238. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_render_helpers.rb +0 -76
  239. data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_tag_helpers.rb +0 -106
  240. data/lib/middleman-core/watcher.rb +0 -196
@@ -1,63 +0,0 @@
1
- module Padrino
2
- module Helpers
3
- module OutputHelpers
4
- ##
5
- # Handler for reading and writing from a haml template.
6
- #
7
- class HamlHandler < AbstractHandler
8
- ##
9
- # Returns true if the current template type is same as this handlers; false otherwise.
10
- #
11
- # @example
12
- # @handler.is_type? => true
13
- #
14
- def is_type?
15
- template.respond_to?(:is_haml?) && template.is_haml?
16
- end
17
-
18
- ##
19
- # Returns true if the block given is of the handler's template type; false otherwise.
20
- #
21
- # @example
22
- # @handler.block_is_type?(block) => true
23
- #
24
- def block_is_type?(block)
25
- template.block_is_haml?(block)
26
- end
27
-
28
- # Captures the html from a block of template code for this handler
29
- #
30
- # @example
31
- # @handler.capture_from_template(&block) => "...html..."
32
- #
33
- def capture_from_template(*args, &block)
34
- eval("_hamlout ||= @haml_buffer", block.binding) # this is for rbx
35
- template.capture_haml(*args, &block)
36
- end
37
-
38
- ##
39
- # Outputs the given text to the templates buffer directly
40
- #
41
- # @example
42
- # @handler.concat_to_template("This will be output to the template buffer")
43
- #
44
- def concat_to_template(text="")
45
- template.haml_concat(text)
46
- nil
47
- end
48
-
49
- ##
50
- # Returns an array of engines used for the template
51
- #
52
- # @example
53
- # @handler.engines => [:haml]
54
- #
55
- def engines
56
- @_engines ||= [:haml]
57
- end
58
- end # HamlHandler
59
-
60
- OutputHelpers.register(HamlHandler)
61
- end # OutputHelpers
62
- end # Helpers
63
- end # Padrino
@@ -1,81 +0,0 @@
1
- # Make slim works with sinatra/padrino
2
- Slim::Engine.set_default_options(:buffer => '@_out_buf', :generator => Temple::Generators::StringBuffer) if defined?(Slim)
3
-
4
- module Padrino
5
- module Helpers
6
- module OutputHelpers
7
- ##
8
- # Handler for reading and writing from a slim template.
9
- #
10
- class SlimHandler < AbstractHandler
11
- attr_reader :output_buffer
12
-
13
- def initialize(template)
14
- super
15
- @output_buffer = template.instance_variable_get(:@_out_buf)
16
- end
17
-
18
- ##
19
- # Returns true if the current template type is same as this handlers; false otherwise.
20
- #
21
- # @example
22
- # @handler.is_type? => true
23
- #
24
- def is_type?
25
- !self.output_buffer.nil?
26
- end
27
-
28
- # Captures the html from a block of template code for this handler
29
- #
30
- # @example
31
- # @handler.capture_from_template(&block) => "...html..."
32
- #
33
- def capture_from_template(*args, &block)
34
- self.output_buffer, _buf_was = "", self.output_buffer
35
- block.call(*args)
36
- ret = eval("@_out_buf", block.binding)
37
- self.output_buffer = _buf_was
38
- ret
39
- end
40
-
41
- ##
42
- # Outputs the given text to the templates buffer directly
43
- #
44
- # @example
45
- # @handler.concat_to_template("This will be output to the template buffer")
46
- #
47
- def concat_to_template(text="")
48
- self.output_buffer << text if is_type? && text
49
- nil
50
- end
51
-
52
- ##
53
- # Returns true if the block given is of the handler's template type; false otherwise.
54
- #
55
- # @example
56
- # @handler.block_is_type?(block) => true
57
- #
58
- def block_is_type?(block)
59
- is_type? || (block && eval('defined? __in_erb_template', block.binding))
60
- end
61
-
62
- ##
63
- # Returns an array of engines used for the template
64
- #
65
- # @example
66
- # @handler.engines => [:erb, :erubis]
67
- #
68
- def engines
69
- @_engines ||= [:slim]
70
- end
71
-
72
- protected
73
- def output_buffer=(val)
74
- template.instance_variable_set(:@_out_buf, val)
75
- end
76
- end # SlimHandler
77
-
78
- OutputHelpers.register(SlimHandler)
79
- end # OutputHelpers
80
- end # Helpers
81
- end # Padrino
@@ -1,175 +0,0 @@
1
- module Padrino
2
- module Helpers
3
- ###
4
- # Helpers related to buffer output for various template engines.
5
- #
6
- module OutputHelpers
7
-
8
- def self.included(base) # @private
9
- base.send(:include, SinatraCurrentEngine) unless base.method_defined?(:current_engine)
10
- end
11
-
12
- ##
13
- # Module used to detect the current engine in vanilla sinatra apps.
14
- # @private
15
- module SinatraCurrentEngine
16
- attr_reader :current_engine
17
-
18
- def render(engine, *) # @private
19
- @current_engine, engine_was = engine, @current_engine
20
- output = super
21
- @current_engine = engine_was
22
- output
23
- end
24
- end
25
-
26
- ##
27
- # Captures the html from a block of template code for any available handler.
28
- #
29
- # @param [Object] *args
30
- # Objects yield to the captured block
31
- # @param [Proc] &block
32
- # Template code to capture as html
33
- #
34
- # @return [String] Captured html resulting from the block
35
- #
36
- # @example
37
- # capture_html(&block) => "...html..."
38
- # capture_html(object_for_block, &block) => "...html..."
39
- #
40
- # @api semipublic
41
- def capture_html(*args, &block)
42
- handler = find_proper_handler
43
- captured_html = ""
44
- if handler && handler.is_type? && handler.block_is_type?(block)
45
- captured_html = handler.capture_from_template(*args, &block)
46
- end
47
- # invoking the block directly if there was no template
48
- captured_html = block_given? && block.call(*args) if captured_html.blank?
49
- captured_html
50
- end
51
- alias :capture :capture_html
52
-
53
- ##
54
- # Outputs the given text to the templates buffer directly.
55
- #
56
- # @param [String] text
57
- # Text to concatenate to the buffer.
58
- #
59
- # @example
60
- # concat_content("This will be output to the template buffer")
61
- #
62
- # @api semipublic
63
- def concat_content(text="")
64
- handler = find_proper_handler
65
- if handler && handler.is_type?
66
- handler.concat_to_template(text)
67
- else # theres no template to concat, return the text directly
68
- text
69
- end
70
- end
71
- alias :concat :concat_content
72
-
73
- ##
74
- # Returns true if the block is from a supported template type; false otherwise.
75
- # Used to determine if html should be returned or concatenated to the view.
76
- #
77
- # @param [Block] block
78
- # Determine if this block is a view template.
79
- #
80
- # @example
81
- # block_is_template?(block) => true
82
- #
83
- # @return [Boolean] True if the block is a template; false otherwise.
84
- #
85
- # @api semipublic
86
- def block_is_template?(block)
87
- handler = find_proper_handler
88
- block && handler && handler.block_is_type?(block)
89
- end
90
-
91
- ##
92
- # Capture a block or text of content to be rendered at a later time.
93
- # Your blocks can also receive values, which are passed to them by <tt>yield_content</tt>
94
- #
95
- # @overload content_for(key, content)
96
- # @param [Symbol] key Name of your key for the content yield.
97
- # @param [String] content Text to be stored for this key.
98
- # @overload content_for(key, &block)
99
- # @param [Symbol] key Name of your key for the content yield.
100
- # @param [Proc] block Block to be stored as content for this key.
101
- #
102
- # @example
103
- # content_for(:name) { ...content... }
104
- # content_for(:name) { |name| ...content... }
105
- # content_for(:name, "I'm Jeff")
106
- #
107
- # @api public
108
- def content_for(key, content = nil, &block)
109
- content_blocks[key.to_sym] << (block_given? ? block : Proc.new { content })
110
- end
111
-
112
- ##
113
- # Is there a content block for a given key?
114
- #
115
- # @param [Symbol] key
116
- # Name of content to yield
117
- #
118
- # @return [TrueClass,FalseClass] Result html for the given +key+
119
- #
120
- # @example
121
- # content_for? :header => true
122
- #
123
- # @api public
124
- def content_for?(key)
125
- content_blocks[key.to_sym].present?
126
- end
127
-
128
- ##
129
- # Render the captured content blocks for a given key.
130
- # You can also pass values to the content blocks by passing them
131
- # as arguments after the key.
132
- #
133
- # @param [Symbol] key
134
- # Name of content to yield
135
- # @param *args
136
- # Values to pass to the content block
137
- #
138
- # @return [String] Result html for the given +key+
139
- #
140
- # @example
141
- # yield_content :include
142
- # yield_content :head, "param1", "param2"
143
- # yield_content(:title) || "My page title"
144
- #
145
- # @api public
146
- def yield_content(key, *args)
147
- blocks = content_blocks[key.to_sym]
148
- return nil if blocks.empty?
149
- blocks.map { |content| capture_html(*args, &content) }.join
150
- end
151
-
152
- protected
153
- ##
154
- # Retrieves content_blocks stored by content_for or within yield_content
155
- #
156
- # @example
157
- # content_blocks[:name] => ['...', '...']
158
- #
159
- def content_blocks
160
- @content_blocks ||= Hash.new { |h,k| h[k] = [] }
161
- end
162
-
163
- ##
164
- # Retrieves the template handler for the given output context.
165
- # Can handle any output related to capturing or concating in a given template.
166
- #
167
- # @example
168
- # find_proper_handler => <OutputHelpers::HamlHandler>
169
- #
170
- def find_proper_handler
171
- OutputHelpers.handlers.map { |h| h.new(self) }.find { |h| h.engines.include?(current_engine) && h.is_type? }
172
- end
173
- end # OutputHelpers
174
- end # Helpers
175
- end # Padrino
@@ -1,60 +0,0 @@
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
@@ -1,260 +0,0 @@
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
- BOOLEAN_ATTRIBUTES = [
17
- :autoplay,
18
- :autofocus,
19
- :formnovalidate,
20
- :checked,
21
- :disabled,
22
- :hidden,
23
- :loop,
24
- :multiple,
25
- :muted,
26
- :readonly,
27
- :required,
28
- :selected
29
- ]
30
-
31
- ##
32
- # Custom data attributes,
33
- # feel free to update with yours:
34
- #
35
- # Padrino::Helpers::TagHelpers::DATA_ATTRIBUTES.push(:dialog)
36
- # text_field :foo, :dialog => true
37
- # # Generates: <input type="text" data-dialog="true" name="foo" />
38
- #
39
- DATA_ATTRIBUTES = [
40
- :method,
41
- :remote,
42
- :confirm
43
- ]
44
-
45
- ##
46
- # Creates an HTML tag with given name, content, and options
47
- #
48
- # @overload content_tag(name, content, options = nil)
49
- # @param [Symbol] name
50
- # The name of the HTML tag to create.
51
- # @param [String] content
52
- # The content inside of the the tag.
53
- # @param [Hash] options
54
- # The HTML options to include in this tag.
55
- #
56
- # @overload content_tag(name, options = nil, &block)
57
- # @param [Symbol] name
58
- # The name of the HTML tag to create.
59
- # @param [Hash] options
60
- # The HTML options to include in this tag.
61
- # @param [Proc] block
62
- # The block returning HTML content.
63
- #
64
- # @macro [new] global_html_attributes
65
- # @option options [String] :id
66
- # Specifies a unique identifier for the element.
67
- # @option options [String] :class
68
- # Specifies the stylesheet class of the element.
69
- # @option options [String] :title
70
- # Specifies the title for the element.
71
- # @option options [String] :accesskey
72
- # Specifies a shortcut key to access the element.
73
- # @option options [Symbol] :dropzone
74
- # Specifies what happens when dragged items are dropped on the element. (:copy, :link, :move)
75
- # @option options [Boolean] :hidden
76
- # Specifies whether or not the element is hidden from view.
77
- # @option options [Boolean] :draggable
78
- # Specifies whether or not the element is draggable. (true, false, :auto)
79
- # @option options [Boolean] :contenteditable
80
- # Specifies whether or not the element is editable.
81
- #
82
- # @return [String]
83
- # Generated HTML with specified +options+
84
- #
85
- # @example
86
- # content_tag(:p, 'Hello World', :class => 'light')
87
- #
88
- # # => <p class="light">
89
- # # => Hello World
90
- # # => </p>
91
- #
92
- # content_tag(:p, :class => 'dark') do
93
- # link_to 'Padrino', 'http://www.padrinorb.com'
94
- # end
95
- #
96
- # # => <p class="dark">
97
- # # => <a href="http://www.padrinorb.com">Padrino</a>
98
- # # => </p>
99
- #
100
- # @api public
101
- def content_tag(name, content = nil, options = nil, &block)
102
- if block_given?
103
- options = content if content.is_a?(Hash)
104
- content = capture_html(&block)
105
- end
106
-
107
- content = content.join("\n") if content.respond_to?(:join)
108
-
109
- options = parse_data_options(name, options)
110
- attributes = tag_attributes(options)
111
- output = "<#{name}#{attributes}>#{content}</#{name}>"
112
- block_is_template?(block) ? concat_content(output) : output
113
- end
114
-
115
- ##
116
- # Creates an HTML input field with the given type and options
117
- #
118
- # @param [Symbol] type
119
- # The type of input to create.
120
- # @param [Hash] options
121
- # The HTML options to include in this input.
122
- #
123
- # @option options [String] :id
124
- # Specifies a unique identifier for the input.
125
- # @option options [String] :class
126
- # Specifies the stylesheet class of the input.
127
- # @option options [String] :name
128
- # Specifies the name of the input.
129
- # @option options [String] :accesskey
130
- # Specifies a shortcut key to access the input.
131
- # @option options [Integer] :tabindex
132
- # Specifies the tab order of the input.
133
- # @option options [Boolean] :hidden
134
- # Specifies whether or not the input is hidden from view.
135
- # @option options [Boolean] :spellcheck
136
- # Specifies whether or not the input should have it's spelling and grammar checked for errors.
137
- # @option options [Boolean] :draggable
138
- # Specifies whether or not the input is draggable. (true, false, :auto)
139
- # @option options [String] :pattern
140
- # Specifies the regular expression pattern that the input's value is checked against.
141
- # @option options [Symbol] :autocomplete
142
- # Specifies whether or not the input should have autocomplete enabled. (:on, :off)
143
- # @option options [Boolean] :autofocus
144
- # Specifies whether or not the input should automatically get focus when the page loads.
145
- # @option options [Boolean] :required
146
- # Specifies whether or not the input is required to be completeled before the form is submitted.
147
- # @option options [Boolean] :readonly
148
- # Specifies whether or not the input is read only.
149
- # @option options [Boolean] :disabled
150
- # Specifies whether or not the input is disabled.
151
- #
152
- # @return [String]
153
- # Generated HTML with specified +options+
154
- #
155
- # @example
156
- # input_tag :text, :name => 'handle'
157
- # # => <input type="test" name="handle" />
158
- #
159
- # input_tag :password, :name => 'password', :size => 20
160
- # # => <input type="password" name="password" size="20" />
161
- #
162
- # input_tag :text, :name => 'username', :required => true, :autofocus => true
163
- # # => <input type="text" name="username" required autofocus />
164
- #
165
- # input_tag :number, :name => 'credit_card', :autocomplete => :off
166
- # # => <input type="number" autocomplete="off" />
167
- #
168
- # @api semipublic
169
- def input_tag(type, options = {})
170
- tag(:input, options.reverse_merge!(:type => type))
171
- end
172
-
173
- ##
174
- # Creates an HTML tag with the given name and options
175
- #
176
- # @param [Symbol] name
177
- # The name of the HTML tag to create.
178
- # @param [Hash] options
179
- # The HTML options to include in this tag.
180
- #
181
- # @macro global_html_attributes
182
- #
183
- # @return [String]
184
- # Generated HTML with specified +options+
185
- #
186
- # @example
187
- # tag :hr, :class => 'dotted'
188
- # # => <hr class="dotted">
189
- #
190
- # tag :input, :name => 'username', :type => :text
191
- # # => <input name="username" type="text" />
192
- #
193
- # tag :img, :src => 'images/pony.jpg', :alt => 'My Little Pony'
194
- # # => <img src="images/pony.jpg" alt="My Little Pony" />
195
- #
196
- # tag :img, :src => 'sinatra.jpg, :data => { :nsfw => false, :geo => [34.087, -118.407] }
197
- # # => <img src="sinatra.jpg" data-nsfw="false" data-geo="34.087 -118.407" />
198
- #
199
- # @api public
200
- def tag(name, options = nil, open = false)
201
- options = parse_data_options(name, options)
202
- attributes = tag_attributes(options)
203
- "<#{name}#{attributes}#{open ? '>' : ' />'}"
204
- end
205
-
206
- private
207
- ##
208
- # Returns a compiled list of HTML attributes
209
- ##
210
- def tag_attributes(options)
211
- return '' if options.nil?
212
- attributes = options.map do |k, v|
213
- next if v.nil? || v == false
214
- if v.is_a?(Hash)
215
- nested_values(k, v)
216
- elsif BOOLEAN_ATTRIBUTES.include?(k)
217
- k.to_s
218
- else
219
- %(#{k}="#{escape_value(v)}")
220
- end
221
- end.compact
222
- attributes.empty? ? '' : " #{attributes * ' '}"
223
- end
224
-
225
- ##
226
- # Escape tag values to their HTML/XML entities.
227
- ##
228
- def escape_value(string)
229
- string.to_s.gsub(Regexp.union(*ESCAPE_VALUES.keys)) { |c| ESCAPE_VALUES[c] }
230
- end
231
-
232
- ##
233
- # Iterate through nested values
234
- #
235
- def nested_values(attribute, hash)
236
- hash.map do |k, v|
237
- if v.is_a?(Hash)
238
- nested_values("#{attribute}-#{k.to_s.dasherize}", v)
239
- else
240
- %(#{attribute}-#{k.to_s.dasherize}="#{escape_value(v)}")
241
- end
242
- end * ' '
243
- end
244
-
245
- ##
246
- # Parses custom data attributes
247
- #
248
- def parse_data_options(tag, options)
249
- return if options.nil?
250
- parsed_options = options.dup
251
- options.each do |k, v|
252
- next if !DATA_ATTRIBUTES.include?(k) || (tag.to_s == 'form' && k == :method)
253
- parsed_options["data-#{k}"] = parsed_options.delete(k)
254
- parsed_options[:rel] = 'nofollow' if k == :method
255
- end
256
- parsed_options
257
- end
258
- end # TagHelpers
259
- end # Helpers
260
- end # Padrino
@@ -1,38 +0,0 @@
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