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
@@ -0,0 +1,338 @@
1
+ # Built on Rack
2
+ require "rack"
3
+ require "rack/file"
4
+
5
+ module Middleman
6
+ module CoreExtensions
7
+
8
+ # Base helper to manipulate asset paths
9
+ module Request
10
+
11
+ # Extension registered
12
+ class << self
13
+ # @private
14
+ def registered(app)
15
+
16
+ # CSSPIE HTC File
17
+ ::Rack::Mime::MIME_TYPES['.html'] = 'text/x-component'
18
+
19
+ # Let's serve all HTML as UTF-8
20
+ ::Rack::Mime::MIME_TYPES['.html'] = 'text/html;charset=utf8'
21
+ ::Rack::Mime::MIME_TYPES['.htm'] = 'text/html;charset=utf8'
22
+
23
+ app.extend ClassMethods
24
+ app.extend ServerMethods
25
+
26
+ # Include instance methods
27
+ app.send :include, InstanceMethods
28
+ end
29
+ alias :included :registered
30
+ end
31
+
32
+ module ClassMethods
33
+ # Reset Rack setup
34
+ #
35
+ # @private
36
+ def reset!
37
+ @app = nil
38
+ @prototype = nil
39
+ end
40
+
41
+ # The shared Rack instance being build
42
+ #
43
+ # @private
44
+ # @return [Rack::Builder]
45
+ def app
46
+ @app ||= ::Rack::Builder.new
47
+ end
48
+
49
+ # Get the static instance
50
+ #
51
+ # @private
52
+ # @return [Middleman::Application]
53
+ def inst(&block)
54
+ @inst ||= begin
55
+ mm = new(&block)
56
+ mm.run_hook :ready
57
+ mm
58
+ end
59
+ end
60
+
61
+ # Set the shared instance
62
+ #
63
+ # @private
64
+ # @param [Middleman::Application] inst
65
+ # @return [void]
66
+ def inst=(inst)
67
+ @inst = inst
68
+ end
69
+
70
+ # Return built Rack app
71
+ #
72
+ # @private
73
+ # @return [Rack::Builder]
74
+ def to_rack_app(&block)
75
+ inner_app = inst(&block)
76
+
77
+ (@middleware || []).each do |m|
78
+ app.use(m[0], *m[1], &m[2])
79
+ end
80
+
81
+ app.map("/") { run inner_app }
82
+
83
+ (@mappings || []).each do |m|
84
+ app.map(m[0], &m[1])
85
+ end
86
+
87
+ app
88
+ end
89
+
90
+ # Prototype app. Used in config.ru
91
+ #
92
+ # @private
93
+ # @return [Rack::Builder]
94
+ def prototype
95
+ @prototype ||= to_rack_app
96
+ end
97
+
98
+ # Call prototype, use in config.ru
99
+ #
100
+ # @private
101
+ def call(env)
102
+ prototype.call(env)
103
+ end
104
+
105
+ # Use Rack middleware
106
+ #
107
+ # @param [Class] middleware Middleware module
108
+ # @return [void]
109
+ def use(middleware, *args, &block)
110
+ @middleware ||= []
111
+ @middleware << [middleware, args, block]
112
+ end
113
+
114
+ # Add Rack App mapped to specific path
115
+ #
116
+ # @param [String] map Path to map
117
+ # @return [void]
118
+ def map(map, &block)
119
+ @mappings ||= []
120
+ @mappings << [map, block]
121
+ end
122
+ end
123
+
124
+ module ServerMethods
125
+ # Create a new Class which is based on Middleman::Application
126
+ # Used to create a safe sandbox into which extensions and
127
+ # configuration can be included later without impacting
128
+ # other classes and instances.
129
+ #
130
+ # @return [Class]
131
+ def server(&block)
132
+ @@servercounter ||= 0
133
+ @@servercounter += 1
134
+ const_set("MiddlemanApplication#{@@servercounter}", Class.new(Middleman::Application))
135
+ end
136
+ end
137
+
138
+ # Methods to be mixed-in to Middleman::Application
139
+ module InstanceMethods
140
+ # Backwards-compatibility with old request.path signature
141
+ def request
142
+ Thread.current[:request]
143
+ end
144
+
145
+ # Accessor for current path
146
+ # @return [String]
147
+ def current_path
148
+ Thread.current[:current_path]
149
+ end
150
+
151
+ # Set the current path
152
+ #
153
+ # @param [String] path The new current path
154
+ # @return [void]
155
+ def current_path=(path)
156
+ Thread.current[:current_path] = path
157
+ Thread.current[:request] = ::Thor::CoreExt::HashWithIndifferentAccess.new({
158
+ :path => path,
159
+ :params => req ? ::Thor::CoreExt::HashWithIndifferentAccess.new(req.params) : {}
160
+ })
161
+ end
162
+
163
+ def use(*args, &block); self.class.use(*args); end
164
+ def map(*args, &block); self.class.map(*args, &block); end
165
+
166
+ # Rack env
167
+ def env
168
+ Thread.current[:env]
169
+ end
170
+ def env=(value)
171
+ Thread.current[:env] = value
172
+ end
173
+
174
+ # Rack request
175
+ # @return [Rack::Request]
176
+ def req
177
+ Thread.current[:req]
178
+ end
179
+ def req=(value)
180
+ Thread.current[:req] = value
181
+ end
182
+
183
+ # Rack response
184
+ # @return [Rack::Response]
185
+ def res
186
+ Thread.current[:res]
187
+ end
188
+ def res=(value)
189
+ Thread.current[:res] = value
190
+ end
191
+
192
+ def call(env)
193
+ dup.call!(env)
194
+ end
195
+
196
+ # Rack Interface
197
+ #
198
+ # @param env Rack environment
199
+ def call!(env)
200
+ self.env = env
201
+ # Store environment, request and response for later
202
+ self.req = req = ::Rack::Request.new(env)
203
+ self.res = res = ::Rack::Response.new
204
+
205
+ puts "== Request: #{env["PATH_INFO"]}" if logging?
206
+
207
+ # Catch :halt exceptions and use that response if given
208
+ catch(:halt) do
209
+ process_request(env, req, res)
210
+
211
+ res.status = 404
212
+ res.finish
213
+ end
214
+ end
215
+
216
+ # Halt the current request and return a response
217
+ #
218
+ # @param [String] response Response value
219
+ def halt(response)
220
+ throw :halt, response
221
+ end
222
+
223
+ # Core response method. We process the request, check with
224
+ # the sitemap, and return the correct file, response or status
225
+ # message.
226
+ #
227
+ # @param env
228
+ # @param [Rack::Request] req
229
+ # @param [Rack::Response] res
230
+ def process_request(env, req, res)
231
+ start_time = Time.now
232
+
233
+ # Normalize the path and add index if we're looking at a directory
234
+ original_path = URI.decode(env["PATH_INFO"].dup)
235
+ if original_path.respond_to? :force_encoding
236
+ original_path.force_encoding('UTF-8')
237
+ end
238
+ request_path = full_path(original_path)
239
+
240
+ # Run before callbacks
241
+ run_hook :before
242
+
243
+ if original_path != request_path
244
+ # Get the resource object for this path
245
+ resource = sitemap.find_resource_by_destination_path(original_path)
246
+ end
247
+
248
+ # Get the resource object for this full path
249
+ resource ||= sitemap.find_resource_by_destination_path(request_path)
250
+
251
+ # Return 404 if not in sitemap
252
+ return not_found(res) unless resource && !resource.ignored?
253
+
254
+ # If this path is a static file, send it immediately
255
+ return send_file(resource.source_file, env, res) unless resource.template?
256
+
257
+ # Set the current path for use in helpers
258
+ self.current_path = request_path.dup
259
+
260
+ # Set a HTTP content type based on the request's extensions
261
+ content_type(res, resource.mime_type)
262
+
263
+ begin
264
+ # Write out the contents of the page
265
+ res.write resource.render
266
+
267
+ # Valid content is a 200 status
268
+ res.status = 200
269
+ rescue Middleman::CoreExtensions::Rendering::TemplateNotFound => e
270
+ res.write "Error: #{e.message}"
271
+ res.status = 500
272
+ end
273
+
274
+ # End the request
275
+ puts "== Finishing Request: #{self.current_path} (#{(Time.now - start_time).round(2)}s)" if logging?
276
+ halt res.finish
277
+ end
278
+
279
+ # Add a new mime-type for a specific extension
280
+ #
281
+ # @param [Symbol] type File extension
282
+ # @param [String] value Mime type
283
+ # @return [void]
284
+ def mime_type(type, value=nil)
285
+ return type if type.nil? || type.to_s.include?('/')
286
+ type = ".#{type}" unless type.to_s[0] == ?.
287
+ return ::Rack::Mime.mime_type(type, nil) unless value
288
+ ::Rack::Mime::MIME_TYPES[type] = value
289
+ end
290
+
291
+ # Halt request and return 404
292
+ def not_found(res)
293
+ res.status == 404
294
+ res.write "<html><body><h1>File Not Found</h1><p>#{@request_path}</p></body>"
295
+ res.finish
296
+ end
297
+
298
+ # Immediately send static file
299
+ #
300
+ # @param [String] path File to send
301
+ def send_file(path, env, res)
302
+ extension = File.extname(path)
303
+ matched_mime = mime_type(extension)
304
+ matched_mime = "application/octet-stream" if matched_mime.nil?
305
+ content_type res, matched_mime
306
+
307
+ file = ::Rack::File.new nil
308
+ file.path = path
309
+ response = file.serving(env)
310
+ response[1]['Content-Encoding'] = 'gzip' if %w(.svgz).include?(extension)
311
+ halt response
312
+ end
313
+
314
+ # Set the content type for the current request
315
+ #
316
+ # @param [String] type Content type
317
+ # @param [Hash] params
318
+ # @return [void]
319
+ def content_type(res, type, params={})
320
+ return res['Content-Type'] unless type
321
+ default = params.delete :default
322
+ mime_type = mime_type(type) || default
323
+ throw "Unknown media type: %p" % type if mime_type.nil?
324
+ mime_type = mime_type.dup
325
+ unless params.include? :charset
326
+ params[:charset] = params.delete('charset') || "utf-8"
327
+ end
328
+ params.delete :charset if mime_type.include? 'charset'
329
+ unless params.empty?
330
+ mime_type << (mime_type.include?(';') ? ', ' : ';')
331
+ mime_type << params.map { |kv| kv.join('=') }.join(', ')
332
+ end
333
+ res['Content-Type'] = mime_type
334
+ end
335
+ end
336
+ end
337
+ end
338
+ end
@@ -1,88 +1,92 @@
1
1
  # Routing extension
