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,214 +1,194 @@
1
- # Parsing YAML frontmatter
2
- require "yaml"
3
-
4
- # Looking up Tilt extensions
5
- require "tilt"
6
-
7
- # Frontmatter namespace
8
- module Middleman::CoreExtensions::FrontMatter
1
+ # Extensions namespace
2
+ module Middleman::CoreExtensions
9
3
 
10
- # Setup extension
11
- class << self
12
-
13
- # Once registered
14
- def registered(app)
15
- app.set :frontmatter_extensions, %w(.htm .html .php)
16
- app.extend ClassMethods
17
- app.send :include, InstanceMethods
18
- app.delegate :frontmatter_changed, :to => :"self.class"
19
-
20
- ::Middleman::Sitemap::Resource.send :include, ResourceInstanceMethods
21
- end
22
- alias :included :registered
23
- end
4
+ # Frontmatter namespace
5
+ module FrontMatter
24
6
 
25
- # Frontmatter class methods
26
- module ClassMethods
7
+ # Setup extension
8
+ class << self
27
9
 
28
- # Register callback on frontmatter updates
29
- # @param [Regexp] matcher
30
- # @return [Array<Array<Proc, Regexp>>]
31
- def frontmatter_changed(matcher=nil, &block)
32
- @_frontmatter_changed ||= []
33
- @_frontmatter_changed << [block, matcher] if block_given?
34
- @_frontmatter_changed
35
- end
36
- end
37
-
38
- module ResourceInstanceMethods
10
+ # Once registered
11
+ def registered(app)
12
+ # Parsing YAML frontmatter
13
+ require "yaml"
14
+
15
+ # Parsing JSON frontmatter
16
+ require "active_support/json"
17
+
18
+ app.send :include, InstanceMethods
19
+
20
+ app.before_configuration do
21
+ files.changed { |file| frontmatter_manager.clear_data(file) }
22
+ files.deleted { |file| frontmatter_manager.clear_data(file) }
23
+ end
24
+
25
+ app.after_configuration do
26
+ ::Middleman::Sitemap::Resource.send :include, ResourceInstanceMethods
39
27
 
40
- # This page's frontmatter
41
- # @return [Hash]
42
- def data
43
- app.frontmatter(relative_path).first
28
+ sitemap.register_resource_list_manipulator(
29
+ :frontmatter,
30
+ frontmatter_manager
31
+ )
32
+
33
+ sitemap.provides_metadata do |path|
34
+ fmdata = frontmatter_manager.data(path).first
35
+
36
+ data = {}
37
+ %w(layout layout_engine).each do |opt|
38
+ data[opt.to_sym] = fmdata[opt] if fmdata[opt]
39
+ end
40
+
41
+ { :options => data, :page => fmdata }
42
+ end
43
+ end
44
+ end
45
+ alias :included :registered
44
46
  end
45
-
46
- end
47
47
 
