middleman-core 3.1.0.rc.2 → 3.1.0.rc.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (232) hide show
  1. checksums.yaml +4 -4
  2. data/.simplecov +2 -1
  3. data/features/capture_html.feature +18 -0
  4. data/features/content_for.feature +3 -3
  5. data/features/v4_extension_callbacks.feature +8 -0
  6. data/fixtures/capture-html-app/config.rb +7 -0
  7. data/fixtures/capture-html-app/source/capture_html_erb.html.erb +5 -0
  8. data/fixtures/capture-html-app/source/capture_html_haml.html.haml +4 -0
  9. data/fixtures/capture-html-app/source/capture_html_slim.html.slim +4 -0
  10. data/fixtures/capture-html-app/source/layouts/capture_html.erb +4 -0
  11. data/fixtures/content-for-app/source/content_for_erb.html.erb +1 -1
  12. data/fixtures/content-for-app/source/content_for_haml.html.haml +1 -1
  13. data/fixtures/content-for-app/source/content_for_slim.html.slim +2 -1
  14. data/fixtures/v4-extension-callbacks/config.rb +26 -0
  15. data/fixtures/v4-extension-callbacks/source/index.html.erb +2 -0
  16. data/lib/middleman-core/core_extensions/extensions.rb +6 -1
  17. data/lib/middleman-core/core_extensions/file_watcher.rb +1 -0
  18. data/lib/middleman-core/core_extensions/rendering.rb +1 -2
  19. data/lib/middleman-core/core_extensions/request.rb +2 -2
  20. data/lib/middleman-core/extensions.rb +21 -0
  21. data/lib/middleman-core/meta_pages/sitemap_resource.rb +4 -1
  22. data/lib/middleman-core/version.rb +1 -1
  23. data/lib/middleman-more/core_extensions/default_helpers.rb +17 -3
  24. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/.document +0 -0
  25. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/.gitignore +0 -0
  26. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/.yardopts +0 -0
  27. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/LICENSE.txt +0 -0
  28. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/README.rdoc +0 -0
  29. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/Rakefile +0 -0
  30. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/bin/padrino +0 -0
  31. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core.rb +58 -4
  32. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/application.rb +40 -16
  33. data/lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/flash.rb +229 -0
  34. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/application/rendering.rb +39 -11
  35. data/lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/rendering/extensions/erubis.rb +55 -0
  36. data/lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/rendering/extensions/haml.rb +26 -0
  37. data/lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/application/rendering/extensions/slim.rb +14 -0
  38. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/application/routing.rb +133 -37
  39. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/application/showexceptions.rb +0 -0
  40. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/caller.rb +0 -0
  41. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/cli/adapter.rb +0 -0
  42. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/cli/base.rb +41 -38
  43. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/cli/console.rb +0 -0
  44. data/lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/cli/rake.rb +47 -0
  45. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/cli/rake_tasks.rb +9 -14
  46. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/command.rb +0 -0
  47. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/images/404.png +0 -0
  48. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/images/500.png +0 -0
  49. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/loader.rb +23 -9
  50. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/cs.yml +0 -0
  51. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/da.yml +0 -0
  52. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/de.yml +6 -6
  53. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/en.yml +0 -0
  54. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/es.yml +0 -0
  55. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/fr.yml +1 -1
  56. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/hu.yml +0 -0
  57. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/it.yml +0 -0
  58. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/ja.yml +0 -0
  59. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/lv.yml +0 -0
  60. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/nl.yml +0 -0
  61. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/no.yml +0 -0
  62. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/pl.yml +0 -0
  63. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/pt_br.yml +0 -0
  64. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/ro.yml +0 -0
  65. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/ru.yml +1 -1
  66. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/sv.yml +0 -0
  67. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/tr.yml +0 -0
  68. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/uk.yml +0 -0
  69. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/zh_cn.yml +11 -11
  70. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/locale/zh_tw.yml +0 -0
  71. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/logger.rb +48 -32
  72. data/lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/module.rb +58 -0
  73. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/mounter.rb +15 -5
  74. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/reloader.rb +139 -52
  75. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/router.rb +0 -0
  76. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/server.rb +5 -5
  77. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/support_lite.rb +59 -6
  78. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/tasks.rb +0 -0
  79. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/lib/padrino-core/version.rb +1 -1
  80. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/padrino-core.gemspec +10 -5
  81. data/lib/vendored-middleman-deps/padrino-core-0.11.2/test/fixtures/app_gem/Gemfile +4 -0
  82. data/lib/vendored-middleman-deps/padrino-core-0.11.2/test/fixtures/app_gem/app/app.rb +3 -0
  83. data/lib/vendored-middleman-deps/padrino-core-0.11.2/test/fixtures/app_gem/app_gem.gemspec +17 -0
  84. data/lib/vendored-middleman-deps/padrino-core-0.11.2/test/fixtures/app_gem/lib/app_gem.rb +7 -0
  85. data/lib/vendored-middleman-deps/padrino-core-0.11.2/test/fixtures/app_gem/lib/app_gem/version.rb +3 -0
  86. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/fixtures/apps/.components +0 -0
  87. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/fixtures/apps/.gitignore +0 -0
  88. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/fixtures/apps/complex.rb +0 -0
  89. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/fixtures/apps/simple.rb +0 -0
  90. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/fixtures/dependencies/a.rb +0 -0
  91. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/fixtures/dependencies/b.rb +0 -0
  92. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/fixtures/dependencies/c.rb +0 -0
  93. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/fixtures/dependencies/circular/e.rb +0 -0
  94. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/fixtures/dependencies/circular/f.rb +0 -0
  95. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/fixtures/dependencies/circular/g.rb +0 -0
  96. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/fixtures/dependencies/d.rb +0 -0
  97. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/helper.rb +0 -0
  98. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/mini_shoulda.rb +2 -2
  99. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/test_application.rb +38 -21
  100. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/test_core.rb +0 -0
  101. data/lib/vendored-middleman-deps/padrino-core-0.11.2/test/test_csrf_protection.rb +80 -0
  102. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/test_dependencies.rb +0 -0
  103. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/test_filters.rb +70 -0
  104. data/lib/vendored-middleman-deps/padrino-core-0.11.2/test/test_flash.rb +168 -0
  105. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/test_locale.rb +0 -0
  106. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/test_logger.rb +27 -0
  107. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/test_mounter.rb +24 -2
  108. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/test_reloader_complex.rb +0 -0
  109. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/test_reloader_simple.rb +4 -4
  110. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/test_rendering.rb +75 -4
  111. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/test_restful_routing.rb +0 -0
  112. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/test_router.rb +0 -0
  113. data/lib/vendored-middleman-deps/{padrino-core-0.10.7 → padrino-core-0.11.2}/test/test_routing.rb +209 -35
  114. data/lib/vendored-middleman-deps/padrino-core-0.11.2/test/test_support_lite.rb +56 -0
  115. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/.document +0 -0
  116. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/.gitignore +0 -0
  117. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/.yardopts +0 -0
  118. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/LICENSE.txt +0 -0
  119. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/README.rdoc +0 -0
  120. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/Rakefile +0 -0
  121. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers.rb +2 -1
  122. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/asset_tag_helpers.rb +58 -66
  123. data/lib/vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers/breadcrumb_helpers.rb +171 -0
  124. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/form_builder/abstract_form_builder.rb +84 -26
  125. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/form_builder/standard_form_builder.rb +0 -0
  126. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/form_helpers.rb +94 -19
  127. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/format_helpers.rb +9 -5
  128. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/cs.yml +0 -0
  129. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/da.yml +0 -0
  130. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/de.yml +0 -0
  131. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/en.yml +0 -0
  132. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/es.yml +0 -0
  133. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/fr.yml +12 -12
  134. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/hu.yml +0 -0
  135. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/it.yml +0 -0
  136. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/ja.yml +0 -0
  137. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/lv.yml +0 -0
  138. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/nl.yml +0 -0
  139. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/no.yml +0 -0
  140. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/pl.yml +0 -0
  141. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/pt_br.yml +2 -2
  142. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/ro.yml +0 -0
  143. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/ru.yml +0 -0
  144. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/sv.yml +0 -0
  145. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/tr.yml +0 -0
  146. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/uk.yml +0 -0
  147. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/zh_cn.yml +13 -14
  148. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/locale/zh_tw.yml +0 -0
  149. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/number_helpers.rb +0 -0
  150. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/output_helpers.rb +45 -5
  151. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/output_helpers/abstract_handler.rb +0 -0
  152. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/output_helpers/erb_handler.rb +3 -3
  153. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/output_helpers/haml_handler.rb +0 -0
  154. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/output_helpers/slim_handler.rb +6 -7
  155. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/render_helpers.rb +2 -2
  156. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/tag_helpers.rb +34 -6
  157. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/lib/padrino-helpers/translation_helpers.rb +0 -0
  158. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/padrino-helpers.gemspec +0 -0
  159. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/app.rb +13 -6
  160. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/capture_concat.erb +2 -2
  161. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/capture_concat.haml +2 -2
  162. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/capture_concat.slim +4 -5
  163. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/content_for.erb +0 -0
  164. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/content_for.haml +0 -0
  165. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/content_for.slim +4 -4
  166. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/content_tag.erb +0 -0
  167. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/content_tag.haml +0 -0
  168. data/lib/vendored-middleman-deps/padrino-helpers-0.11.2/test/fixtures/markup_app/views/content_tag.slim +9 -0
  169. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/current_engine.erb +0 -0
  170. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/current_engine.haml +1 -1
  171. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/current_engine.slim +0 -0
  172. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/fields_for.erb +0 -0
  173. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/fields_for.haml +0 -0
  174. data/lib/vendored-middleman-deps/padrino-helpers-0.11.2/test/fixtures/markup_app/views/fields_for.slim +15 -0
  175. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/form_for.erb +0 -0
  176. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/form_for.haml +0 -0
  177. data/lib/vendored-middleman-deps/padrino-helpers-0.11.2/test/fixtures/markup_app/views/form_for.slim +59 -0
  178. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/form_tag.erb +0 -0
  179. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/form_tag.haml +0 -0
  180. data/lib/vendored-middleman-deps/padrino-helpers-0.11.2/test/fixtures/markup_app/views/form_tag.slim +70 -0
  181. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/link_to.erb +0 -0
  182. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/link_to.haml +0 -0
  183. data/lib/vendored-middleman-deps/padrino-helpers-0.11.2/test/fixtures/markup_app/views/link_to.slim +4 -0
  184. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/mail_to.erb +0 -0
  185. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/mail_to.haml +0 -0
  186. data/lib/vendored-middleman-deps/padrino-helpers-0.11.2/test/fixtures/markup_app/views/mail_to.slim +3 -0
  187. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/meta_tag.erb +0 -0
  188. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/meta_tag.haml +0 -0
  189. data/lib/vendored-middleman-deps/padrino-helpers-0.11.2/test/fixtures/markup_app/views/meta_tag.slim +3 -0
  190. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/partials/_erb.erb +0 -0
  191. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/partials/_haml.haml +0 -0
  192. data/lib/vendored-middleman-deps/padrino-helpers-0.11.2/test/fixtures/markup_app/views/partials/_slim.slim +1 -0
  193. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/simple_partial.erb +0 -0
  194. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/markup_app/views/simple_partial.haml +0 -0
  195. data/lib/vendored-middleman-deps/padrino-helpers-0.11.2/test/fixtures/markup_app/views/simple_partial.slim +1 -0
  196. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/render_app/app.rb +7 -0
  197. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/render_app/views/current_engine.haml +0 -0
  198. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/render_app/views/current_engines/_erb.erb +0 -0
  199. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/render_app/views/current_engines/_haml.haml +0 -0
  200. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/render_app/views/current_engines/_slim.slim +0 -0
  201. data/lib/vendored-middleman-deps/padrino-helpers-0.11.2/test/fixtures/render_app/views/double_capture_erb.erb +3 -0
  202. data/lib/vendored-middleman-deps/padrino-helpers-0.11.2/test/fixtures/render_app/views/double_capture_haml.haml +2 -0
  203. data/lib/vendored-middleman-deps/padrino-helpers-0.11.2/test/fixtures/render_app/views/double_capture_slim.slim +2 -0
  204. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/render_app/views/erb/test.erb +0 -0
  205. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/render_app/views/explicit_engine.haml +0 -0
  206. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/render_app/views/haml/test.haml +0 -0
  207. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/render_app/views/template/_user.haml +0 -0
  208. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/render_app/views/template/haml_template.haml +0 -0
  209. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/fixtures/render_app/views/template/some_template.haml +0 -0
  210. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/helper.rb +1 -0
  211. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/test_asset_tag_helpers.rb +24 -5
  212. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/test_form_builder.rb +41 -1
  213. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/test_form_helpers.rb +36 -0
  214. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/test_format_helpers.rb +14 -0
  215. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/test_locale.rb +0 -0
  216. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/test_number_helpers.rb +0 -0
  217. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/test_output_helpers.rb +5 -3
  218. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/test_render_helpers.rb +18 -0
  219. data/lib/vendored-middleman-deps/{padrino-helpers-0.10.7 → padrino-helpers-0.11.2}/test/test_tag_helpers.rb +11 -0
  220. data/middleman-core.gemspec +1 -1
  221. metadata +218 -184
  222. data/lib/vendored-middleman-deps/padrino-core-0.10.7/lib/padrino-core/cli/rake.rb +0 -25
  223. data/lib/vendored-middleman-deps/padrino-helpers-0.10.7/test/fixtures/markup_app/views/content_tag.slim +0 -9
  224. data/lib/vendored-middleman-deps/padrino-helpers-0.10.7/test/fixtures/markup_app/views/fields_for.slim +0 -15
  225. data/lib/vendored-middleman-deps/padrino-helpers-0.10.7/test/fixtures/markup_app/views/form_for.slim +0 -59
  226. data/lib/vendored-middleman-deps/padrino-helpers-0.10.7/test/fixtures/markup_app/views/form_tag.slim +0 -70
  227. data/lib/vendored-middleman-deps/padrino-helpers-0.10.7/test/fixtures/markup_app/views/link_to.slim +0 -4
  228. data/lib/vendored-middleman-deps/padrino-helpers-0.10.7/test/fixtures/markup_app/views/mail_to.slim +0 -3
  229. data/lib/vendored-middleman-deps/padrino-helpers-0.10.7/test/fixtures/markup_app/views/meta_tag.slim +0 -3
  230. data/lib/vendored-middleman-deps/padrino-helpers-0.10.7/test/fixtures/markup_app/views/partials/_slim.slim +0 -1
  231. data/lib/vendored-middleman-deps/padrino-helpers-0.10.7/test/fixtures/markup_app/views/simple_partial.slim +0 -1
  232. data/spec/middleman-core/sitemap_spec.rb +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f0268514dc3abe13da04e0bfd4bb14b5817ba45a
