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
@@ -6,17 +6,18 @@ module Padrino
6
6
  class Base < Thor
7
7
  include Thor::Actions
8
8
 
9
- class_option :chdir, :type => :string, :aliases => "-c", :desc => "Change to dir before starting"
10
- class_option :environment, :type => :string, :aliases => "-e", :required => true, :default => :development, :desc => "Padrino Environment"
9
+ class_option :chdir, :type => :string, :aliases => "-c", :desc => "Change to dir before starting."
10
+ class_option :environment, :type => :string, :aliases => "-e", :required => true, :default => :development, :desc => "Padrino Environment."
11
11
  class_option :help, :type => :boolean, :desc => "Show help usage"
12
12
 
13
- desc "start", "Starts the Padrino application"
14
- method_option :server, :type => :string, :aliases => "-a", :desc => "Rack Handler (default: autodetect)"
15
- method_option :host, :type => :string, :aliases => "-h", :required => true, :default => "0.0.0.0", :desc => "Bind to HOST address"
16
- method_option :port, :type => :numeric, :aliases => "-p", :required => true, :default => 3000, :desc => "Use PORT"
17
- method_option :daemonize, :type => :boolean, :aliases => "-d", :desc => "Run daemonized in the background"
18
- method_option :pid, :type => :string, :aliases => "-i", :desc => "File to store pid"
19
- method_option :debug, :type => :boolean, :desc => "Set debugging flags"
13
+ desc "start", "Starts the Padrino application (alternatively use 's')."
14
+ map "s" => :start
15
+ method_option :server, :type => :string, :aliases => "-a", :desc => "Rack Handler (default: autodetect)"
16
+ method_option :host, :type => :string, :aliases => "-h", :required => true, :default => '127.0.0.1', :desc => "Bind to HOST address."
17
+ method_option :port, :type => :numeric, :aliases => "-p", :required => true, :default => 3000, :desc => "Use PORT."
18
+ method_option :daemonize, :type => :boolean, :aliases => "-d", :desc => "Run daemonized in the background."
19
+ method_option :pid, :type => :string, :aliases => "-i", :desc => "File to store pid."
20
+ method_option :debug, :type => :boolean, :desc => "Set debugging flags."
20
21
  def start
21
22
  prepare :start
22
23
  require File.expand_path("../adapter", __FILE__)
@@ -24,12 +25,8 @@ module Padrino
24
25
  Padrino::Cli::Adapter.start(options)
25
26
  end
26
27
 
27
- desc "s", "Starts the Padrino application"
28
- def s
29
- invoke :start
30
- end
31
-
32
- desc "stop", "Stops the Padrino application"
28
+ desc "stop", "Stops the Padrino application (alternatively use 'st')."
29
+ map "st" => :stop
33
30
  method_option :pid, :type => :string, :aliases => "-p", :desc => "File to store pid", :default => 'tmp/pids/server.pid'
34
31
  def stop
35
32
  prepare :stop
@@ -37,7 +34,7 @@ module Padrino
37
34
  Padrino::Cli::Adapter.stop(options)
38
35
  end
39
36
 
40
- desc "rake", "Execute rake tasks"
37
+ desc "rake", "Execute rake tasks."
41
38
  method_option :environment, :type => :string, :aliases => "-e", :required => true, :default => :development
42
39
  method_option :list, :type => :string, :aliases => "-T", :desc => "Display the tasks (matching optional PATTERN) with descriptions, then exit."
43
40
  method_option :trace, :type => :boolean, :aliases => "-t", :desc => "Turn on invoke/execute tracing, enable full backtrace."
@@ -51,12 +48,15 @@ module Padrino
51
48
  ARGV.concat(args)
52
49
  puts "=> Executing Rake #{ARGV.join(' ')} ..."
53
50
  load File.expand_path('../rake.rb', __FILE__)
54
- require File.expand_path('config/boot.rb')
55
- PadrinoTasks.init(true)
51
+ Rake.application.init
52
+ Rake.application.instance_variable_set(:@rakefile, __FILE__)
53
+ load File.expand_path('Rakefile')
54
+ Rake.application.top_level
56
55
  end
57
56
 