2
- module Middleman::CoreExtensions::Routing
2
+ module Middleman
3
+ module CoreExtensions
4
+ module Routing
3
5
 
4
- # Setup extension
5
- class << self
6
+ # Setup extension
7
+ class << self
6
8
 
7
- # Once registered
8
- def registered(app)
9
- # Include methods
10
- app.send :include, InstanceMethods
11
- end
9
+ # Once registered
10
+ def registered(app)
11
+ # Include methods
12
+ app.send :include, InstanceMethods
13
+ end
12
14
 
13
- alias :included :registered
14
- end
15
+ alias :included :registered
16
+ end
15
17
 
16
- # Routing instance methods
17
- module InstanceMethods
18
+ # Routing instance methods
19
+ module InstanceMethods
18
20
 
19
- # Takes a block which allows many pages to have the same layout
20
- #
21
- # with_layout :admin do
22
- # page "/admin/"
23
- # page "/admin/login.html"
24
- # end
25
- #
26
- # @param [String, Symbol] layout_name
27
- # @return [void]
28
- def with_layout(layout_name, &block)
29
- old_layout = layout
21
+ # Takes a block which allows many pages to have the same layout
22
+ #
23
+ # with_layout :admin do
24
+ # page "/admin/"
25
+ # page "/admin/login.html"
26
+ # end
27
+ #
28
+ # @param [String, Symbol] layout_name
29
+ # @return [void]
30
+ def with_layout(layout_name, &block)
31
+ old_layout = layout
30
32
 