4
- data.tar.gz: 7727d4051f853d8ef84b2212c6092e6ad5e71991
3
+ metadata.gz: d409fa4b4685ed3179880f7ec5f6b3d738b02cb5
4
+ data.tar.gz: 85297e96e43c14c1cdc4f08acb9c909f5eef6e04
5
5
  SHA512:
6
- metadata.gz: 2668ab06a6cad5a214691da0310e7ad6fb0329753c8f8f5b7fcb6150d256c3cdfd5a952e15d1fe5ddb1d90d3397a15c00683975fe97bbbb386b2d6d1fc6b3baf
7
- data.tar.gz: f4b5d70c1e7507abe9f4fbecea9de575609697f611fd0e907edeb912b539ef09e87c419d247464fcb2c61e9fb3aa3a085e1534e32ba47dd12ae9a621f977aa52
6
+ metadata.gz: eb1fc2f29f119b5972c274f85bad7601e981aeba564a33ea0ec97fe3be68e84da70e5db0e08e6120f73e4c9c4f740b2f38c78aeb87b971c0cfa3e715a66de476
7
+ data.tar.gz: d5487e80ecd0b193602ab72ea0de5764685998a1838c8bfca0f3fd1a320c21e542dd568abd660085aa5acc33d32fd74f50d61f16f17edc272fd878f20f1f88bc
data/.simplecov CHANGED
@@ -1,6 +1,7 @@
1
1
  SimpleCov.start do