58
- desc "console", "Boots up the Padrino application irb console"
59
- def console
57
+ desc "console", "Boots up the Padrino application irb console (alternatively use 'c')."
58
+ map "c" => :console
59
+ def console(*args)
60
60
  prepare :console
61
61
  require File.expand_path("../../version", __FILE__)
62
62
  ARGV.clear
@@ -68,12 +68,8 @@ module Padrino
68
68
  IRB.start
69
69
  end
70
70
 
71
- desc "c", "Boots up the Padrino application irb console"
72
- def c(*args)
73
- invoke(:console, args)
74
- end
75
-
76
- desc "generate", "Executes the Padrino generator with given options."
71
+ desc "generate", "Executes the Padrino generator with given options (alternatively use 'gen' or 'g')."
72
+ map ["gen", "g"] => :generate
77
73
  def generate(*args)
78
74
  # Build Padrino g as an alias of padrino-gen
79
75
  begin
@@ -90,23 +86,30 @@ module Padrino
90
86
  end
91
87
  end
92
88
 
93
- desc "g", "Executes the Padrino generator with given options."
94
- def g(*args)
95
- invoke(:generate, args)
96
- end
97
-
98
- desc "gen", "Executes the Padrino generator with given options."
99
- def gen(*args)
100
- invoke(:generate, args)
101
- end
102
-
103
- desc "version", "Show current Padrino Version"
104
- map "-v" => :version, "--version" => :version
89
+ desc "version", "Show current Padrino version."
90
+ map ["-v", "--version"] => :version
105
91
  def version
106
92
  require 'padrino-core/version'
107
93
  puts "Padrino v. #{Padrino.version}"
108
94
  end
109
95
 
96
+ desc "runner", "Run a piece of code in the Padrino application environment (alternatively use 'run' or 'r')."
97
+ map ["run", "r"] => :runner
98
+ def runner(*args)
99
+ prepare :runner
100
+
101
+ code_or_file = args.shift
102
+ abort "Please specify code or file" if code_or_file.nil?
103
+
104
+ require File.expand_path('config/boot.rb')
105
+
106
+ if File.exist?(code_or_file)
107
+ eval(File.read(code_or_file), nil, code_or_file)
108
+ else
109
+ eval(code_or_file)
110
+ end
111
+ end
112
+
110
113
  private
111
114
  def prepare(task)
112
115
  if options.help?