31
- set :layout, layout_name
32
- instance_exec(&block) if block_given?
33
- ensure
34
- set :layout, old_layout
35
- end
33
+ set :layout, layout_name
34
+ instance_exec(&block) if block_given?
35
+ ensure
36
+ set :layout, old_layout
37
+ end
36
38
 
37
- # The page method allows the layout to be set on a specific path
38
- #
39
- # page "/about.html", :layout => false
40
- # page "/", :layout => :homepage_layout
41
- #
42
- # @param [String] url
43
- # @param [Hash] opts
44
- # @return [void]
45
- def page(url, opts={}, &block)
46
- a_block = block_given? ? block : nil
39
+ # The page method allows the layout to be set on a specific path
40
+ #
41
+ # page "/about.html", :layout => false
42
+ # page "/", :layout => :homepage_layout
43
+ #
44
+ # @param [String] url
45
+ # @param [Hash] opts
46
+ # @return [void]
47
+ def page(url, opts={}, &block)
48
+ a_block = block_given? ? block : nil
47
49
 
48
- # Default layout
49
- opts[:layout] = layout if opts[:layout].nil?
50
+ # Default layout
51
+ opts[:layout] = layout if opts[:layout].nil?
50
52
 
51
- # If the url is a regexp
52
- if url.is_a?(Regexp) || url.include?("*")
53
+ # If the url is a regexp
54
+ if url.is_a?(Regexp) || url.include?("*")
53
55
 