2
+ add_filter '/fixtures/'
2
3
  add_filter '/features/'
3
4
  add_filter '/spec/'
4
- add_filter '/vendor'
5
5
  add_filter '/step_definitions/'
6
+ add_filter '/lib/vendored-middleman-deps/'
6
7
  end
@@ -0,0 +1,18 @@
1
+ @wip
2
+
3
+ Feature: Support capture_html and yield_content helpers
4
+
5
+ Scenario: content_for works as expected in erb
6
+ Given the Server is running at "capture-html-app"
7
+ When I go to "/capture_html_erb.html"
8
+ Then I should see "In Layout: <h1>I am the yielded content erb</h1>"
9
+
10
+ Scenario: content_for works as expected in haml
11
+ Given the Server is running at "capture-html-app"
12
+ When I go to "/capture_html_haml.html"
13
+ Then I should see "In Layout: <h1>I am the yielded content haml</h1>"
14
+
15
+ Scenario: content_for works as expected in slim
16
+ Given the Server is running at "capture-html-app"
17
+ When I go to "/capture_html_slim.html"
18
+ Then I should see "In Layout: <h1>I am the yielded content slim</h1>"
@@ -3,14 +3,14 @@ Feature: Support content_for and yield_content helpers
3
3
  Scenario: content_for works as expected in erb