48
- # Frontmatter instance methods
49
- module InstanceMethods
50
-
51
- # Override init
52
- def initialize
53
- exts = frontmatter_extensions.join("|").gsub(".", "\.")
54
-
55
- static_path = source_dir.sub(root, "").sub(/^\//, "").sub(/\/$/, "") + "/"
56
-
57
- matcher = %r{#{static_path}.*(#{exts})}
48
+ class FrontmatterManager
49
+ def initialize(app)
50
+ @app = app
51
+ @cache = {}
52
+ end
58
53
 
59
- files.changed matcher do |file|
60
- frontmatter_extension.touch_file(file)
54
+ def data(path)
55
+ p = normalize_path(path)
56
+ @cache[p] ||= frontmatter_and_content(p)
61
57
  end
58
+
59
+ def clear_data(file)
60
+ # Copied from Sitemap::Store#file_to_path, but without
61
+ # removing the file extension
62
+ file = File.expand_path(file, @app.root)
63
+ prefix = @app.source_dir.sub(/\/$/, "") + "/"
64
+ return unless file.include?(prefix)
65
+ path = file.sub(prefix, "")
62
66
 
63
- files.deleted matcher do |file|
64
- frontmatter_extension.remove_file(file)
67
+ @cache.delete(path)
65
68
  end
69
+
70
+ # Parse YAML frontmatter out of a string
71
+ # @param [String] content
72
+ # @return [Array<Hash, String>]
73
+ def parse_yaml_front_matter(content)
74
+ yaml_regex = /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
75
+ if content =~ yaml_regex
76
+ content = content.sub(yaml_regex, "")
66
77
 
67
- sitemap.provides_metadata matcher do |path|
68
- relative_path = path.sub(self.source_dir, "")
78
+ begin
79
+ data = YAML.load($1)
80
+ rescue => e
81
+ puts "YAML Exception: #{e.message}"
82
+ return false
83
+ end
69
84
 
70
- fmdata = if self.frontmatter_extension.has_data?(relative_path)
71
- self.frontmatter(relative_path)[0]
72
85
  else
73
- {}
74
- end
75
-
76
- data = {}
77
- %w(layout layout_engine).each do |opt|
78
- data[opt.to_sym] = fmdata[opt] if fmdata.has_key?(opt)
86
+ return false
79
87
  end
80
88
 
81
- { :options => data, :page => fmdata }
89
+ [data, content]
90
+ rescue
91
+ [{}, content]
82
92
  end
93
+
94
+ def parse_json_front_matter(content)
95
+ json_regex = /^(\{\{\{\s*\n.*?\n?)^(\}\}\}\s*$\n?)/m
96
+
97
+ if content =~ json_regex
98
+ content = content.sub(json_regex, "")
83
99
 
84
- # Initialize class
85
- frontmatter_extension
100
+ begin
101
+ json = ($1+$2).sub("{{{", "{").sub("}}}", "}")
102
+ data = ActiveSupport::JSON.decode(json)
103
+ rescue => e
104
+ puts "JSON Exception: #{e.message}"
105
+ return false
106
+ end
86
107
 
87
- super
88
- end
108
+ else
109
+ return false
110
+ end
89
111
 
90
- # Notify callbacks that the frontmatter changed
91
- # @param [String] path
92
- # @return [void]
93
- def frontmatter_did_change(path)
94
- frontmatter_changed.each do |callback, matcher|
95
- next if path.match(%r{^#{build_dir}/})
96
- next if !matcher.nil? && !path.match(matcher)
97
- instance_exec(path, &callback)
112
+ [data, content]
113
+ rescue
114
+ [{}, content]
98
115
  end
99
- end
100
-
101
- # Get the frontmatter object
102
- # @return [Middleman::CoreExtensions::FrontMatter::FrontMatter]
103
- def frontmatter_extension
104
- @_frontmatter_extension ||= FrontMatter.new(self)
105
- end
106
-
107
- # Get the frontmatter for the given params
108
- # @param [String] path
109
- # @return [Hash, nil]
110
- def frontmatter(*args)
111
- frontmatter_extension.data(*args)
112
- end
113
- end
114
-
115
- # Core Frontmatter class
116
- class FrontMatter
117
-
118
- # Initialize frontmatter with current app
119
- # @param [Middleman::Application] app
120
- def initialize(app)
121
- @app = app
122
- @source = File.expand_path(@app.source, @app.root)
123
- @local_data = {}
124
116
 
125
- # Setup ignore callback
126
- @app.ignore do |path|
127
- if p = @app.sitemap.find_resource_by_path(path)
128
- !p.proxy? && p.data && p.data["ignored"] == true
117
+ # Get the frontmatter and plain content from a file
118
+ # @param [String] path
119
+ # @return [Array<Thor::CoreExt::HashWithIndifferentAccess, String>]
120
+ def frontmatter_and_content(path)
121
+ full_path = File.expand_path(path, @app.source_dir)
122
+ content = File.read(full_path)
123
+
124
+ if result = parse_yaml_front_matter(content)
125
+ data, content = result
126
+ elsif result = parse_json_front_matter(content)
127
+ data, content = result
129
128
  else
130
- false
129
+ data = {}
131
130
  end
131
+
132
+ [::Middleman::Util.recursively_enhance(data).freeze, content]
132
133
  end
133
- end
134
-
135
- # Whether the frontmatter knows about a path
136
- # @param [String] path
137
- # @return [Boolean]
138
- def has_data?(path)
139
- @local_data.has_key?(path.to_s)
140
- end
141
-
142
- # Update frontmatter if a file changes
143
- # @param [String] file
144
- # @return [void]
145
- def touch_file(file)
146
- extension = File.extname(file).sub(/\./, "")
147
- return unless ::Tilt.mappings.has_key?(extension)
148
134
 
149
- file = File.expand_path(file, @app.root)
150
- content = File.read(file)
135
+ def normalize_path(path)
136
+ path.sub(@app.source_dir, "").sub(/^\//, "")
137
+ end
151
138
 
152
- result = parse_front_matter(content)
139
+ # Update the main sitemap resource list
140
+ # @return [void]
141
+ def manipulate_resource_list(resources)
142
+ resources.each do |r|
143
+ if !r.proxy? && r.data["ignored"] == true
144
+ r.frontmatter_ignored = true
145
+ end
146
+ end
153
147
 
154
- if result
155
- data, content = result
156
-
157
- data = ::Middleman::Util.recursively_enhance(data).freeze
158
- file = file.sub(@app.source_dir, "")
159
- @local_data[file] = [data, content]
160
- path = File.join(@app.source_dir, file)
161
- @app.cache.set([:raw_template, path], result[1])
162
- @app.frontmatter_did_change(path)
148
+ resources
163
149
  end
164
150
  end
165
-
166
- # Update frontmatter if a file is delted
167
- # @param [String] file
168
- # @return [void]
169
- def remove_file(file)
170
- file = File.expand_path(file, @app.root)
171
- file = file.sub(@app.source_dir, "")
151
+
152
+ module ResourceInstanceMethods
172
153
 
173
- if @local_data.has_key?(file)
174
- path = File.join(@app.source_dir, file)
175
- @app.cache.remove(:raw_template, path)
176
- @local_data.delete(file)
154
+ def frontmatter_ignored?
155
+ @_frontmatter_ignored || false
177
156
  end
178
- end
179
-
180
- # Get the frontmatter for a given path
181
- # @param [String] path
182
- # @return [Hash]
183
- def data(path)
184
- if @local_data.has_key?(path.to_s)
185
- @local_data[path.to_s]
186
- else
187
- {}.freeze
157
+
158
+ def frontmatter_ignored=(v)
159
+ @_frontmatter_ignored = v
188
160
  end
189
- end
190
-
191
- private
192
- # Parse frontmatter out of a string
193
- # @param [String] content
194
- # @return [Array<Hash, String>]
195
- def parse_front_matter(content)
196
- yaml_regex = /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
197
- if content =~ yaml_regex
198
- content = content[($1.size + $2.size)..-1]
199
-
200
- begin
201
- data = YAML.load($1)
202
- rescue => e
203
- puts "YAML Exception: #{e.message}"
204
- return false
161
+
162
+ def ignored?
163
+ if frontmatter_ignored?
164
+ true
165
+ else
166
+ super
205
167
  end
168
+ end
206
169
 
207
- else
208
- return false
170
+ # This page's frontmatter
171
+ # @return [Hash]
172
+ def data
173
+ app.frontmatter_manager.data(source_file).first
209
174
  end
210
175
 
211
- [data, content]
176
+ end
177
+
178
+ module InstanceMethods
179
+
180
+ # Access the Frontmatter API
181
+ def frontmatter_manager
182
+ @_frontmatter_manager ||= FrontmatterManager.new(self)
183
+ end
184
+
185
+ # Get the template data from a path
186
+ # @param [String] path
187
+ # @return [String]
188
+ def template_data_for_file(path)
189
+ frontmatter_manager.data(path).last
190
+ end
191
+
212
192
  end
213
193
  end
214
194
  end
@@ -1,136 +1,145 @@
1
1
  # i18n Namespace
2
- module Middleman::CoreExtensions::I18n
2
+ module Middleman
3
+ module CoreExtensions
4
+ module I18n
3
5
 
4
- # Setup extension
5
- class << self
6
+ # Setup extension
7
+ class << self
6
8
 
7
- # Once registerd
8
- def registered(app)
9
- app.set :locales_dir, "locales"
9
+ # Once registerd
10
+ def registered(app)
11
+ app.set :locales_dir, "locales"
10
12
 
11
- app.send :include, InstanceMethods
13
+ app.send :include, InstanceMethods
12
14
 
13
- # Needed for helpers as well
14
- app.after_configuration do
15
- ::I18n.load_path = [Dir[File.join(root, locales_dir, "*.yml")]]
16
- ::I18n.reload!
15
+ # Needed for helpers as well
16
+ app.after_configuration do
17
+ # This is for making the tests work - since the tests
18
+ # don't completely reload middleman, I18n.load_path can get
19
+ # polluted with paths from other test app directories that don't
20
+ # exist anymore.
21
+ ::I18n.load_path.delete_if {|path| path =~ %r{tmp/aruba}}
22
+ ::I18n.load_path += Dir[File.join(root, locales_dir, "*.yml")]
23
+ ::I18n.reload!
24
+ end
25
+ end
26
+ alias :included :registered
17
27
  end
18
- end
19
- alias :included :registered
20
- end
21
28
 
22
- class Localizer
23
- def initialize(app)
24
- @app = app
25
- @maps = {}
26
- end
29
+ class Localizer
30
+ def initialize(app)
31
+ @app = app
32
+ @maps = {}
33
+ end
27
34
 
28
- def setup(options)
29
- @options = options
35
+ def setup(options)
36
+ @options = options
30
37
 
31
- @lang_map = @options[:lang_map] || {}
32
- @path = @options[:path] || "/:locale/"
33
- @templates_dir = @options[:templates_dir] || "localizable"
34
- @mount_at_root = @options.has_key?(:mount_at_root) ? @options[:mount_at_root] : langs.first
38
+ @lang_map = @options[:lang_map] || {}
39
+ @path = @options[:path] || "/:locale/"
40
+ @templates_dir = @options[:templates_dir] || "localizable"
41
+ @mount_at_root = @options.has_key?(:mount_at_root) ? @options[:mount_at_root] : langs.first
35
42
 
36
- if !@app.build?
37
- puts "== Locales: #{langs.join(", ")}"
38
- end
43
+ if !@app.build?
44
+ puts "== Locales: #{langs.join(", ")}"
45
+ end
39
46
 
40
- # Don't output localizable files
41
- @app.ignore File.join(@templates_dir, "**")
47
+ # Don't output localizable files
48
+ @app.ignore File.join(@templates_dir, "**")
42
49
 
43
- @app.sitemap.provides_metadata_for_path do |url|
44
- if d = get_localization_data(url)
45
- lang, page_id = d
46
- instance_vars = Proc.new {
47
- ::I18n.locale = lang
48
- @lang = lang
49
- @page_id = page_id
50
- }
51
- { :blocks => [instance_vars] }
52
- else
53
- {}
54
- end
55
- end
50
+ @app.sitemap.provides_metadata_for_path do |url|
51
+ if d = get_localization_data(url)
52
+ lang, page_id = d
53
+ instance_vars = Proc.new {
54
+ ::I18n.locale = lang
55
+ @lang = lang
56
+ @page_id = page_id
57
+ }
58
+ { :blocks => [instance_vars] }
59
+ else
60
+ {}
61
+ end
62
+ end
56
63
 
57
- @app.sitemap.register_resource_list_manipulator(
58
- :i18n,
59
- @app.i18n
60
- )
61
- end
64
+ @app.sitemap.register_resource_list_manipulator(
65
+ :i18n,
66
+ @app.i18n
67
+ )
68
+ end
62
69
 
63
- def langs
64
- @options[:langs] || begin
65
- Dir[File.join(@app.root, @app.locales_dir, "*.yml")].map { |file|
66
- File.basename(file).gsub(".yml", "")
67
- }.sort.map(&:to_sym)
68
- end
69
- end
70
+ def langs
71
+ @options[:langs] || begin
72
+ Dir[File.join(@app.root, @app.locales_dir, "*.yml")].map { |file|
73
+ File.basename(file).gsub(".yml", "")
74
+ }.sort.map(&:to_sym)
75
+ end
76
+ end
70
77
 
71
- def get_localization_data(path)
72
- @_localization_data ||= {}
73
- @_localization_data[path]
74
- end
78
+ def get_localization_data(path)
79
+ @_localization_data ||= {}
80
+ @_localization_data[path]
81
+ end
75
82
 
76
- # Update the main sitemap resource list
77
- # @return [void]
78
- def manipulate_resource_list(resources)
79
- @_localization_data = {}
83
+ # Update the main sitemap resource list
84
+ # @return [void]
85
+ def manipulate_resource_list(resources)
86
+ @_localization_data = {}
80
87
 
81
- new_resources = []
88
+ new_resources = []
82
89
 
83
- resources.each do |resource|
84
- next unless File.fnmatch(File.join(@templates_dir, "**"), resource.path)
90
+ resources.each do |resource|
91
+ next unless File.fnmatch(File.join(@templates_dir, "**"), resource.path)
85
92
 
86
- page_id = File.basename(resource.path, File.extname(resource.path))
93
+ page_id = File.basename(resource.path, File.extname(resource.path))
87
94
 
88
- langs.map do |lang|
89
- ::I18n.locale = lang
95
+ langs.map do |lang|
96
+ ::I18n.locale = lang
90
97
 
91
- localized_page_id = ::I18n.t("paths.#{page_id}", :default => page_id)
92
- path = resource.path.sub(@templates_dir, "")
98
+ localized_page_id = ::I18n.t("paths.#{page_id}", :default => page_id)
99
+ path = resource.path.sub(@templates_dir, "")
93
100
 
94
- # Build lang path
95
- if @mount_at_root == lang
96
- prefix = "/"
97
- else
98
- replacement = @lang_map.has_key?(lang) ? @lang_map[lang] : lang
99
- prefix = @path.sub(":locale", replacement.to_s)
100
- end
101
+ # Build lang path
102
+ if @mount_at_root == lang
103
+ prefix = "/"
104
+ else
105
+ replacement = @lang_map.has_key?(lang) ? @lang_map[lang] : lang
106
+ prefix = @path.sub(":locale", replacement.to_s)
107
+ end
101
108
 
102
- path = ::Middleman::Util.normalize_path(
103
- File.join(prefix, path.sub(page_id, localized_page_id))
104
- )
109
+ path = ::Middleman::Util.normalize_path(
110
+ File.join(prefix, path.sub(page_id, localized_page_id))
111
+ )
105
112
 
106
- @_localization_data[path] = [lang, path, localized_page_id]
113
+ @_localization_data[path] = [lang, path, localized_page_id]
107
114
 
108
- p = ::Middleman::Sitemap::Resource.new(
109
- @app.sitemap,
110
- path
111
- )
112
- p.proxy_to(resource.path)
115
+ p = ::Middleman::Sitemap::Resource.new(
116
+ @app.sitemap,
117
+ path
118
+ )
119
+ p.proxy_to(resource.path)
113
120
 
114
- new_resources << p
121
+ new_resources << p
122
+ end
123
+ end
124
+
125
+ resources + new_resources
115
126
  end
116
127
  end
117
-
118
- resources + new_resources
119
- end
120
- end
121
128
 
122
- # Frontmatter class methods
123
- module InstanceMethods
129
+ # Frontmatter class methods
130
+ module InstanceMethods
124
131
 
125
- # Initialize the i18n
126
- def i18n
127
- @_i18n ||= Localizer.new(self)
128
- end
132
+ # Initialize the i18n
133
+ def i18n
134
+ @_i18n ||= Localizer.new(self)
135
+ end
129
136
 
130
- # Main i18n API
131
- def localize(options={})
132
- settings.after_configuration do
133
- i18n.setup(options)
137
+ # Main i18n API
138
+ def localize(options={})
139
+ settings.after_configuration do
140
+ i18n.setup(options)
141
+ end
142
+ end
134
143
  end
135
144
  end
136
145
  end