54
- # Use the metadata loop for matching against paths at runtime
55
- sitemap.provides_metadata_for_path url do |url|
56
- { :options => opts, :blocks => [a_block] }
57
- end
56
+ # Use the metadata loop for matching against paths at runtime
57
+ sitemap.provides_metadata_for_path url do |url|
58
+ { :options => opts, :blocks => [a_block] }
59
+ end
58
60
 
59
- return
60
- end
61
+ return
62
+ end
61
63
 
62
- # Normalized path
63
- url = full_path(url)
64
+ # Normalized path
65
+ url = full_path(url)
64
66
 
65
- # Setup proxy
66
- if opts.has_key?(:proxy)
67
- proxy(url, opts[:proxy])
67
+ # Setup proxy
68
+ if opts.has_key?(:proxy)
69
+ proxy(url, opts[:proxy])
68
70
 
69
- if opts.has_key?(:ignore) && opts[:ignore]
70
- ignore(opts[:proxy])
71
- opts.delete(:ignore)
72
- end
71
+ if opts.has_key?(:ignore) && opts[:ignore]
72
+ ignore(opts[:proxy])
73
+ opts.delete(:ignore)
74
+ end
73
75
 
74
- opts.delete(:proxy)
75
- else
76
- if opts.has_key?(:ignore) && opts[:ignore]
77
- ignore(url)
78
- opts.delete(:ignore)
79
- end
80
- end
76
+ opts.delete(:proxy)
77
+ else
78
+ if opts.has_key?(:ignore) && opts[:ignore]
79
+ ignore(url)
80
+ opts.delete(:ignore)
81
+ end
82
+ end
81
83
 
82
- # Setup a metadata matcher for rendering those options
83
- sitemap.provides_metadata_for_path url do |url|
84
- { :options => opts, :blocks => [a_block] }
84
+ # Setup a metadata matcher for rendering those options
85
+ sitemap.provides_metadata_for_path url do |url|
86
+ { :options => opts, :blocks => [a_block] }
87
+ end
88
+ end
85
89
  end
86
90
  end
87
91
  end
88
- end
92
+ end
@@ -1,26 +1,31 @@
1
+ # Require lib
2
+ require 'rack/showexceptions'
3
+
1
4
  # Support rack/showexceptions during development
2
- module Middleman::CoreExtensions::ShowExceptions
5
+ module Middleman
6
+ module CoreExtensions
7
+ module ShowExceptions
3
8
 
4
- # Setup extension
5
- class << self
9
+ # Setup extension
10
+ class << self
6
11
 
