middleman-core 3.2.2 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (273) hide show
  1. checksums.yaml +4 -4
  2. data/features/cli_init.feature +18 -8
  3. data/features/helpers_select_tag.feature +1 -1
  4. data/features/layouts_dir.feature +8 -0
  5. data/features/markdown_redcarpet.feature +2 -2
  6. data/fixtures/asciidoc-app/source/layouts/default.erb +0 -1
  7. data/fixtures/capture-html-app/source/capture_html_haml.html.haml +1 -1
  8. data/fixtures/content-for-app/source/content_for_haml.html.haml +1 -1
  9. data/fixtures/frontmatter-settings-app/source/layouts/override.erb +1 -2
  10. data/fixtures/frontmatter-settings-neighbor-app/source/layouts/override.erb +1 -2
  11. data/fixtures/layouts-dir-app/source/ambiguous.html.erb +5 -0
  12. data/fixtures/layouts-dir-app/source/layouts/other.erb +3 -0
  13. data/fixtures/layouts-dir-app/source/other.erb +3 -0
  14. data/fixtures/link-to-app/source/link_to_haml.html.haml +1 -1
  15. data/fixtures/link-to-app/source/link_to_slim.html.slim +1 -1
  16. data/fixtures/nested-layout-app/source/layouts/inner_haml.haml +1 -1
  17. data/fixtures/nested-layout-app/source/layouts/inner_slim.slim +1 -1
  18. data/fixtures/nested-layout-app/source/layouts/outer_haml.haml +1 -1
  19. data/fixtures/nested-layout-app/source/layouts/outer_slim.slim +1 -1
  20. data/lib/middleman-core/application.rb +12 -3
  21. data/lib/middleman-core/cli/build.rb +5 -3
  22. data/lib/middleman-core/cli/console.rb +1 -1
  23. data/lib/middleman-core/cli/init.rb +1 -1
  24. data/lib/middleman-core/core_extensions.rb +0 -1
  25. data/lib/middleman-core/core_extensions/file_watcher.rb +11 -11
  26. data/lib/middleman-core/core_extensions/rendering.rb +40 -66
  27. data/lib/middleman-core/extension.rb +167 -0
  28. data/lib/middleman-core/extensions.rb +2 -151
  29. data/lib/middleman-core/logger.rb +2 -2
  30. data/lib/middleman-core/meta_pages/assets/config.css +13 -0
  31. data/lib/middleman-core/meta_pages/assets/meta.css +19 -3
  32. data/lib/middleman-core/meta_pages/assets/sitemap.css +18 -1
  33. data/lib/middleman-core/meta_pages/config_setting.rb +7 -9
  34. data/lib/middleman-core/meta_pages/sitemap_resource.rb +24 -15
  35. data/lib/middleman-core/meta_pages/sitemap_tree.rb +5 -1
  36. data/lib/middleman-core/meta_pages/templates/config.html.erb +2 -2
  37. data/lib/middleman-core/meta_pages/templates/index.html.erb +18 -8
  38. data/lib/middleman-core/meta_pages/templates/sitemap.html.erb +4 -5
  39. data/lib/middleman-core/preview_server.rb +6 -3
  40. data/lib/middleman-core/renderers/erb.rb +12 -14
  41. data/lib/middleman-core/renderers/haml.rb +10 -0
  42. data/lib/middleman-core/renderers/markdown.rb +5 -1
  43. data/lib/middleman-core/renderers/sass.rb +0 -4
  44. data/lib/middleman-core/renderers/slim.rb +16 -3
  45. data/lib/middleman-core/sitemap/resource.rb +1 -1
  46. data/lib/middleman-core/step_definitions.rb +2 -1
  47. data/lib/middleman-core/templates.rb +3 -1
  48. data/lib/middleman-core/templates/shared/Gemfile.tt +4 -1
  49. data/lib/middleman-core/templates/shared/config.tt +3 -1
  50. data/lib/middleman-core/templates/shared/gitignore +2 -1
  51. data/lib/middleman-core/util.rb +22 -16
  52. data/lib/middleman-core/version.rb +1 -1
  53. data/lib/middleman-more/core_extensions/compass.rb +3 -3
  54. data/lib/middleman-more/core_extensions/default_helpers.rb +18 -15
  55. data/lib/middleman-more/extensions/asset_hash.rb +1 -0
  56. data/middleman-core.gemspec +9 -6
  57. metadata +69 -227
  58. data/features/sass_cache_path.feature +0 -22
  59. data/fixtures/sass-cache-path-custom-app/config.rb +0 -3
  60. data/fixtures/sass-cache-path-custom-app/source/stylesheets/plain.css.sass +0 -4
  61. data/fixtures/sass-cache-path-default-app/config.rb +0 -3
  62. data/fixtures/sass-cache-path-default-app/source/stylesheets/plain.css.sass +0 -4
  63. data/lib/vendored-middleman-deps/hooks-0.2.0/CHANGES.textile +0 -9
  64. data/lib/vendored-middleman-deps/hooks-0.2.0/Gemfile +0 -3
  65. data/lib/vendored-middleman-deps/hooks-0.2.0/README.rdoc +0 -107
  66. data/lib/vendored-middleman-deps/hooks-0.2.0/Rakefile +0 -12
  67. data/lib/vendored-middleman-deps/hooks-0.2.0/hooks.gemspec +0 -22
  68. data/lib/vendored-middleman-deps/hooks-0.2.0/lib/hooks.rb +0 -109
  69. data/lib/vendored-middleman-deps/hooks-0.2.0/lib/hooks/inheritable_attribute.rb +0 -33
  70. data/lib/vendored-middleman-deps/hooks-0.2.0/test/hooks_test.rb +0 -141
  71. data/lib/vendored-middleman-deps/hooks-0.2.0/test/inheritable_attribute_test.rb +0 -55
  72. data/lib/vendored-middleman-deps/hooks-0.2.0/test/test_helper.rb +0 -10
  73. data/lib/vendored-middleman-deps/padrino-core-0.11.4/.document +0 -5
  74. data/lib/vendored-middleman-deps/padrino-core-0.11.4/.gitignore +0 -22
  75. data/lib/vendored-middleman-deps/padrino-core-0.11.4/.yardopts +0 -1
  76. data/lib/vendored-middleman-deps/padrino-core-0.11.4/LICENSE.txt +0 -20
  77. data/lib/vendored-middleman-deps/padrino-core-0.11.4/README.rdoc +0 -294
  78. data/lib/vendored-middleman-deps/padrino-core-0.11.4/Rakefile +0 -5
  79. data/lib/vendored-middleman-deps/padrino-core-0.11.4/bin/padrino +0 -9
  80. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core.rb +0 -200
  81. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application.rb +0 -297
  82. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/flash.rb +0 -229
  83. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/rendering.rb +0 -317
  84. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/rendering/extensions/erubis.rb +0 -64
  85. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/rendering/extensions/haml.rb +0 -28
  86. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/rendering/extensions/slim.rb +0 -14
  87. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/routing.rb +0 -1077
  88. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/application/showexceptions.rb +0 -21
  89. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/caller.rb +0 -53
  90. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/cli/adapter.rb +0 -24
  91. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/cli/base.rb +0 -159
  92. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/cli/console.rb +0 -20
  93. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/cli/rake.rb +0 -47
  94. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/cli/rake_tasks.rb +0 -52
  95. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/command.rb +0 -38
  96. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/images/404.png +0 -0
  97. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/images/500.png +0 -0
  98. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/loader.rb +0 -224
  99. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/cs.yml +0 -33
  100. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/da.yml +0 -33
  101. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/de.yml +0 -33
  102. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/en.yml +0 -33
  103. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/es.yml +0 -33
  104. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/fr.yml +0 -33
  105. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/hu.yml +0 -33
  106. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/it.yml +0 -39
  107. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/ja.yml +0 -33
  108. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/lv.yml +0 -33
  109. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/nl.yml +0 -33
  110. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/no.yml +0 -33
  111. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/pl.yml +0 -33
  112. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/pt_br.yml +0 -39
  113. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/ro.yml +0 -33
  114. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/ru.yml +0 -34
  115. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/sv.yml +0 -33
  116. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/tr.yml +0 -33
  117. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/uk.yml +0 -33
  118. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/zh_cn.yml +0 -33
  119. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/locale/zh_tw.yml +0 -33
  120. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/logger.rb +0 -438
  121. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/module.rb +0 -58
  122. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/mounter.rb +0 -234
  123. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/reloader.rb +0 -341
  124. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/router.rb +0 -95
  125. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/server.rb +0 -77
  126. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/support_lite.rb +0 -260
  127. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/tasks.rb +0 -21
  128. data/lib/vendored-middleman-deps/padrino-core-0.11.4/lib/padrino-core/version.rb +0 -20
  129. data/lib/vendored-middleman-deps/padrino-core-0.11.4/padrino-core.gemspec +0 -43
  130. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/app_gem/Gemfile +0 -4
  131. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/app_gem/app/app.rb +0 -3
  132. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/app_gem/app_gem.gemspec +0 -17
  133. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/app_gem/lib/app_gem.rb +0 -7
  134. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/app_gem/lib/app_gem/version.rb +0 -3
  135. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/apps/.components +0 -6
  136. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/apps/.gitignore +0 -7
  137. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/apps/complex.rb +0 -32
  138. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/apps/simple.rb +0 -33
  139. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/dependencies/a.rb +0 -9
  140. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/dependencies/b.rb +0 -4
  141. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/dependencies/c.rb +0 -1
  142. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/dependencies/circular/e.rb +0 -13
  143. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/dependencies/circular/f.rb +0 -2
  144. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/dependencies/circular/g.rb +0 -2
  145. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/fixtures/dependencies/d.rb +0 -4
  146. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/helper.rb +0 -83
  147. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/mini_shoulda.rb +0 -45
  148. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_application.rb +0 -125
  149. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_core.rb +0 -77
  150. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_csrf_protection.rb +0 -80
  151. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_dependencies.rb +0 -44
  152. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_filters.rb +0 -348
  153. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_flash.rb +0 -168
  154. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_locale.rb +0 -21
  155. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_logger.rb +0 -210
  156. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_mounter.rb +0 -199
  157. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_reloader_complex.rb +0 -75
  158. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_reloader_simple.rb +0 -98
  159. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_rendering.rb +0 -545
  160. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_rendering_extensions.rb +0 -14
  161. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_restful_routing.rb +0 -33
  162. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_router.rb +0 -146
  163. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_routing.rb +0 -1927
  164. data/lib/vendored-middleman-deps/padrino-core-0.11.4/test/test_support_lite.rb +0 -56
  165. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/.document +0 -5
  166. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/.gitignore +0 -21
  167. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/.yardopts +0 -1
  168. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/LICENSE.txt +0 -20
  169. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/README.rdoc +0 -239
  170. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/Rakefile +0 -5
  171. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers.rb +0 -57
  172. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/asset_tag_helpers.rb +0 -401
  173. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/breadcrumb_helpers.rb +0 -183
  174. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/form_builder/abstract_form_builder.rb +0 -317
  175. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/form_builder/standard_form_builder.rb +0 -40
  176. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/form_helpers.rb +0 -919
  177. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/format_helpers.rb +0 -372
  178. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/cs.yml +0 -103
  179. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/da.yml +0 -91
  180. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/de.yml +0 -81
  181. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/en.yml +0 -103
  182. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/es.yml +0 -103
  183. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/fr.yml +0 -79
  184. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/hu.yml +0 -103
  185. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/it.yml +0 -89
  186. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/ja.yml +0 -103
  187. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/lv.yml +0 -103
  188. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/nl.yml +0 -82
  189. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/no.yml +0 -91
  190. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/pl.yml +0 -95
  191. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/pt_br.yml +0 -103
  192. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/ro.yml +0 -103
  193. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/ru.yml +0 -103
  194. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/sv.yml +0 -103
  195. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/tr.yml +0 -103
  196. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/uk.yml +0 -103
  197. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/zh_cn.yml +0 -103
  198. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/locale/zh_tw.yml +0 -103
  199. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/number_helpers.rb +0 -283
  200. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/output_helpers.rb +0 -207
  201. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/output_helpers/abstract_handler.rb +0 -96
  202. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/output_helpers/erb_handler.rb +0 -78
  203. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/output_helpers/haml_handler.rb +0 -63
  204. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/output_helpers/slim_handler.rb +0 -78
  205. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/render_helpers.rb +0 -59
  206. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/tag_helpers.rb +0 -292
  207. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/lib/padrino-helpers/translation_helpers.rb +0 -36
  208. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/padrino-helpers.gemspec +0 -27
  209. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/app.rb +0 -84
  210. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/button_to.erb +0 -8
  211. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/button_to.haml +0 -5
  212. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/button_to.slim +0 -6
  213. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/capture_concat.erb +0 -14
  214. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/capture_concat.haml +0 -12
  215. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/capture_concat.slim +0 -12
  216. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/content_for.erb +0 -14
  217. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/content_for.haml +0 -12
  218. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/content_for.slim +0 -12
  219. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/content_tag.erb +0 -11
  220. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/content_tag.haml +0 -9
  221. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/content_tag.slim +0 -9
  222. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/current_engine.erb +0 -5
  223. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/current_engine.haml +0 -5
  224. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/current_engine.slim +0 -5
  225. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/fields_for.erb +0 -20
  226. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/fields_for.haml +0 -15
  227. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/fields_for.slim +0 -15
  228. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/form_for.erb +0 -72
  229. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/form_for.haml +0 -59
  230. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/form_for.slim +0 -59
  231. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/form_tag.erb +0 -95
  232. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/form_tag.haml +0 -78
  233. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/form_tag.slim +0 -79
  234. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/link_to.erb +0 -5
  235. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/link_to.haml +0 -4
  236. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/link_to.slim +0 -4
  237. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/mail_to.erb +0 -3
  238. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/mail_to.haml +0 -3
  239. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/mail_to.slim +0 -3
  240. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/meta_tag.erb +0 -3
  241. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/meta_tag.haml +0 -3
  242. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/meta_tag.slim +0 -3
  243. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/partials/_erb.erb +0 -1
  244. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/partials/_haml.haml +0 -1
  245. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/partials/_slim.slim +0 -1
  246. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/simple_partial.erb +0 -1
  247. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/simple_partial.haml +0 -1
  248. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/markup_app/views/simple_partial.slim +0 -1
  249. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/app.rb +0 -58
  250. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/current_engine.haml +0 -5
  251. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/current_engines/_erb.erb +0 -1
  252. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/current_engines/_haml.haml +0 -1
  253. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/current_engines/_slim.slim +0 -1
  254. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/double_capture_erb.erb +0 -3
  255. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/double_capture_haml.haml +0 -2
  256. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/double_capture_slim.slim +0 -2
  257. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/erb/test.erb +0 -1
  258. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/explicit_engine.haml +0 -5
  259. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/haml/test.haml +0 -1
  260. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/template/_user.haml +0 -7
  261. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/template/haml_template.haml +0 -1
  262. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/fixtures/render_app/views/template/some_template.haml +0 -2
  263. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/helper.rb +0 -67
  264. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_asset_tag_helpers.rb +0 -359
  265. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_breadcrumb_helpers.rb +0 -134
  266. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_form_builder.rb +0 -1178
  267. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_form_helpers.rb +0 -1030
  268. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_format_helpers.rb +0 -241
  269. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_locale.rb +0 -20
  270. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_number_helpers.rb +0 -143
  271. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_output_helpers.rb +0 -154
  272. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_render_helpers.rb +0 -94
  273. data/lib/vendored-middleman-deps/padrino-helpers-0.11.4/test/test_tag_helpers.rb +0 -117