4
4
  Given the Server is running at "content-for-app"
5
5
  When I go to "/content_for_erb.html"
6
- Then I should see "In Layout: I am the yielded content erb"
6
+ Then I should see "In Layout: I am the yielded content erb <s>with html tags</s>"
7
7
 
8
8
  Scenario: content_for works as expected in haml
9
9
  Given the Server is running at "content-for-app"
10
10
  When I go to "/content_for_haml.html"
11
- Then I should see "In Layout: I am the yielded content haml"
11
+ Then I should see "In Layout: I am the yielded content haml <s>with html tags</s>"
12
12
 
13
13
  Scenario: content_for works as expected in slim
14
14
  Given the Server is running at "content-for-app"
15
15
  When I go to "/content_for_slim.html"
16
- Then I should see "In Layout: I am the yielded content slim"
16
+ Then I should see "In Layout: I am the yielded content slim <s>with html tags</s>"
@@ -0,0 +1,8 @@
1
+ Feature: v4 Extensions should have after_activated hooks
2
+
3
+ Scenario: Hello Helper
4
+ Given the Server is running at "v4-extension-callbacks"
5
+ Then going to "/index.html" should not raise an exception
6
+ And I should see "Extension One: true"
7
+ And I should see "Extension Two: true"
8
+
@@ -0,0 +1,7 @@
1
+ require "slim"
2
+
3
+ with_layout :capture_html do
4
+ page "/capture_html_erb.html"
5
+ page "/capture_html_haml.html"
6
+ page "/capture_html_slim.html"
7
+ end
@@ -0,0 +1,5 @@
1
+ <% capture_html :from_template do %>
2
+ <h1>I am the yielded content erb</h1>
3
+ <% end %>
4
+
5
+ I am in the template
@@ -0,0 +1,4 @@
1
+ - capture_html :from_template do
2
+ %h1= "I am the yielded content haml"
3
+
4
+ %p I am in the template
@@ -0,0 +1,4 @@
1
+ - capture_html :from_template do
2
+ h1 I am the yielded content slim
3
+
4
+ | I am in the template
@@ -0,0 +1,4 @@
1
+ In Layout: <%= yield_content(:from_template) %>
2
+
3
+ In Template:
4
+ <%= yield %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :from_template do %>
2
- I am the yielded content erb
2
+ I am the yielded content erb <s>with html tags</s>
3
3
  <% end %>