@@ -0,0 +1,47 @@
1
+ require File.expand_path('../../tasks', __FILE__)
2
+ require 'rake'
3
+ require 'rake/dsl_definition'
4
+ require 'thor'
5
+ require 'securerandom' unless defined?(SecureRandom)
6
+ require 'padrino-gen'
7
+
8
+ module PadrinoTasks
9
+ def self.init(init=false)
10
+ $LOAD_PATH.unshift(File.expand_path("lib")) # Adds "lib" to the load path
11
+ Padrino::Tasks.files.flatten.uniq.each { |rakefile| Rake.application.add_import(rakefile) rescue puts "<= Failed load #{ext}" }
12
+ load(File.expand_path('../rake_tasks.rb', __FILE__)) # Load default rake tasks
13
+ Rake.application.load_imports
14
+ end
15
+
16
+ def self.use(task)
17
+ tasks << task
18
+ end
19
+
20
+ def self.tasks
21
+ @tasks ||= []
22
+ end
23
+
24
+ def self.load?(task, constant_present)
25
+ if constant_present && !PadrinoTasks.tasks.include?(task)
26
+ warn <<-WARNING.undent
27
+ Loading #{task} tasks automatically.
28
+ This functionality will be disabled in future versions. Please put
29
+
30
+ PadrinoTasks.use(#{task.inspect})
31
+ PadrinoTasks.init
32
+
33
+ and remove
34
+
35
+ require File.expand_path('../config/boot.rb', __FILE__)
36
+
37
+ in you Rakefile instead.
38
+ WARNING
39
+ end
40
+
41
+ constant_present || PadrinoTasks.tasks.include?(task)
42
+ end
43
+ end
44
+
45
+ def shell
46
+ @_shell ||= Thor::Base.shell.new
47
+ end
@@ -1,11 +1,17 @@
1
1
  # Load rake tasks from common rake task definition locations
2
- Dir["lib/tasks/**/*.rake"].
3
- concat(Dir["tasks/**/*.rake"]).
4
- concat(Dir["{test,spec}/*.rake"]).each { |rake| load(rake) }
2
+ Dir["{lib/tasks/**,tasks/**,test,spec}/*.rake"].each do |file|
3
+ begin
4
+ load(file)
5
+ rescue LoadError => e
6
+ warn "#{file}: #{e.message}"
7
+ end
8
+ end
5
9
 
6
10
  # Loads the Padrino applications mounted within the project
7
11
  # setting up the required environment for Padrino
8
12
  task :environment do
13
+ require File.expand_path('config/boot.rb', Rake.application.original_dir)
14
+
9
15
  Padrino.mounted_apps.each do |app|
10
16
  app.app_obj.setup_application!
11
17
  end
@@ -46,14 +52,3 @@ namespace :routes do
46
52
  list_app_routes(app, args) if app
47
53
  end
48
54
  end
49
-
50
- desc "Generate the Rakefile"
51
- task :gen do
52
- File.open(Padrino.root("Rakefile"), "w") do |file|
53
- file.puts <<-RUBY.gsub(/^ {6}/, '')
54
- require File.expand_path('../config/boot.rb', __FILE__)
55
- require 'padrino-core/cli/rake'
56
- PadrinoTasks.init
57
- RUBY
58
- end
59
- end
@@ -60,6 +60,8 @@ module Padrino
60
60
  #
61
61
  def load!
62
62
  return false if loaded?
63
+ t = Time.now
64
+
63
65
  @_called_from = first_caller
64
66
  Padrino.set_encoding
65
67
  Padrino.set_load_paths(*load_paths) # We set the padrino load paths
@@ -71,6 +73,8 @@ module Padrino
71
73
  Padrino.after_load.each(&:call) # Run after hooks
72
74
  Padrino::Reloader.run!
73
75
  Thread.current[:padrino_loaded] = true
76
+
77
+ Padrino.logger.devel "Loaded Padrino in #{Time.now - t} seconds"
74
78
  end
75
79
 
76
80
  ##
@@ -162,10 +166,8 @@ module Padrino
162
166
  begin
163
167
  Padrino::Reloader.safe_load(file, options.dup)
164
168
  files.delete(file)
165
- rescue LoadError => e
166
- errors << e
167
- failed << file
168
- rescue NameError => e
169
+ rescue NameError, LoadError => e
170
+ Padrino.logger.devel "Problem while loading #{file}: #{e.to_s}"
169
171
  errors << e
170
172
  failed << file
171
173
  rescue Exception => e
@@ -190,11 +192,7 @@ module Padrino
190
192
  # Padrino.dependency_paths << "#{Padrino.root}/uploaders/*.rb"
191
193
  #
192
194
  def dependency_paths
193
- @_dependency_paths_was = [
194
- "#{root}/config/database.rb", "#{root}/lib/**/*.rb", "#{root}/shared/lib/**/*.rb",
195
- "#{root}/models/**/*.rb", "#{root}/shared/models/**/*.rb", "#{root}/config/apps.rb"
196
- ]
197
- @_dependency_paths ||= @_dependency_paths_was
195
+ @_dependency_paths ||= (dependency_paths_was + Array(module_paths))
198
196
  end
199
197
 
200
198
  ##
@@ -207,5 +205,21 @@ module Padrino
207
205
  $:.concat(paths); load_paths.concat(paths)
208
206
  $:.uniq!; load_paths.uniq!
209
207
  end
208
+
209
+ private
210
+ def module_paths
211
+ Padrino.modules.map(&:dependency_paths).flatten!
212
+ end
213
+
214
+ def dependency_paths_was
215
+ [
216
+ "#{root}/config/database.rb",
217
+ "#{root}/lib/**/*.rb",
218
+ "#{root}/shared/lib/**/*.rb",
219
+ "#{root}/models/**/*.rb",
220
+ "#{root}/shared/models/**/*.rb",
221
+ "#{root}/config/apps.rb"
222
+ ]
223
+ end
210
224
  end # self
211
225
  end # Padrino
@@ -5,8 +5,8 @@ de:
5
5
  # Wenn keine Formate angegeben werden, wird "default" benutzt.
6
6
  # Du kannst auch weitere Formate hinzufügen, wenn Du möchtest.
7
7
  default: "&d.&m.%Y"
8
- short: "%b %d"
9
- long: "%B %d, %Y"
8
+ short: "%d. %b"
9
+ long: "%d. %B %Y"
10
10
  only_day: "%e"
11
11
 
12
12
  day_names: [Sonntag, Montag, Dienstag, Mittwoch, Donnerstag, Freitag, Samstag]
@@ -20,9 +20,9 @@ de:
20
20
 
21
21
  time:
22
22
  formats:
23
- default: "%a, %d %b %Y %H:%M:%S %z"
24
- short: "%d %b %H:%M"
25
- long: "%B %d, %Y %H:%M"
23
+ default: "%a, %d. %b %Y %H:%M:%S %z"
24
+ short: "%d. %b %H:%M"
25
+ long: "%d. %B %Y %H:%M"
26
26
  am: "am"
27
27
  pm: "pm"
28
28
 
@@ -31,4 +31,4 @@ de:
31
31
  array:
32
32
  words_connector: ", "
33
33
  two_words_connector: " und "
34
- last_word_connector: ", und "
34
+ last_word_connector: " und "
@@ -12,7 +12,7 @@ fr:
12
12
  day_names: [Dimanche, Lundi, Mardi, Mercredi, Jeudi, Vendredi, Samedi]
13
13
  abbr_day_names: [Lun, Mar, Mer, Jeu, Ven, Sam, Dim]
14
14
  month_names: [~, Janvier, Février, Mars, Avril, Mai, Juin, Juillet, Août, Septembre, Octobre, Novembre, Décembre]
15
- abbr_month_names: [~, Jan, Fev, Mar, Avr, Mai, Jui, Jui, Aou, Sep, Oct, Nov, Dec]
15
+ abbr_month_names: [~, Jan, Fev, Mar, Avr, Mai, Jun, Jul, Aou, Sep, Oct, Nov, Dec]
16
16
  order:
17
17
  - day
18
18
  - month
@@ -12,7 +12,7 @@ ru:
12
12
  day_names: [Воскресенье, Понедельник, Вторник, Среда, Четверг, Пятница, Суббота]
13
13
  abbr_day_names: [Вс, Пн, Вт, Ср, Чт, Пт, Сб]
14
14
  month_names: [~, Январь, Февраль, Март, Апрель, Май, Июнь, Июль, Август, Сентябрь, Октябрь, Ноябрь, Декабрь]
15
- abbr_month_names: [~, Янв, Феб, Мар, Апр, Май, Июн, Июл, Авг, Сен, Окт, Ноя, Дек]
15
+ abbr_month_names: [~, Янв, Фев, Мар, Апр, Май, Июн, Июл, Авг, Сен, Окт, Ноя, Дек]
16
16
  order:
17
17
  - year
18
18
  - month
@@ -4,15 +4,15 @@ zh_cn:
4
4
  # Use the strftime parameters for formats.
5
5
  # When no format has been given, it uses default.
6
6
  # You can provide other formats here if you like!
7
- default: "%Y-%m-%d"
8
- short: "%b%d日"
9
- long: "%Y年%b%d日"
7
+ default: "%Y 年 %m 月 %d"
8
+ short: "%b%d 日"
9
+ long: "公元 %Y%B 月 %d 日"
10
10
  only_day: "%e"
11
11
 
12
12
  day_names: [星期日, 星期一, 星期二, 星期三, 星期四, 星期五, 星期六]
13
13
  abbr_day_names: [日, 一, 二, 三, 四, 五, 六]
14
- month_names: [~, 一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, 九月, 十月, 十一月, 十二月]
15
- abbr_month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12]
14
+ month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月]
15
+ abbr_month_names: [~, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
16
16
  order:
17
17
  - year
18
18
  - month
@@ -20,15 +20,15 @@ zh_cn:
20
20
 
21
21
  time:
22
22
  formats:
23
- default: "%Y年%b%d日 %A %H:%M:%S %Z"
24
- short: "%b%d日 %H:%M"
25
- long: "%Y年%b%d日 %H:%M"
23
+ default: "%Y 年 %b%d 日 %H:%M:%S %z"
24
+ short: "%d 月 %b 日 %H:%M"
25
+ long: "%Y%B 月 %d 日 %H 时 %M"
26
26
  am: "上午"
27
27
  pm: "下午"
28
28
 
29
29
  # Used in array.to_sentence.
30
30
  support:
31
31
  array:
32
- words_connector: ", "
33
- two_words_connector: " "
34
- last_word_connector: ", 和 "
32
+ words_connector: ""
33
+ two_words_connector: "和"
34
+ last_word_connector: ",还有"
@@ -13,8 +13,7 @@ module Padrino
13
13
  # logger.warn "bar"
14
14
  #
15
15
  def self.logger
16
- Padrino::Logger.setup! if Thread.current[:padrino_logger].nil?
17
- Thread.current[:padrino_logger]
16
+ Padrino::Logger.logger
18
17
  end
19
18
 
20
19
  ##
@@ -35,8 +34,7 @@ module Padrino
35
34
  # Padrino.logger = Buffered.new(STDOUT)
36
35
  #
37
36
  def self.logger=(value)
38
- value.extend(Padrino::Logger::Extensions) unless (Padrino::Logger::Extensions === value)
39
- Thread.current[:padrino_logger] = value
37
+ Padrino::Logger.logger = value
40
38
  end
41
39
 
42
40
  ##
@@ -95,7 +93,7 @@ module Padrino
95
93
  #
96
94
  # @example
97
95
  # logger.bench 'GET', started_at, '/blog/categories'
98
- # # => DEBUG - GET (0.056ms) - /blog/categories
96
+ # # => DEBUG - GET (0.0056s) - /blog/categories
99
97
  #
100
98
  def bench(action, began_at, message, level=:debug, color=:yellow)
101
99
  @_pad ||= 8
@@ -103,7 +101,7 @@ module Padrino
103
101
  duration = Time.now - began_at
104
102
  color = :red if duration > 1
105
103
  action = colorize(action.to_s.upcase.rjust(@_pad), color)
106
- duration = colorize('%0.4fms' % duration, :bold, color)
104
+ duration = colorize('%0.4fs' % duration, :bold, color)
107
105
  push "#{action} (#{duration}) #{message}", level
108
106
  end
109
107
 
@@ -208,7 +206,6 @@ module Padrino
208
206
  end
209
207
 
210
208
  include Extensions
211
- include Colorize
212
209
 
213
210
  attr_accessor :level
214
211
  attr_accessor :auto_flush
@@ -216,8 +213,7 @@ module Padrino
216
213
  attr_reader :log
217
214
  attr_reader :init_args
218
215
  attr_accessor :log_static
219
-
220
- @@mutex = {}
216
+ attr_reader :colorize_logging
221
217
 
222
218
  ##
223
219
  # Configuration for a given environment, possible options are:
@@ -233,6 +229,7 @@ module Padrino
233
229
  # :format_datetime:: Format of datetime. Defaults to: "%d/%b/%Y %H:%M:%S"
234
230
  # :format_message:: Format of message. Defaults to: ""%s - - [%s] \"%s\"""
235
231
  # :log_static:: Whether or not to show log messages for static files. Defaults to: false
232
+ # :colorize_logging:: Whether or not to colorize log messages. Defaults to: true
236
233
  #
237
234
  # @example
238
235
  # Padrino::Logger::Config[:development] = { :log_level => :debug, :stream => :to_file }
@@ -254,11 +251,22 @@ module Padrino
254
251
  #
255
252
  Config = {
256
253
  :production => { :log_level => :warn, :stream => :to_file },
257
- :development => { :log_level => :debug, :stream => :stdout, :format_datetime => ' ' },
254
+ :development => { :log_level => :debug, :stream => :stdout, :format_datetime => '' },
258
255
  :test => { :log_level => :debug, :stream => :null }
259
256
  }
260
257
  Config.merge!(PADRINO_LOGGER) if PADRINO_LOGGER
261
258
 
259
+ @@mutex = Mutex.new
260
+ def self.logger
261
+ @_logger || setup!
262
+ end
263
+
264
+ def self.logger=(logger)
265
+ logger.extend(Padrino::Logger::Extensions)
266
+
267
+ @_logger = logger
268
+ end
269
+
262
270
  ##
263
271
  # Setup a new logger
264
272
  #
@@ -266,25 +274,27 @@ module Padrino
266
274
  # A {Padrino::Logger} instance
267
275
  #
268
276
  def self.setup!
269
- config_level = (PADRINO_LOG_LEVEL || Padrino.env || :test).to_sym # need this for PADRINO_LOG_LEVEL
270
- config = Config[config_level]
277
+ self.logger = begin
278
+ config_level = (PADRINO_LOG_LEVEL || Padrino.env || :test).to_sym # need this for PADRINO_LOG_LEVEL
279
+ config = Config[config_level]
271
280
 
272
- unless config
273
- warn("No logging configuration for :#{config_level} found, falling back to :production")
274
- config = Config[:production]
275
- end
281
+ unless config
282
+ warn("No logging configuration for :#{config_level} found, falling back to :production")
283
+ config = Config[:production]
284
+ end
276
285
 
277
- stream = case config[:stream]
278
- when :to_file
279
- FileUtils.mkdir_p(Padrino.root('log')) unless File.exists?(Padrino.root('log'))
280
- File.new(Padrino.root('log', "#{Padrino.env}.log"), 'a+')
281
- when :null then StringIO.new
282
- when :stdout then $stdout
283
- when :stderr then $stderr
284
- else config[:stream] # return itself, probabilly is a custom stream.
285
- end
286
+ stream = case config[:stream]
287
+ when :to_file
288
+ FileUtils.mkdir_p(Padrino.root('log')) unless File.exists?(Padrino.root('log'))
289
+ File.new(Padrino.root('log', "#{Padrino.env}.log"), 'a+')
290
+ when :null then StringIO.new
291
+ when :stdout then $stdout
292
+ when :stderr then $stderr
293
+ else config[:stream] # return itself, probabilly is a custom stream.
294
+ end
286
295
 
287
- Thread.current[:padrino_logger] = Padrino::Logger.new(config.merge(:stream => stream))
296
+ Padrino::Logger.new(config.merge(:stream => stream))
297
+ end
288
298
  end
289
299
 
290
300
  ##
@@ -311,16 +321,20 @@ module Padrino
311
321
  # @option options [Symbol] :log_static (false)
312
322
  # Whether or not to show log messages for static files.
313
323
  #
324
+ # @option options [Symbol] :colorize_logging (true)
325
+ # Whether or not to colorize log messages. Defaults to: true
326
+ #
314
327
  def initialize(options={})
315
328
  @buffer = []
316
329
  @auto_flush = options.has_key?(:auto_flush) ? options[:auto_flush] : true
317
330
  @level = options[:log_level] ? Padrino::Logger::Levels[options[:log_level]] : Padrino::Logger::Levels[:debug]
318
331
  @log = options[:stream] || $stdout
319
332
  @log.sync = true
320
- @mutex = @@mutex[@log] ||= Mutex.new
321
333
  @format_datetime = options[:format_datetime] || "%d/%b/%Y %H:%M:%S"
322
- @format_message = options[:format_message] || "%s -%s%s"
334
+ @format_message = options[:format_message] || "%s - %s %s"
323
335
  @log_static = options.has_key?(:log_static) ? options[:log_static] : false
336
+ @colorize_logging = options.has_key?(:colorize_logging) ? options[:colorize_logging] : true
337
+ colorize! if @colorize_logging
324
338
  end
325
339
 
326
340
  ##
@@ -328,8 +342,9 @@ module Padrino
328
342
  #
329
343
  def flush
330
344
  return unless @buffer.size > 0
331
- @mutex.synchronize do
332
- @log.write(@buffer.slice!(0..-1).join(''))
345
+ @@mutex.synchronize do
346
+ @log.write(@buffer.join(''))
347
+ @buffer.clear
333
348
  end
334
349
  end
335
350
 
@@ -360,7 +375,9 @@ module Padrino
360
375
  #
361
376
  def <<(message = nil)
362
377
  message << "\n" unless message[-1] == ?\n
363
- @buffer << message
378
+ @@mutex.synchronize {
379
+ @buffer << message
380
+ }
364
381
  flush if @auto_flush
365
382
  message
366
383
  end
@@ -425,4 +442,3 @@ module Kernel # @private
425
442
  Padrino.logger
426
443
  end
427
444
  end # Kernel
428
-