@@ -1,55 +0,0 @@
1
- require 'test_helper'
2
-
3
- class HooksTest < Test::Unit::TestCase
4
- context "Hooks.define_hook" do
5
- setup do
6
- @klass = Class.new(Object) do
7
- extend Hooks::InheritableAttribute
8
- end
9
-
10
- @mum = @klass.new
11
- @klass.inheritable_attr :drinks
12
- end
13
-
14
- should "provide a reader with empty inherited attributes, already" do
15
- assert_equal nil, @klass.drinks
16
- end
17
-
18
- should "provide a reader with empty inherited attributes in a derived class" do
19
- assert_equal nil, Class.new(@klass).drinks
20
- #@klass.drinks = true
21
- #Class.new(@klass).drinks # TODO: crashes.
22
- end
23
-
24
- should "provide an attribute copy in subclasses" do
25
- @klass.drinks = []
26
- assert @klass.drinks.object_id != Class.new(@klass).drinks.object_id
27
- end
28
-
29
- should "provide a writer" do
30
- @klass.drinks = [:cabernet]
31
- assert_equal [:cabernet], @klass.drinks
32
- end
33
-
34
- should "inherit attributes" do
35
- @klass.drinks = [:cabernet]
36
-
37
- subklass_a = Class.new(@klass)
38
- subklass_a.drinks << :becks
39
-
40
- subklass_b = Class.new(@klass)
41
-
42
- assert_equal [:cabernet], @klass.drinks
43
- assert_equal [:cabernet, :becks], subklass_a.drinks
44
- assert_equal [:cabernet], subklass_b.drinks
45
- end
46
-
47
- should "not inherit attributes if we set explicitely" do
48
- @klass.drinks = [:cabernet]
49
- subklass = Class.new(@klass)
50
-
51
- subklass.drinks = [:merlot] # we only want merlot explicitely.
52
- assert_equal [:merlot], subklass.drinks # no :cabernet, here
53
- end
54
- end
55
- end
@@ -1,10 +0,0 @@
1
- require 'rubygems'
2
-
3
- # wycats says...
4
- require 'bundler'
5
- Bundler.setup
6
- require 'test/unit'
7
- require 'shoulda'
8
- require 'hooks'
9
-
10
- $:.unshift File.dirname(__FILE__) # add current dir to LOAD_PATHS
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- README.rdoc
5
- LICENSE.txt
@@ -1,22 +0,0 @@
1
- ## MAC OS
2
- .DS_Store
3
-
4
- ## TEXTMATE
5
- *.tmproj
6
- tmtags
7
-
8
- ## EMACS
9
- *~
10
- \#*
11
- .\#*
12
-
13
- ## VIM
14
- *.swp
15
-
16
- ## PROJECT::GENERAL
17
- coverage
18
- rdoc
19
- pkg
20
-
21
- ## PROJECT::SPECIFIC
22
- test/tmp/*
@@ -1 +0,0 @@
1
- --title 'Padrino Core Documentation' --protected
@@ -1,20 +0,0 @@
1
- Copyright (c) 2011 Padrino
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,294 +0,0 @@
1
- = Padrino (padrino-core)
2
-
3
- Padrino is the godfather of Sinatra.
4
-
5
- == Preface
6
-
7
- Padrino is a ruby framework built upon the excellent {Sinatra Microframework}[http://www.sinatrarb.com].
8
- Sinatra is a DSL for creating simple web applications in Ruby with speed and minimal effort.
9
- This framework tries hard to make it as fun and easy as possible to code much more advanced web applications by
10
- building upon the Sinatra philosophies and foundation.
11
-
12
- == Introduction
13
-
14
- Many people love Sinatra's simplicity and lightweight but often quickly come to miss a great deal
15
- of functionality provided by other web frameworks such as Rails when building non-trivial applications.
16
-
17
- Our goal with this framework is to match the essence of Sinatra and at the same time create a standard library
18
- of tools, helpers and components that will make Sinatra suitable for more complex applications.
19
-
20
- Here is a brief overview of functionality provided by the Padrino framework:
21
-
22
- Agnostic:: Full support for many popular testing, templating, mocking, and data storage choices.
23
- Generators:: Create Padrino applications, models, controllers i.e: padrino-gen project.
24
- Mountable:: Unlike other ruby frameworks, principally designed for mounting multiple apps.
25
- Routing:: Full url named routes, named params, before/after filter support.
26
- Tag Helpers:: View helpers such as: tag, content_tag, input_tag.
27
- Asset Helpers:: View helpers such as: link_to, image_tag, javascript_include_tag.
28
- Form Helpers:: Builder support such as: form_tag, form_for, field_set_tag, text_field.
29
- Text Helpers:: Useful formatting like: time_ago_in_words, js_escape_html, sanitize_html.
30
- Mailer:: Fast and simple delivery support for sending emails (akin to ActionMailer).
31
- Admin:: Builtin Admin interface (like Django)
32
- Logging:: Provide a unified logger that can interact with your ORM or any library.
33
- Reloading:: Automatically reloads server code during development.
34
- Localization:: Full support of I18n language localization and can auto-set user's locale.
35
-
36
- Keep in mind, the user will be able to pull in these components
37
- {seperately into existing Sinatra applications}[http://www.padrinorb.com/guides/standalone-usage-in-sinatra]
38
- or use them altogether for a comprehensive upgrade to Sinatra (a full-stack Padrino application).
39
-
40
- == Installation
41
-
42
- To install the padrino framework, simply grab the latest version from gemcutter:
43
-
44
- $ sudo gem install padrino
45
-
46
- This will install the necessary padrino gems to get you started.
47
- Now you are ready to use this gem to enhance your sinatra projects or to create new Padrino applications.
48
-
49
- For a more detailed look at Padrino installation,
50
- check out the {Installation Guide}[http://www.padrinorb.com/guides/installation].
51
-
52
- == Usage
53
-
54
- Padrino is a framework which builds on the existing functionality and Sinatra and provides a variety of
55
- additional tools and helpers to build upon that foundation. This README and Padrino documentation in general will focus
56
- on the enhancements to the core Sinatra functionality. To use Padrino, one should be familiar with the basic
57
- usage of Sinatra itself.
58
-
59
- Please check out the
60
- {Understanding Sinatra}[http://www.padrinorb.com/guides/underlying-sinatra-overview] guide
61
- to learn more about these fundamentals.
62
-
63
- For information on how to use a specific gem in isolation within an existing Sinatra project, checkout the guide for
64
- {Using Padrino in Sinatra}[http://www.padrinorb.com/guides/standalone-usage-in-sinatra].
65
-
66
- == Getting Started
67
-
68
- Once a developer understands Sinatra, Padrino is quite easy to get comfortable with since Padrino is simply a superset
69
- of existing Sinatra Functionality! Best way to get started with building Padrino applications is to read following resources:
70
-
71
- * {Blog Tutorial}[http://www.padrinorb.com/guides/blog-tutorial] - Step-by-step guide to building a blog application with Padrino.
72
- * {Quick Overview}[http://www.padrinorb.com/guides/basic-projects] - Outlines basic generation commands.
73
- * {Padrino Examples}[http://www.padrinorb.com/guides/examples] - List of known Padrino applications which can serve as examples.
74
-
75
- == Enhanced Base Application (padrino-core)
76
-
77
- Sinatra has support for classes which can be extended to create an application: <tt>Sinatra::Base</tt> and <tt>Sinatra::Application</tt>
78
- These classes can be extended in order to create a Sinatra web application. These classes provide support for all the basic
79
- functionality afforded by Sinatra.
80
-
81
- Padrino has support for an enhanced base application class <tt>Padrino::Application</tt>. <tt>Padrino::Application</tt>
82
- expands the capabilities of Sinatra::Application and automatically provides the resulting application access to all of
83
- the padrino framework's functionalities.
84
-
85
- === Simple Application Definition
86
-
87
- Let us first take a look at the simplest possible Padrino application:
88
-
89
- # app.rb
90
- PADRINO_ROOT = File.dirname(__FILE__) unless defined? PADRINO_ROOT
91
- require 'padrino'
92
- Padrino.load!
93
-
94
- class SimpleApp < Padrino::Application
95
- get '/' do
96
- 'Hello world'
97
- end
98
-
99
- # and for read better we can divide with controllers
100
- controller '/admin' do
101
- get '/foo' do
102
- 'Url is /admin/foo'
103
- end
104
- end
105
- end
106
-
107
- === Enhanced Route Definitions and Controllers
108
-
109
- For a complete overview of the Padrino routing and controller system,
110
- check out the {Routing and Controller guide}[http://www.padrinorb.com/guides/controllers].
111
-
112
- Suppose we wanted to add additional routes to our Padrino application, and we want to organize the routes
113
- within a more structured layout. Simply add a <tt>controllers</tt> or <tt>app/controllers</tt> folder and create a file as such:
114
-
115
- # Simple Example
116
- SimpleApp.controllers do
117
- get "/test" do
118
- "Text to return"
119
- end
120
- end
121
-
122
- You can also do more complex route alias definitions:
123
-
124
- # app/controllers/example.rb
125
- SimpleApp.controllers :posts do
126
- get :index do
127
- ...
128
- end
129
-
130
- get :show, :with => :id do
131
- # url generated is '/posts/show/:id'
132
- # access params[:id]
133
- end
134
- end
135
-
136
- as well as mapping the route aliases to an explicit url:
137
-
138
- # app/controllers/example.rb
139
- SimpleApp.controllers do
140
- get :index, :map => '/index' do
141
- ...
142
- end
143
-
144
- get :account, :map => '/the/accounts/:name/and/:id' do
145
- # access params[:name] and params[:index]
146
- end
147
- end
148
-
149
- and even configure the +provides+ for each route:
150
-
151
- # app/controllers/example.rb
152
- SimpleApp.controllers :admin do
153
- get :show, :with => :id, :provides => :js do
154
- "Url is /admin/show/#{params[:id]}.#{params[:format]}"
155
- end
156
-
157
- get :other, :with => [:id, :name], :provides => [:html, :json] do
158
- case content_type
159
- when :js then ... end
160
- when :json then ... end
161
- end
162
- end
163
- end
164
-
165
- or auto lookup for current locale or content_type
166
-
167
- # app/controllers/example.rb
168
- SimpleApp.controllers :admin do
169
- get :show, :with => :id, :provides => [:html, :js] do
170
- render "admin/show"
171
- end
172
- end
173
-
174
- When you visit :+show+ and your I18n.locale == :ru Padrino try to look for "admin/show.ru.js.*" if nothing match that path
175
- they try "admin/show.ru.*" then "admin/show.js.*" if none match return "admin/show.erb" (or other engine i.e. haml)
176
-
177
- For a complete overview of the routing and controller system, check out the
178
- {Routing and Controller guide}[http://www.padrinorb.com/guides/controllers].
179
-
180
- === Rendering
181
-
182
- Unlike Sinatra, Padrino supports automatic template lookups such as:
183
-
184
- # searches for 'account/index.{erb,haml,...}
185
- render 'account/index'
186
-
187
- This render does not require any template engine to be specified and will choose the first one that is discovered.
188
- The existing render function works as well if an engine type should be specified:
189
-
190
- # example.haml
191
- render :haml, 'account/index'
192
-
193
- For a complete overview of the Padrino rendering system, check out the
194
- {Routing and Controller guide}[http://www.padrinorb.com/guides/controllers].
195
-
196
- === Layout
197
-
198
- With Padrino you can (like rails do) use for your custom layout, disable it
199
-
200
- class SimpleApp < Padrino::Application
201
-
202
- # Disable layouts
203
- disable layout
204
-
205
- # Use the layout located in views/layouts/custom.haml
206
- layout :custom
207
-
208
- For a complete overview of the layout functionality,
209
- check out the {Routing and Controller guide}[http://www.padrinorb.com/guides/controllers].
210
-
211
- === Mounting Applications
212
-
213
- Padrino applications are all automatically mountable into other Padrino projects. This means that a given Padrino
214
- project directory can easily mount multiple applications. This allows for better organization of complex applications,
215
- re-usable applications that can be applied (i.e admin, auth, blog) and even more flexibility.
216
-
217
- You can think of mountable applications as a 'full-featured' merb slice or rails engine. Instead of a separate construct,
218
- any application can simply be packaged and mounted into another project.
219
-
220
- Padrino stores application mounting information by default within <tt>config/apps.rb</tt>. This file is intended
221
- to keep all information regarding what applications are mounted to which uri's.
222
-
223
- For a complete look at mounting applications within a Padrino project,
224
- check out the guide on {Mounting Applications}[http://www.padrinorb.com/guides/mounting-applications].
225
-
226
- === Auto Load Paths
227
-
228
- Padrino also intelligently supports requiring useful files within your application automatically and provides
229
- functionality for easily splitting up your application into separate files. Padrino automatically requires <tt>config/database.rb</tt>
230
- as a convention for establishing database connection. Also, any files within the <tt>lib</tt> folder will be required
231
- automatically by Padrino.
232
-
233
- For a complete overview of auto-loaded paths within Padrino,
234
- check out the {Padrino Development Guide}[http://www.padrinorb.com/guides/development-and-terminal-commands].
235
-
236
- === Application Logging
237
-
238
- Padrino also supports robust logging capabilities. By default, logging information will
239
- go to the STDOUT in development (for use in a console) and in an environment-specific log file <tt>log/development.log</tt>
240
- in test and production environments.
241
-
242
- To use the logger within a Padrino application, simply refer to the <tt>logger</tt> method accessible
243
- within your app and any controller or views:
244
-
245
- # controllers/example.rb
246
- SimpleApp.controllers do
247
- get("/test") { logger.info "This is a test" }
248
- end
249
-
250
- For a complete overview of Padrino logger functionality, check out the
251
- {Padrino Development Guide}[http://www.padrinorb.com/guides/development-and-terminal-commands].
252
-
253
- === Development Reloader
254
-
255
- Padrino applications also have the enabled ability to automatically reload all changing application files without
256
- the need to restart the server. Through the use of a customized Rack middleware, all files on the 'load path'
257
- are monitored and reloaded whenever changes are applied.
258
-
259
- This makes rapid development much easier and provides a better alternative to 'shotgun' or 'rerun'
260
- which requires the application server to be restarted which makes requests take much longer to complete.
261
-
262
- For a complete overview of code reloading in development,
263
- check out the {Padrino Development Guide}[http://www.padrinorb.com/guides/development-and-terminal-commands].
264
-
265
- === Terminal Commands
266
-
267
- Padrino also comes equipped with multiple useful terminal commands which can be activated to perform
268
- common tasks such as starting / stopping the application, executing the unit tests or activating an irb session.
269
-
270
- The following commands are available:
271
-
272
- # starts the app server (non-daemonized)
273
- $ padrino start
274
- # starts the app server (daemonized) with given port, environment and adapter
275
- $ padrino start -d -p 3000 -e development -a thin
276
-
277
- # Stops a daemonized app server
278
- $ padrino stop
279
-
280
- # Bootup the Padrino console (irb)
281
- $ padrino console
282
-
283
- # Run/List tasks
284
- $ padrino rake
285
-
286
- You can also create custom rake tasks as well. Using these commands can simplify common tasks
287
- making development that much smoother.
288
-
289
- For a complete overview of Padrino terminal commands, check out the
290
- {Padrino Commands Guide}[http://www.padrinorb.com/guides/development-and-terminal-commands].
291
-
292
- == Copyright
293
-
294
- Copyright (c) 2011-2013 Padrino. See LICENSE for details.
@@ -1,5 +0,0 @@
1
- # coding:utf-8
2
- RAKE_ROOT = __FILE__
3
-
4
- require 'rubygems'
5
- require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper')
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'rubygems' unless defined?(Gem)
3
- require 'bundler/setup' if %w(Gemfile .components).all? { |f| File.exist?(f) }
4
-
5
- padrino_core_path = File.expand_path('../../lib', __FILE__)
6
- $:.unshift(padrino_core_path) if File.directory?(padrino_core_path) && !$:.include?(padrino_core_path)
7
-
8
- require 'padrino-core/cli/base'
9
- Padrino::Cli::Base.start(ARGV)
@@ -1,200 +0,0 @@
1
- require 'sinatra/base'
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'
16
-
17
-
18
- PADRINO_ENV = ENV["PADRINO_ENV"] ||= ENV["RACK_ENV"] ||= "development" unless defined?(PADRINO_ENV)
19
- PADRINO_ROOT = ENV["PADRINO_ROOT"] ||= File.dirname(Padrino.first_caller) unless defined?(PADRINO_ROOT)
20
-
21
- module Padrino
22
- class ApplicationLoadError < RuntimeError # @private
23
- end
24
-
25
- class << self
26
- ##
27
- # Helper method for file references.
28
- #
29
- # @param [Array<String>] args
30
- # The directories to join to {PADRINO_ROOT}.
31
- #
32
- # @return [String]
33
- # The absolute path.
34
- #
35
- # @example
36
- # # Referencing a file in config called settings.yml
37
- # Padrino.root("config", "settings.yml")
38
- # # returns PADRINO_ROOT + "/config/setting.yml"
39
- #
40
- def root(*args)
41
- File.expand_path(File.join(PADRINO_ROOT, *args))
42
- end
43
-
44
- ##
45
- # Helper method that return {PADRINO_ENV}.
46
- #
47
- # @return [Symbol]
48
- # The Padrino Environment.
49
- #
50
- def env
51
- @_env ||= PADRINO_ENV.to_s.downcase.to_sym
52
- end
53
-
54
- ##
55
- # The resulting rack builder mapping each 'mounted' application.
56
- #
57
- # @return [Padrino::Router]
58
- # The router for the application.
59
- #
60
- # @raise [ApplicationLoadError]
61
- # No applications were mounted.
62
- #
63
- def application
64
- raise ApplicationLoadError, "At least one app must be mounted!" unless Padrino.mounted_apps && Padrino.mounted_apps.any?
65
- router = Padrino::Router.new
66
- Padrino.mounted_apps.each { |app| app.map_onto(router) }
67
-
68
- if middleware.present?
69
- builder = Rack::Builder.new
70
- middleware.each { |c,a,b| builder.use(c, *a, &b) }
71
- builder.run(router)
72
- builder.to_app
73
- else
74
- router
75
- end
76
- end
77
-
78
- ##
79
- # Configure Global Project Settings for mounted apps. These can be overloaded
80
- # in each individual app's own personal configuration. This can be used like:
81
- #
82
- # @yield []
83
- # The given block will be called to configure each application.
84
- #
85
- # @example
86
- # Padrino.configure_apps do
87
- # enable :sessions
88
- # disable :raise_errors
89
- # end
90
- #
91
- def configure_apps(&block)
92
- return unless block_given?
93
- @@_global_configurations ||= []
94
- @@_global_configurations << block
95
- @_global_configuration = lambda do |app|
96
- @@_global_configurations.each do |configuration|
97
- app.class_eval(&configuration)
98
- end
99
- end
100
- end
101
-
102
- ##
103
- # Returns project-wide configuration settings defined in
104
- # {configure_apps} block.
105
- #
106
- def apps_configuration
107
- @_global_configuration
108
- end
109
-
110
- ##
111
- # Set +Encoding.default_internal+ and +Encoding.default_external+
112
- # to +Encoding::UFT_8+.
113
- #
114
- # Please note that in +1.9.2+ with some template engines like +haml+
115
- # you should turn off Encoding.default_internal to prevent problems.
116
- #
117
- # @see https://github.com/rtomayko/tilt/issues/75
118
- #
119
- # @return [NilClass]
120
- #
121
- def set_encoding
122
- if RUBY_VERSION < '1.9'
123
- $KCODE='u'
124
- else
125
- Encoding.default_external = Encoding::UTF_8
126
- Encoding.default_internal = Encoding::UTF_8
127
- end
128
- nil
129
- end
130
-
131
- ##
132
- # A Rack::Builder object that allows to add middlewares in front of all
133
- # Padrino applications.
134
- #
135
- # @return [Array<Array<Class, Array, Proc>>]
136
- # The middleware classes.
137
- #
138
- def middleware
139
- @middleware ||= []
140
- end
141
-
142
- ##
143
- # Clears all previously configured middlewares.
144
- #
145
- # @return [Array]
146
- # An empty array
147
- #
148
- def clear_middleware!
149
- @middleware = []
150
- end
151
-
152
- ##
153
- # Convenience method for adding a Middleware to the whole padrino app.
154
- #
155
- # @param [Class] m
156
- # The middleware class.
157
- #
158
- # @param [Array] args
159
- # The arguments for the middleware.
160
- #
161
- # @yield []
162
- # The given block will be passed to the initialized middleware.
163
- #
164
- def use(m, *args, &block)
165
- middleware << [m, args, block]
166
- end
167
-
168
- ##
169
- # Registers a gem with padrino. This relieves the caller from setting up
170
- # loadpaths by itself and enables Padrino to look up apps in gem folder.
171
- #
172
- # The name given has to be the proper gem name as given in the gemspec.
173
- #
174
- # @param [String] name
175
- # The name of the gem being registered.
176
- #
177
- # @param [Module] main_module
178
- # The main module of the gem.
179
- #
180
- # @returns The root path of the loaded gem
181
- def gem(name, main_module)
182
- _, spec = Gem.loaded_specs.find{|spec_pair| spec_pair[0] == name }
183
- gems << spec
184
- modules << main_module
185
- spec.full_gem_path
186
- end
187
-
188
- ##
189
- # @returns [Gem::Specification]
190
- def gems
191
- @gems ||= []
192
- end
193
-
194
- ##
195
- # @returns [<Padrino::Module>]
196
- def modules
197
- @modules ||= []
198
- end
199
- end
200
- end