4
4
 
5
5
  I am in the template
@@ -1,4 +1,4 @@
1
1
  - content_for :from_template do
2
- = "I am the yielded content haml"
2
+ = "I am the yielded content haml <s>with html tags</s>"
3
3
 
4
4
  %p I am in the template
@@ -1,4 +1,5 @@
1
1
  - content_for :from_template do
2
- | I am the yielded content slim
2
+ | I am the yielded content slim
3
+ s with html tags
3
4
 
4
5
  | I am in the template
@@ -0,0 +1,26 @@
1
+ class ExtensionOne < ::Middleman::Extension
2
+ def initialize(app, options_hash={})
3
+ super
4
+
5
+ after_extension_activated :extension_two do
6
+ app.set :extension_two_was_activated, true
7
+ end
8
+ end
9
+ end
10
+
11
+ ExtensionOne.register
12
+
13
+ class ExtensionTwo < ::Middleman::Extension
14
+ def initialize(app, options_hash={})
15
+ super
16
+
17
+ after_extension_activated :extension_one do
18
+ app.set :extension_one_was_activated, true
19
+ end
20
+ end
21
+ end
22
+
23
+ ExtensionTwo.register
24
+
25
+ activate :extension_one
26
+ activate :extension_two
@@ -0,0 +1,2 @@
1
+ Extension One: <%= extension_one_was_activated.inspect %>
2
+ Extension Two: <%= extension_two_was_activated.inspect %>
@@ -142,6 +142,7 @@ module Middleman
142
142
  # Search the root of the project for required files
143
143
  $LOAD_PATH.unshift(root)
144
144
 
145
+ ::Middleman::Extension.clear_after_extension_callbacks
145
146
  run_hook :initialized
146
147
 
147
148
  if config[:autoload_sprockets]