7
- # Once registered
8
- def registered(app)
9
- # Require lib
10
- require 'rack/showexceptions'
11
-
12
- # When in dev
13
- app.configure :development do
14
- # Include middlemare
15
- if show_exceptions
16
- use ::Middleman::CoreExtensions::ShowExceptions::Middleware
12
+ # Once registered
13
+ def registered(app)
14
+ # When in dev
15
+ app.configure :development do
16
+ # Include middlemare
17
+ if show_exceptions
18
+ use ::Middleman::CoreExtensions::ShowExceptions::Middleware
19
+ end
20
+ end
17
21
  end
18
22
  end
19
- end
20
- end
21
23
 
22
- # Custom exception class
23
- # TODO: Style this ourselves
24
- class Middleware < ::Rack::ShowExceptions
24
+ # Custom exception class
25
+ # TODO: Style this ourselves
26
+ class Middleware < ::Rack::ShowExceptions
27
+ end
28
+
29
+ end
25
30
  end
26
31
  end
@@ -0,0 +1,39 @@
1
+ # Rack Request
2
+ require "middleman-core/core_extensions/request"
3
+
4
+ # File Change Notifier
5
+ require "middleman-core/core_extensions/file_watcher"
6
+
7
+ # Add Builder callbacks
8
+ require "middleman-core/core_extensions/builder"
9
+
10
+ # Custom Feature API
11
+ require "middleman-core/core_extensions/extensions"
12
+
13
+ # Asset Path Pipeline
14
+ require "middleman-core/core_extensions/assets"
15
+
16
+ # Data looks at the data/ folder for YAML files and makes them available
17
+ # to dynamic requests.
18
+ require "middleman-core/core_extensions/data"
19
+
20
+ # Parse YAML from templates
21
+ require "middleman-core/core_extensions/front_matter"
22
+
23
+ # External helpers looks in the helpers/ folder for helper modules
24
+ require "middleman-core/core_extensions/external_helpers"
25
+
26
+ # DefaultHelpers are the built-in dynamic template helpers.
27
+ require "middleman-core/core_extensions/default_helpers"
28
+
29
+ # Extended version of Padrino's rendering
30
+ require "middleman-core/core_extensions/rendering"
31
+
32
+ # Pass custom options to views
33
+ require "middleman-core/core_extensions/routing"
34
+
35
+ # Catch and show exceptions at the Rack level
36
+ require "middleman-core/core_extensions/show_exceptions"
37
+
38
+ # i18n
39
+ require "middleman-core/core_extensions/i18n"
@@ -46,12 +46,9 @@ module Middleman::Extensions
46
46
  next
47
47
  end
48
48
 
49
- resource.destination_path = resource.path.chomp(File.extname(index_file)) + new_index_path
49
+ resource.destination_path = resource.destination_path.chomp(File.extname(index_file)) + new_index_path
50
50
  end
51
51
  end
52
52
  end
53
53
  end
54
-
55
- # Register the extension
56
- register :directory_indexes, DirectoryIndexes
57
54
  end
@@ -138,6 +138,16 @@ module Middleman::Extensions
138
138
  names[rand(names.size)]
139
139
  end
140
140
 
141
+ # Get a placeholder 140 character tweet about Philip the Purple Otter
142
+ # Via http://www.kevadamson.com/talking-of-design/article/140-alternative-characters-to-lorem-ipsum
143
+ # @return [String]
144
+ def tweet
145
+ tweets = [ 'Far away, in a forest next to a river beneath the mountains, there lived a small purple otter called Philip. Philip likes sausages. The End.',
146
+ 'He liked the quality sausages from Marks & Spencer but due to the recession he had been forced to shop in a less desirable supermarket. End.',
147
+ 'He awoke one day to find his pile of sausages missing. Roger the greedy boar with human eyes, had skateboarded into the forest & eaten them!']
148
+ tweets[rand(tweets.size)]
149
+ end
150
+
141
151
  # Get a placeholder email address
142
152
  # @return [String]
143
153
  def email
@@ -182,7 +192,4 @@ module Middleman::Extensions
182
192
  end
183
193
  end
184
194
  end
185
-
186
- # Register the extension
187
- register :lorem, Lorem
188
195
  end