@@ -178,7 +179,7 @@ module Middleman
178
179
  run_hook :after_configuration
179
180
 
180
181
  logger.debug "Loaded extensions:"
181
- self.extensions.each do |ext,_|
182
+ self.extensions.each do |ext, klass|
182
183
  if ext.is_a?(Hash)
183
184
  ext.each do |k,_|
184
185
  logger.debug "== Extension: #{k}"
@@ -186,6 +187,10 @@ module Middleman
186
187
  else
187
188
  logger.debug "== Extension: #{ext}"
188
189
  end
190
+
191
+ if klass.is_a?(::Middleman::Extension)
192
+ ::Middleman::Extension.activated_extension(klass)
193
+ end
189
194
  end
190
195
  end
191
196
  end
@@ -8,6 +8,7 @@ module Middleman
8
8
 
9
9
  IGNORE_LIST = [
10
10
  /^\.bundle\//,
11
+ /^vendor\//,
11
12
  /^\.sass-cache\//,
12
13
  /^\.git\//,
13
14
  /^\.gitignore$/,
@@ -413,8 +413,7 @@ module Middleman
413
413
  @_out_buf = _buf_was
414
414
  end
415
415
 
416
- # concat_safe_content
417
- concat_content render_individual_file(layout_path, @current_locs || {}, @current_opts || {}, self) { content }
416
+ concat_safe_content render_individual_file(layout_path, @current_locs || {}, @current_opts || {}, self) { content }
418
417
  ensure
419
418
  @current_engine = engine_was
420
419
  end
@@ -130,7 +130,7 @@ module Middleman
130
130
  def server(&block)
131
131
  @@servercounter ||= 0
132
132
  @@servercounter += 1
133
- const_set("MiddlemanApplication#{@@servercounter}", Class.new(Middleman::Application))
133
+ const_set("MiddlemanApplication#{@@servercounter}", Class.new(Middleman::Application, &block))
134
134
  end
135
135
  end
136
136
 
@@ -142,7 +142,7 @@ module Middleman
142
142
  #
143
143
  # @return [Class]
144
144
  def server(&block)
145
- ::Middleman::Application.server
145
+ ::Middleman::Application.server(&block)
146
146
  end
147
147
  end
148
148
 
@@ -1,4 +1,5 @@
1
1
  require "active_support/core_ext/class/attribute"
2
+ require "active_support/core_ext/module/delegation"
2
3
 
3
4
  module Middleman
4
5
 
@@ -131,11 +132,31 @@ module Middleman
131
132
  def activate
132
133
  new(::Middleman::Application)
133
134
  end
135
+
136
+ def clear_after_extension_callbacks
137
+ @_extension_activation_callbacks = {}
138
+ end
139
+
140
+ def after_extension_activated(name, &block)
141
+ @_extension_activation_callbacks ||= {}
142
+ @_extension_activation_callbacks[name] ||= []
143
+ @_extension_activation_callbacks[name] << block if block_given?
144
+ end
145
+
146
+ def activated_extension(instance)
147
+ name = instance.class.extension_name
148
+ return unless @_extension_activation_callbacks && @_extension_activation_callbacks[name]
149
+ @_extension_activation_callbacks[name].each do |block|
150
+ block.arity == 1 ? block.call(instance) : block.call()
151
+ end
152
+ end
134
153
  end
135
154
 
136
155
  attr_accessor :options
137
156
  attr_reader :app
138
157
 
158
+ delegate :after_extension_activated, :to => :"::Middleman::Extension"
159
+
139
160
  def initialize(klass, options_hash={}, &block)
140
161
  @_helpers = []
141
162
  @klass = klass
@@ -1,4 +1,7 @@
1
- require 'padrino-helpers'
1
+ if !defined?(::Padrino::Helpers)
2
+ require 'vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/support_lite'
3
+ require 'vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers'
4
+ end
2
5
 
3
6
  module Middleman
4
7
  module MetaPages
@@ -1,5 +1,5 @@
1
1
  module Middleman
2
2
  # Current Version
3
3
  # @return [String]
4
- VERSION = '3.1.0.rc.2' unless const_defined?(:VERSION)
4
+ VERSION = '3.1.0.rc.3' unless const_defined?(:VERSION)
5
5
  end
@@ -1,11 +1,25 @@
1
+ if !defined?(::Padrino::Helpers)
2
+ require 'vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/support_lite'
3
+ require 'vendored-middleman-deps/padrino-helpers-0.11.2/lib/padrino-helpers'
4
+ end
5
+
6
+ class Padrino::Helpers::OutputHelpers::ErbHandler
7
+ # Force Erb capture not to use safebuffer
8
+ def capture_from_template(*args, &block)
9
+ self.output_buffer, _buf_was = "", self.output_buffer
10
+ captured_block = block.call(*args)
11
+ ret = eval("@_out_buf", block.binding)
12
+ self.output_buffer = _buf_was
13
+ [ ret, captured_block ]
14
+ end
15
+ end
16
+
1
17
  class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
2
18
 
3
19
  def initialize(app, options_hash={}, &block)
4
20
  super
5
21
 
6
22
  require 'active_support/core_ext/object/to_query'
7
- require 'vendored-middleman-deps/padrino-core-0.10.7/lib/padrino-core/support_lite'
8
- require 'vendored-middleman-deps/padrino-helpers-0.10.7/lib/padrino-helpers'
9
23
 
10
24
  app.helpers ::Padrino::Helpers::OutputHelpers
11
25
  app.helpers ::Padrino::Helpers::TagHelpers
@@ -15,7 +29,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
15
29
  app.helpers ::Padrino::Helpers::RenderHelpers
16
30
  app.helpers ::Padrino::Helpers::NumberHelpers
17
31
  # app.helpers ::Padrino::Helpers::TranslationHelpers
18
- # app.helpers ::Padrino::Helpers::Breadcrumbs
32
+ app.helpers ::Padrino::Helpers::Breadcrumbs
19
33
 
20
34
  app.config.define_setting :relative_links, false, 'Whether to generate relative links instead of absolute ones'
21
35
  end
@@ -1,8 +1,19 @@
1
1
  require 'sinatra/base'
2
- require 'padrino-core/support_lite' unless defined?(SupportLite)
2
+ require 'padrino-core/version'
3
+ require 'padrino-core/support_lite'
4
+ require 'padrino-core/application'
5
+
6
+ require 'padrino-core/caller'
7
+ require 'padrino-core/command'
8
+ require 'padrino-core/loader'
9
+ require 'padrino-core/logger'
10
+ require 'padrino-core/mounter'
11
+ require 'padrino-core/reloader'
12
+ require 'padrino-core/router'
13
+ require 'padrino-core/server'
14
+ require 'padrino-core/tasks'
15
+ require 'padrino-core/module'
3
16
 
4
- FileSet.glob_require('padrino-core/application/*.rb', __FILE__)
5
- FileSet.glob_require('padrino-core/*.rb', __FILE__)
6
17
 
7
18
  # The Padrino environment (falls back to the rack env or finally develop)
8
19
  PADRINO_ENV = ENV["PADRINO_ENV"] ||= ENV["RACK_ENV"] ||= "development" unless defined?(PADRINO_ENV)
@@ -80,7 +91,14 @@ module Padrino
80
91
  # end
81
92
  #
82
93
  def configure_apps(&block)
83
- @_global_configuration = block if block_given?
94
+ return unless block_given?
95
+ @@_global_configurations ||= []
96
+ @@_global_configurations << block
97
+ @_global_configuration = lambda do |app|
98
+ @@_global_configurations.each do |configuration|
99
+ app.class_eval(&configuration)
100
+ end
101
+ end
84
102
  end
85
103
 
86
104
  ##
@@ -148,5 +166,41 @@ module Padrino
148
166
  def use(m, *args, &block)
149
167
  middleware << [m, args, block]
150
168
  end
169
+
170
+ ##
171
+ # Registers a gem with padrino. This relieves the caller from setting up
172
+ # loadpaths by himself and enables Padrino to look up apps in gem folder.
173
+ #
174
+ # The name given has to be the proper gem name as given in the gemspec.
175
+ #
176
+ # @param [String] name
177
+ # The name of the gem being registered.
178
+ #
179
+ # @param [Module] main_module
180
+ # The main module of the gem.
181
+ #
182
+ # @returns The root path of the loaded gem
183
+ def gem(name, main_module)
184
+ _,spec = Gem.loaded_specs.find { |spec_name, spec| spec_name == name }
185
+ gems << spec
186
+ modules << main_module
187
+ spec.full_gem_path
188
+ end
189
+
190
+ ##
191
+ # Returns all currently known padrino gems.
192
+ #
193
+ # @returns [Gem::Specification]
194
+ def gems
195
+ @gems ||= []
196
+ end
197
+
198
+ ##
199
+ # All loaded Padrino modules.
200
+ #
201
+ # @returns [<Padrino::Module>]
202
+ def modules
203
+ @modules ||= []
204
+ end
151
205
  end # self
152
206
  end # Padrino
@@ -1,3 +1,8 @@
1
+ require 'padrino-core/application/rendering'
2
+ require 'padrino-core/application/routing'
3
+ require 'padrino-core/application/flash'
4
+ require 'padrino-core/application/showexceptions'
5
+
1
6
  module Padrino
2
7
  class ApplicationSetupError < RuntimeError # @private
3
8
  end
@@ -173,17 +178,21 @@ module Padrino
173
178
  set :method_override, true
174
179
  set :sessions, false
175
180
  set :public_folder, Proc.new { Padrino.root('public', uri_root) }
176
- set :views, Proc.new { File.join(root, "views") }
177
- set :images_path, Proc.new { File.join(public, "images") }
178
- set :protection, false
181
+ set :views, Proc.new { File.join(root, 'views') }
182
+ set :images_path, Proc.new { File.join(public_folder, 'images') }
183
+ set :protection, true
184
+ # Haml specific
185
+ set :haml, { :ugly => (Padrino.env == :production) } if defined?(Haml)
179
186
  # Padrino specific
180
187
  set :uri_root, '/'
181
188
  set :app_name, settings.to_s.underscore.to_sym
182
189
  set :default_builder, 'StandardFormBuilder'
183
- set :flash, defined?(Sinatra::Flash) || defined?(Rack::Flash)
184
190
  set :authentication, false
185
191
  # Padrino locale
186
192
  set :locale_path, Proc.new { Dir[File.join(settings.root, '/locale/**/*.{rb,yml}')] }
193
+ # Authenticity token
194
+ set :protect_from_csrf, false
195
+ set :allow_disabled_csrf, false
187
196
  # Load the Global Configurations
188
197
  class_eval(&Padrino.apps_configuration) if Padrino.apps_configuration
189
198
  end
@@ -241,27 +250,42 @@ module Padrino
241
250
  # Also initializes the application after setting up the middleware
242
251
  def setup_default_middleware(builder)
243
252
  setup_sessions builder
244
- setup_flash builder
245
253
  builder.use Padrino::ShowExceptions if show_exceptions?
246
254
  builder.use Padrino::Logger::Rack, uri_root if Padrino.logger && logging?
247
255
  builder.use Padrino::Reloader::Rack if reload?
248
256
  builder.use Rack::MethodOverride if method_override?
249
257
  builder.use Rack::Head
258
+ register Padrino::Flash
250
259
  setup_protection builder
260
+ setup_csrf_protection builder
251
261
  setup_application!
252
262
  end
253
263
 
254
- # TODO Remove this in a few versions (rack-flash deprecation)
255
- # Move register Sinatra::Flash into setup_default_middleware
256
- # Initializes flash using sinatra-flash or rack-flash
257
- def setup_flash(builder)
258
- register Sinatra::Flash if flash? && defined?(Sinatra::Flash)
259
- if defined?(Rack::Flash) && !defined?(Sinatra::Flash)
260
- logger.warn %Q{
261
- [Deprecation] In Gemfile, 'rack-flash' should be replaced with 'sinatra-flash'!
262
- Rack-Flash is not compatible with later versions of Rack and should be replaced.
263
- }
264
- builder.use Rack::Flash, :sweep => true if flash?
264
+ # sets up csrf protection for the app
265
+ def setup_csrf_protection(builder)
266
+ if protect_from_csrf? && !sessions?
267
+ raise(<<-ERROR)
268
+ `protect_from_csrf` is activated, but `sessions` are not. To enable csrf
269
+ protection, use:
270
+
271
+ enable :sessions
272
+
273
+ or deactivate protect_from_csrf:
274
+
275
+ disable :protect_from_csrf
276
+ ERROR
277
+ end
278
+
279
+ if protect_from_csrf?
280
+ if allow_disabled_csrf?
281
+ builder.use Rack::Protection::AuthenticityToken,
282
+ :reaction => :report,
283
+ :report_key => 'protection.csrf.failed',
284
+ :logger => logger
285
+ else
286
+ builder.use Rack::Protection::AuthenticityToken,
287
+ :logger => logger
288
+ end
265
289
  end
266
290
  end
267
291
  end # self