middleman 2.0.16.1 → 3.0.0.alpha.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. data/.gitignore +2 -1
  2. data/CHANGELOG +16 -8
  3. data/features/builder.feature +2 -5
  4. data/features/cache_buster.feature +1 -1
  5. data/features/clean_build.feature +0 -1
  6. data/features/coffee-script.feature +3 -3
  7. data/features/custom_layout_engines.feature +10 -0
  8. data/features/directory_index.feature +0 -1
  9. data/features/dynamic_pages.feature +0 -1
  10. data/features/fonts.feature +0 -1
  11. data/features/{padrino_helpers.feature → former_padrino_helpers.feature} +1 -1
  12. data/features/sprockets.feature +34 -5
  13. data/features/sprockets_gems.feature +7 -4
  14. data/features/step_definitions/asset_host_steps.rb +7 -6
  15. data/features/step_definitions/builder_steps.rb +4 -0
  16. data/features/step_definitions/middleman_steps.rb +22 -16
  17. data/features/step_definitions/page_layout_steps.rb +10 -8
  18. data/fixtures/custom-layout-app/config.rb +1 -0
  19. data/fixtures/custom-layout-app/source/index.html.erb +1 -0
  20. data/fixtures/custom-layout-app/source/layout.haml +6 -0
  21. data/fixtures/sprockets-app/config.rb +2 -1
  22. data/fixtures/sprockets-app/source/library/css/bootstrap_include.css.scss +1 -0
  23. data/fixtures/sprockets-app/source/library/css/plain.css +3 -0
  24. data/fixtures/sprockets-app/source/library/css/sprockets_base1.css.scss +1 -0
  25. data/fixtures/sprockets-app/source/library/css/sprockets_base2.css.scss +1 -0
  26. data/fixtures/sprockets-app/source/library/css/sprockets_sub.css.scss +1 -0
  27. data/fixtures/sprockets-app/source/{jquery_include.js → library/js/jquery_include.js} +0 -0
  28. data/fixtures/sprockets-app/source/library/js/plain.js +3 -0
  29. data/fixtures/sprockets-app/source/library/{javascripts → js}/sprockets_base.js +0 -0
  30. data/fixtures/sprockets-app/source/library/{javascripts → js}/sprockets_sub.js +0 -0
  31. data/fixtures/test-app/config.rb +5 -4
  32. data/fixtures/test-app/source/{padrino_test.html.haml → former_padrino_test.html.haml} +0 -0
  33. data/fixtures/test-app/source/stylesheets/sprockets_base1.css.scss +1 -0
  34. data/fixtures/test-app/source/stylesheets/sprockets_base2.css.scss +1 -0
  35. data/fixtures/test-app/source/stylesheets/sprockets_sub.css.scss +1 -0
  36. data/lib/middleman.rb +27 -25
  37. data/lib/middleman/base.rb +408 -166
  38. data/lib/middleman/builder.rb +78 -162
  39. data/lib/middleman/cli.rb +61 -32
  40. data/lib/middleman/core_extensions/assets.rb +4 -44
  41. data/lib/middleman/core_extensions/builder.rb +12 -16
  42. data/lib/middleman/core_extensions/compass.rb +28 -57
  43. data/lib/middleman/core_extensions/data.rb +65 -49
  44. data/lib/middleman/core_extensions/default_helpers.rb +33 -18
  45. data/lib/middleman/core_extensions/features.rb +48 -26
  46. data/lib/middleman/core_extensions/file_watcher.rb +66 -0
  47. data/lib/middleman/core_extensions/front_matter.rb +91 -86
  48. data/lib/middleman/core_extensions/rendering.rb +9 -8
  49. data/lib/middleman/core_extensions/routing.rb +19 -53
  50. data/lib/middleman/core_extensions/sitemap.rb +229 -0
  51. data/lib/middleman/core_extensions/sprockets.rb +53 -37
  52. data/lib/middleman/features/asset_host.rb +20 -10
  53. data/lib/middleman/features/automatic_image_sizes.rb +12 -9
  54. data/lib/middleman/features/cache_buster.rb +38 -25
  55. data/lib/middleman/features/directory_indexes.rb +31 -28
  56. data/lib/middleman/features/minify_css.rb +3 -2
  57. data/lib/middleman/features/minify_css/cssmin.rb +55 -0
  58. data/lib/middleman/features/minify_javascript.rb +12 -5
  59. data/lib/middleman/features/relative_assets.rb +28 -25
  60. data/lib/middleman/features/sitemap_tree.rb +34 -0
  61. data/lib/middleman/guard.rb +57 -23
  62. data/lib/middleman/renderers/erb.rb +29 -0
  63. data/lib/middleman/renderers/liquid.rb +3 -12
  64. data/lib/middleman/renderers/markdown.rb +16 -15
  65. data/lib/middleman/renderers/sass.rb +34 -38
  66. data/lib/middleman/vendor/hooks-0.2.0/CHANGES.textile +9 -0
  67. data/lib/middleman/vendor/hooks-0.2.0/Gemfile +3 -0
  68. data/lib/middleman/vendor/hooks-0.2.0/README.rdoc +107 -0
  69. data/lib/middleman/vendor/hooks-0.2.0/Rakefile +12 -0
  70. data/lib/middleman/vendor/hooks-0.2.0/hooks.gemspec +22 -0
  71. data/lib/middleman/vendor/hooks-0.2.0/lib/hooks.rb +109 -0
  72. data/lib/middleman/vendor/hooks-0.2.0/lib/hooks/inheritable_attribute.rb +33 -0
  73. data/lib/middleman/vendor/hooks-0.2.0/test/hooks_test.rb +141 -0
  74. data/lib/middleman/vendor/hooks-0.2.0/test/inheritable_attribute_test.rb +55 -0
  75. data/lib/middleman/vendor/hooks-0.2.0/test/test_helper.rb +10 -0
  76. data/lib/middleman/vendor/padrino-core-0.10.5/.document +5 -0
  77. data/lib/middleman/vendor/padrino-core-0.10.5/.gitignore +22 -0
  78. data/lib/middleman/vendor/padrino-core-0.10.5/.yardopts +1 -0
  79. data/lib/middleman/vendor/padrino-core-0.10.5/LICENSE.txt +20 -0
  80. data/lib/middleman/vendor/padrino-core-0.10.5/README.rdoc +294 -0
  81. data/lib/middleman/vendor/padrino-core-0.10.5/Rakefile +5 -0
  82. data/lib/middleman/vendor/padrino-core-0.10.5/bin/padrino +9 -0
  83. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core.rb +167 -0
  84. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/application.rb +270 -0
  85. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/application/rendering.rb +292 -0
  86. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/application/routing.rb +934 -0
  87. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/application/showexceptions.rb +20 -0
  88. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/caller.rb +53 -0
  89. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/cli/adapter.rb +24 -0
  90. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/cli/base.rb +151 -0
  91. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/cli/console.rb +20 -0
  92. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/cli/rake.rb +24 -0
  93. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/cli/rake_tasks.rb +59 -0
  94. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/command.rb +38 -0
  95. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/images/404.png +0 -0
  96. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/images/500.png +0 -0
  97. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/loader.rb +210 -0
  98. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/cs.yml +34 -0
  99. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/da.yml +34 -0
  100. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/de.yml +34 -0
  101. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/en.yml +34 -0
  102. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/es.yml +34 -0
  103. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/fr.yml +34 -0
  104. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/hu.yml +34 -0
  105. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/it.yml +40 -0
  106. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/ja.yml +34 -0
  107. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/lv.yml +34 -0
  108. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/nl.yml +34 -0
  109. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/no.yml +35 -0
  110. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/pl.yml +34 -0
  111. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/pt_br.yml +40 -0
  112. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/ru.yml +35 -0
  113. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/tr.yml +34 -0
  114. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/uk.yml +34 -0
  115. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/zh_cn.yml +34 -0
  116. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/zh_tw.yml +34 -0
  117. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/logger.rb +345 -0
  118. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/mounter.rb +224 -0
  119. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/reloader.rb +254 -0
  120. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/router.rb +98 -0
  121. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/server.rb +79 -0
  122. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/support_lite.rb +199 -0
  123. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/tasks.rb +21 -0
  124. data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/version.rb +20 -0
  125. data/lib/middleman/vendor/padrino-core-0.10.5/padrino-core.gemspec +38 -0
  126. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/apps/.components +6 -0
  127. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/apps/.gitignore +7 -0
  128. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/apps/complex.rb +32 -0
  129. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/apps/simple.rb +33 -0
  130. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/a.rb +9 -0
  131. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/b.rb +4 -0
  132. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/c.rb +1 -0
  133. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/circular/e.rb +13 -0
  134. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/circular/f.rb +2 -0
  135. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/circular/g.rb +2 -0
  136. data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/d.rb +4 -0
  137. data/lib/middleman/vendor/padrino-core-0.10.5/test/helper.rb +81 -0
  138. data/lib/middleman/vendor/padrino-core-0.10.5/test/mini_shoulda.rb +45 -0
  139. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_application.rb +108 -0
  140. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_core.rb +79 -0
  141. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_dependencies.rb +44 -0
  142. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_filters.rb +278 -0
  143. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_locale.rb +21 -0
  144. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_logger.rb +100 -0
  145. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_mounter.rb +177 -0
  146. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_reloader_complex.rb +75 -0
  147. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_reloader_simple.rb +98 -0
  148. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_rendering.rb +461 -0
  149. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_restful_routing.rb +33 -0
  150. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_router.rb +146 -0
  151. data/lib/middleman/vendor/padrino-core-0.10.5/test/test_routing.rb +1673 -0
  152. data/lib/middleman/vendor/padrino-helpers-0.10.5/.document +5 -0
  153. data/lib/middleman/vendor/padrino-helpers-0.10.5/.gitignore +21 -0
  154. data/lib/middleman/vendor/padrino-helpers-0.10.5/.yardopts +1 -0
  155. data/lib/middleman/vendor/padrino-helpers-0.10.5/LICENSE.txt +20 -0
  156. data/lib/middleman/vendor/padrino-helpers-0.10.5/README.rdoc +239 -0
  157. data/lib/middleman/vendor/padrino-helpers-0.10.5/Rakefile +5 -0
  158. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers.rb +58 -0
  159. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/asset_tag_helpers.rb +420 -0
  160. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/form_builder/abstract_form_builder.rb +220 -0
  161. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/form_builder/standard_form_builder.rb +43 -0
  162. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/form_helpers.rb +602 -0
  163. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/format_helpers.rb +381 -0
  164. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/cs.yml +103 -0
  165. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/da.yml +91 -0
  166. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/de.yml +81 -0
  167. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/en.yml +103 -0
  168. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/es.yml +103 -0
  169. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/fr.yml +80 -0
  170. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/hu.yml +103 -0
  171. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/it.yml +89 -0
  172. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/ja.yml +103 -0
  173. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/lv.yml +103 -0
  174. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/nl.yml +82 -0
  175. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/no.yml +91 -0
  176. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/pl.yml +95 -0
  177. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/pt_br.yml +103 -0
  178. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/ru.yml +103 -0
  179. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/tr.yml +103 -0
  180. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/uk.yml +103 -0
  181. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/zh_cn.yml +104 -0
  182. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/zh_tw.yml +103 -0
  183. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/number_helpers.rb +288 -0
  184. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/output_helpers.rb +175 -0
  185. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/output_helpers/abstract_handler.rb +98 -0
  186. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/output_helpers/erb_handler.rb +79 -0
  187. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/output_helpers/haml_handler.rb +63 -0
  188. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/output_helpers/slim_handler.rb +81 -0
  189. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/render_helpers.rb +60 -0
  190. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/tag_helpers.rb +103 -0
  191. data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/translation_helpers.rb +38 -0
  192. data/lib/middleman/vendor/padrino-helpers-0.10.5/padrino-helpers.gemspec +27 -0
  193. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/app.rb +73 -0
  194. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/capture_concat.erb +14 -0
  195. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/capture_concat.haml +12 -0
  196. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/capture_concat.slim +13 -0
  197. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_for.erb +14 -0
  198. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_for.haml +12 -0
  199. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_for.slim +12 -0
  200. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_tag.erb +11 -0
  201. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_tag.haml +9 -0
  202. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_tag.slim +9 -0
  203. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/current_engine.erb +5 -0
  204. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/current_engine.haml +5 -0
  205. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/current_engine.slim +5 -0
  206. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/fields_for.erb +20 -0
  207. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/fields_for.haml +15 -0
  208. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/fields_for.slim +15 -0
  209. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_for.erb +56 -0
  210. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_for.haml +47 -0
  211. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_for.slim +47 -0
  212. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_tag.erb +56 -0
  213. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_tag.haml +45 -0
  214. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_tag.slim +45 -0
  215. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/link_to.erb +5 -0
  216. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/link_to.haml +4 -0
  217. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/link_to.slim +4 -0
  218. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/mail_to.erb +3 -0
  219. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/mail_to.haml +3 -0
  220. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/mail_to.slim +3 -0
  221. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/meta_tag.erb +3 -0
  222. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/meta_tag.haml +3 -0
  223. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/meta_tag.slim +3 -0
  224. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/partials/_erb.erb +1 -0
  225. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/partials/_haml.haml +1 -0
  226. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/partials/_slim.slim +1 -0
  227. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/simple_partial.erb +1 -0
  228. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/simple_partial.haml +1 -0
  229. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/simple_partial.slim +1 -0
  230. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/app.rb +50 -0
  231. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/current_engine.haml +5 -0
  232. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/current_engines/_erb.erb +1 -0
  233. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/current_engines/_haml.haml +1 -0
  234. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/current_engines/_slim.slim +1 -0
  235. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/erb/test.erb +1 -0
  236. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/explicit_engine.haml +5 -0
  237. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/haml/test.haml +1 -0
  238. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/template/_user.haml +7 -0
  239. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/template/haml_template.haml +1 -0
  240. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/template/some_template.haml +2 -0
  241. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/helper.rb +66 -0
  242. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_asset_tag_helpers.rb +320 -0
  243. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_form_builder.rb +996 -0
  244. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_form_helpers.rb +645 -0
  245. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_format_helpers.rb +227 -0
  246. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_locale.rb +20 -0
  247. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_number_helpers.rb +136 -0
  248. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_output_helpers.rb +153 -0
  249. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_render_helpers.rb +76 -0
  250. data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_tag_helpers.rb +105 -0
  251. data/lib/middleman/version.rb +1 -1
  252. data/middleman-x86-mingw32.gemspec +16 -33
  253. data/middleman.gemspec +16 -31
  254. metadata +590 -349
  255. data/features/sinatra.feature +0 -6
  256. data/lib/middleman/core_extensions/rack_map.rb +0 -35
  257. data/lib/middleman/renderers/coffee_script.rb +0 -8
  258. data/lib/middleman/renderers/haml.rb +0 -31
  259. data/lib/middleman/renderers/slim.rb +0 -8
@@ -0,0 +1,20 @@
1
+ module Padrino
2
+ ##
3
+ # This module extend Sinatra::ShowExceptions adding Padrino as "Framework".
4
+ #
5
+ # @private
6
+ class ShowExceptions < Sinatra::ShowExceptions
7
+ private
8
+ def frame_class(frame)
9
+ if frame.filename =~ /lib\/sinatra.*\.rb|lib\/padrino.*\.rb/
10
+ "framework"
11
+ elsif (defined?(Gem) && frame.filename.include?(Gem.dir)) ||
12
+ frame.filename =~ /\/bin\/(\w+)$/ ||
13
+ frame.filename =~ /Ruby\/Gems/
14
+ "system"
15
+ else
16
+ "app"
17
+ end
18
+ end
19
+ end # ShowExceptions
20
+ end # Padrino
@@ -0,0 +1,53 @@
1
+ module Padrino
2
+
3
+ # List of callers in a Padrino application that should be ignored as part of a stack trace.
4
+ PADRINO_IGNORE_CALLERS = [
5
+ %r{lib/padrino-.*$}, # all padrino code
6
+ %r{/padrino-.*/(lib|bin)}, # all padrino code
7
+ %r{/bin/padrino$}, # all padrino code
8
+ %r{/sinatra(/(base|main|showexceptions))?\.rb$}, # all sinatra code
9
+ %r{lib/tilt.*\.rb$}, # all tilt code
10
+ %r{lib/rack.*\.rb$}, # all rack code
11
+ %r{lib/mongrel.*\.rb$}, # all mongrel code
12
+ %r{lib/shotgun.*\.rb$}, # all shotgun lib
13
+ %r{bin/shotgun$}, # shotgun binary
14
+ %r{\(.*\)}, # generated code
15
+ %r{shoulda/context\.rb$}, # shoulda hacks
16
+ %r{mocha/integration}, # mocha hacks
17
+ %r{test/unit}, # test unit hacks
18
+ %r{rake_test_loader\.rb}, # rake hacks
19
+ %r{custom_require\.rb$}, # rubygems require hacks
20
+ %r{active_support}, # active_support require hacks
21
+ %r{/thor} # thor require hacks
22
+ ] unless defined?(PADRINO_IGNORE_CALLERS)
23
+
24
+ ##
25
+ # Add rubinius (and hopefully other VM implementations) ignore patterns ...
26
+ #
27
+ PADRINO_IGNORE_CALLERS.concat(RUBY_IGNORE_CALLERS) if defined?(RUBY_IGNORE_CALLERS)
28
+
29
+ private
30
+ ##
31
+ # The filename for the file that is the direct caller (first caller).
32
+ #
33
+ # @return [String]
34
+ # The file the caller method exists in.
35
+ #
36
+ def self.first_caller
37
+ caller_files.first
38
+ end
39
+
40
+ #
41
+ # Like +Kernel#caller+ but excluding certain magic entries and without
42
+ # line / method information; the resulting array contains filenames only.
43
+ #
44
+ # @return [Array<String>]
45
+ # The files of the calling methods.
46
+ #
47
+ def self.caller_files
48
+ caller(1).
49
+ map { |line| line.split(/:(?=\d|in )/)[0,2] }.
50
+ reject { |file,line| PADRINO_IGNORE_CALLERS.any? { |pattern| file =~ pattern } }.
51
+ map { |file,line| file }
52
+ end
53
+ end # Padrino
@@ -0,0 +1,24 @@
1
+ module Padrino
2
+ module Cli
3
+ module Adapter
4
+ class << self
5
+ # Start for the given options a rackup handler
6
+ def start(options)
7
+ Padrino.run!(options.symbolize_keys)
8
+ end
9
+
10
+ # Method that stop (if exist) a running Padrino.application
11
+ def stop(options)
12
+ options.symbolize_keys!
13
+ if File.exist?(options[:pid])
14
+ pid = File.read(options[:pid]).to_i
15
+ print "=> Sending INT to process with pid #{pid} wait "
16
+ Process.kill(2, pid) rescue nil
17
+ else
18
+ puts "=> #{options[:pid]} not found!"
19
+ end
20
+ end
21
+ end # self
22
+ end # Adapter
23
+ end # Cli
24
+ end # Padrino
@@ -0,0 +1,151 @@
1
+ require 'thor'
2
+
3
+ module Padrino
4
+ module Cli
5
+
6
+ class Base < Thor
7
+ include Thor::Actions
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"
11
+ class_option :help, :type => :boolean, :desc => "Show help usage"
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"
20
+ def start
21
+ prepare :start
22
+ require File.expand_path("../adapter", __FILE__)
23
+ require File.expand_path('config/boot.rb')
24
+ Padrino::Cli::Adapter.start(options)
25
+ end
26
+
27
+ desc "s", "Starts the Padrino application"
28
+ def s
29
+ invoke :start
30
+ end
31
+
32
+ desc "stop", "Stops the Padrino application"
33
+ method_option :pid, :type => :string, :aliases => "-p", :desc => "File to store pid", :default => 'tmp/pids/server.pid'
34
+ def stop
35
+ prepare :stop
36
+ require File.expand_path("../adapter", __FILE__)
37
+ Padrino::Cli::Adapter.stop(options)
38
+ end
39
+
40
+ desc "rake", "Execute rake tasks"
41
+ method_option :environment, :type => :string, :aliases => "-e", :required => true, :default => :development
42
+ method_option :list, :type => :string, :aliases => "-T", :desc => "Display the tasks (matching optional PATTERN) with descriptions, then exit."
43
+ method_option :trace, :type => :boolean, :aliases => "-t", :desc => "Turn on invoke/execute tracing, enable full backtrace."
44
+ method_option :verbose, :type => :boolean, :aliases => "-v", :desc => "Log message to standard output."
45
+ def rake(*args)
46
+ prepare :rake
47
+ args << "-T" if options[:list]
48
+ args << options[:list] unless options[:list].nil? || options[:list].to_s == "list"
49
+ args << "--trace" if options[:trace]
50
+ args << "--verbose" if options[:verbose]
51
+ ARGV.clear
52
+ ARGV.concat(args)
53
+ puts "=> Executing Rake #{ARGV.join(' ')} ..."
54
+ ENV['PADRINO_LOG_LEVEL'] ||= "test"
55
+ load File.expand_path('../rake.rb', __FILE__)
56
+ silence(:stdout) { require File.expand_path('config/boot.rb') }
57
+ PadrinoTasks.init(true)
58
+ end
59
+
60
+ desc "console", "Boots up the Padrino application irb console"
61
+ def console
62
+ prepare :console
63
+ require File.expand_path("../../version", __FILE__)
64
+ ARGV.clear
65
+ puts "=> Loading #{options.environment} console (Padrino v.#{Padrino.version})"
66
+ require 'irb'
67
+ require "irb/completion"
68
+ require File.expand_path('config/boot.rb')
69
+ require File.expand_path('../console', __FILE__)
70
+ IRB.start
71
+ end
72
+
73
+ desc "generate", "Executes the Padrino generator with given options."
74
+ def generate(*args)
75
+ # Build Padrino g as an alias of padrino-gen
76
+ begin
77
+ # We try to load the vendored padrino-gen if exist
78
+ padrino_gen_path = File.expand_path('../../../../../padrino-gen/lib', __FILE__)
79
+ $:.unshift(padrino_gen_path) if File.directory?(padrino_gen_path) && !$:.include?(padrino_gen_path)
80
+ require 'padrino-core/command'
81
+ require 'padrino-gen/command'
82
+ ARGV.shift
83
+ Padrino.bin_gen(ARGV)
84
+ rescue
85
+ puts "<= You need padrino-gen! Run: gem install padrino-gen"
86
+ end
87
+ end
88
+
89
+ desc "g", "Executes the Padrino generator with given options."
90
+ def g(*args)
91
+ invoke(:generate, args)
92
+ end
93
+
94
+ desc "gen", "Executes the Padrino generator with given options."
95
+ def gen(*args)
96
+ invoke(:generate, args)
97
+ end
98
+
99
+ desc "version", "Show current Padrino Version"
100
+ map "-v" => :version, "--version" => :version
101
+ def version
102
+ require 'padrino-core/version'
103
+ puts "Padrino v. #{Padrino.version}"
104
+ end
105
+
106
+ private
107
+ def prepare(task)
108
+ if options.help?
109
+ help(task.to_s)
110
+ raise SystemExit
111
+ end
112
+ ENV["PADRINO_ENV"] ||= ENV["RACK_ENV"] ||= options.environment.to_s
113
+ chdir(options.chdir)
114
+ unless File.exist?('config/boot.rb')
115
+ puts "=> Could not find boot file in: #{options.chdir}/config/boot.rb !!!"
116
+ raise SystemExit
117
+ end
118
+ end
119
+
120
+ protected
121
+ def self.banner(task=nil, *args)
122
+ "padrino #{task.name}"
123
+ end
124
+
125
+ def chdir(dir)
126
+ return unless dir
127
+ begin
128
+ Dir.chdir(dir.to_s)
129
+ rescue Errno::ENOENT
130
+ puts "=> Specified Padrino root '#{dir}' does not appear to exist!"
131
+ rescue Errno::EACCES
132
+ puts "=> Specified Padrino root '#{dir}' cannot be accessed by the current user!"
133
+ end
134
+ end
135
+
136
+ def capture(stream)
137
+ begin
138
+ stream = stream.to_s
139
+ eval "$#{stream} = StringIO.new"
140
+ yield
141
+ result = eval("$#{stream}").string
142
+ ensure
143
+ eval("$#{stream} = #{stream.upcase}")
144
+ end
145
+
146
+ result
147
+ end
148
+ alias :silence :capture
149
+ end # Base
150
+ end # Cli
151
+ end # Padrino
@@ -0,0 +1,20 @@
1
+ # Reloads classes
2
+ def reload!
3
+ Padrino.reload!
4
+ end
5
+
6
+ # Show applications
7
+ def applications
8
+ puts "==== List of Mounted Applications ====\n\n"
9
+ Padrino.mounted_apps.each do |app|
10
+ puts " * %-10s mapped to %s" % [app.name, app.uri_root]
11
+ end
12
+ puts
13
+ Padrino.mounted_apps.map { |app| "#{app.name} => #{app.uri_root}" }
14
+ end
15
+
16
+ # Load apps
17
+ Padrino.mounted_apps.each do |app|
18
+ puts "=> Loading Application #{app.app_class}"
19
+ app.app_obj.setup_application!
20
+ end
@@ -0,0 +1,24 @@
1
+ require File.expand_path('../../tasks', __FILE__)
2
+ require 'rake'
3
+ require 'thor'
4
+ require 'securerandom' unless defined?(SecureRandom)
5
+
6
+ module PadrinoTasks
7
+ def self.init(init=false)
8
+ Padrino::Tasks.files.flatten.uniq.each { |rakefile| Rake.application.add_import(rakefile) rescue puts "<= Failed load #{ext}" }
9
+ if init
10
+ Rake.application.init
11
+ Rake.application.instance_variable_set(:@rakefile, __FILE__)
12
+ load(File.expand_path('../rake_tasks.rb', __FILE__))
13
+ Rake.application.load_imports
14
+ Rake.application.top_level
15
+ else
16
+ load(File.expand_path('../rake_tasks.rb', __FILE__))
17
+ Rake.application.load_imports
18
+ end
19
+ end
20
+ end
21
+
22
+ def shell
23
+ @_shell ||= Thor::Base.shell.new
24
+ end
@@ -0,0 +1,59 @@
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) }
5
+
6
+ # Loads the Padrino applications mounted within the project
7
+ # setting up the required environment for Padrino
8
+ task :environment do
9
+ Padrino.mounted_apps.each do |app|
10
+ app.app_obj.setup_application!
11
+ end
12
+ end
13
+
14
+ desc "Generate a secret key"
15
+ task :secret do
16
+ shell.say SecureRandom.hex(32)
17
+ end
18
+
19
+ # lists all routes of a given app
20
+ def list_app_routes(app, args)
21
+ app_routes = app.named_routes
22
+ app_routes.reject! { |r| r.identifier.to_s !~ /#{args.query}/ } if args.query.present?
23
+ app_routes.map! { |r| [r.verb, r.name, r.path] }
24
+ return if app_routes.empty?
25
+ shell.say "\nApplication: #{app.app_class}", :yellow
26
+ app_routes.unshift(["REQUEST", "URL", "PATH"])
27
+ max_col_1 = app_routes.max { |a, b| a[0].size <=> b[0].size }[0].size
28
+ max_col_2 = app_routes.max { |a, b| a[1].size <=> b[1].size }[1].size
29
+ app_routes.each_with_index do |row, i|
30
+ message = [row[1].ljust(max_col_2+2), row[0].center(max_col_1+2), row[2]]
31
+ shell.say(" " + message.join(" "), i==0 ? :bold : nil)
32
+ end
33
+ end
34
+
35
+ desc "Displays a listing of the named routes within a project, optionally only those matched by [query]"
36
+ task :routes, [:query] => :environment do |t, args|
37
+ Padrino.mounted_apps.each do |app|
38
+ list_app_routes(app, args)
39
+ end
40
+ end
41
+
42
+ desc "Displays a listing of the named routes a given app [app]"
43
+ namespace :routes do
44
+ task :app, [:app] => :environment do |t, args|
45
+ app = Padrino.mounted_apps.find { |app| app.app_class == args.app }
46
+ list_app_routes(app, args) if app
47
+ end
48
+ 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
@@ -0,0 +1,38 @@
1
+ require 'rbconfig'
2
+
3
+ module Padrino
4
+ ##
5
+ # This method return the correct location of padrino bin or
6
+ # exec it using Kernel#system with the given args
7
+ #
8
+ # @param [Array] args
9
+ # command or commands to execute
10
+ #
11
+ # @return [Boolean]
12
+ #
13
+ # @example
14
+ # Padrino.bin('start', '-e production')
15
+ #
16
+ def self.bin(*args)
17
+ @_padrino_bin ||= [self.ruby_command, File.expand_path("../../../bin/padrino", __FILE__)]
18
+ args.empty? ? @_padrino_bin : system(args.unshift(@_padrino_bin).join(" "))
19
+ end
20
+
21
+ ##
22
+ # Return the path to the ruby interpreter taking into account multiple
23
+ # installations and windows extensions.
24
+ #
25
+ # @return [String]
26
+ # path to ruby bin executable
27
+ #
28
+ def self.ruby_command
29
+ @ruby_command ||= begin
30
+ ruby = File.join(RbConfig::CONFIG['bindir'], RbConfig::CONFIG['ruby_install_name'])
31
+ ruby << RbConfig::CONFIG['EXEEXT']
32
+
33
+ # escape string in case path to ruby executable contain spaces.
34
+ ruby.sub!(/.*\s.*/m, '"\&"')
35
+ ruby
36
+ end
37
+ end
38
+ end # Padrino
@@ -0,0 +1,210 @@
1
+ module Padrino
2
+ class << self
3
+ ##
4
+ # Hooks to be called before a load/reload.
5
+ #
6
+ # @yield []
7
+ # The given block will be called before Padrino was loaded/reloaded.
8
+ #
9
+ # @return [Array<Proc>]
10
+ # The load/reload before hooks.
11
+ #
12
+ # @example
13
+ # before_load do
14
+ # pre_initialize_something
15
+ # end
16
+ #
17
+ def before_load(&block)
18
+ @_before_load ||= []
19
+ @_before_load << block if block_given?
20
+ @_before_load
21
+ end
22
+
23
+ ##
24
+ # Hooks to be called after a load/reload.
25
+ #
26
+ # @yield []
27
+ # The given block will be called after Padrino was loaded/reloaded.
28
+ #
29
+ # @return [Array<Proc>]
30
+ # The load/reload hooks.
31
+ #
32
+ # @example
33
+ # after_load do
34
+ # DataMapper.finalize
35
+ # end
36
+ #
37
+ def after_load(&block)
38
+ @_after_load ||= []
39
+ @_after_load << block if block_given?
40
+ @_after_load
41
+ end
42
+
43
+ ##
44
+ # The used +$LOAD_PATHS+ from Padrino.
45
+ #
46
+ # @return [Array<String>]
47
+ # The load paths used by Padrino.
48
+ #
49
+ def load_paths
50
+ @_load_paths_was = %w(lib models shared).map { |path| Padrino.root(path) }
51
+ @_load_paths ||= @_load_paths_was
52
+ end
53
+
54
+ ##
55
+ # Requires necessary dependencies as well as application files from root
56
+ # lib and models.
57
+ #
58
+ # @return [Boolean]
59
+ # returns true if Padrino is not already bootstraped otherwise else.
60
+ #
61
+ def load!
62
+ return false if loaded?
63
+ @_called_from = first_caller
64
+ Padrino.set_encoding
65
+ Padrino.set_load_paths(*load_paths) # We set the padrino load paths
66
+ Padrino::Logger.setup! # Initialize our logger
67
+ Padrino.require_dependencies("#{root}/config/database.rb", :nodeps => true) # Be sure to don't remove constants from dbs.
68
+ Padrino::Reloader.lock! # Now we can remove constant from here to down
69
+ Padrino.before_load.each(&:call) # Run before hooks
70
+ Padrino.dependency_paths.each { |path| Padrino.require_dependencies(path) }
71
+ Padrino.after_load.each(&:call) # Run after hooks
72
+ Padrino::Reloader.run!
73
+ Thread.current[:padrino_loaded] = true
74
+ end
75
+
76
+ ##
77
+ # Clear the padrino env.
78
+ #
79
+ # @return [NilClass]
80
+ #
81
+ def clear!
82
+ Padrino.clear_middleware!
83
+ Padrino.mounted_apps.clear
84
+ @_load_paths = nil
85
+ @_dependency_paths = nil
86
+ @_global_configuration = nil
87
+ Padrino.before_load.clear
88
+ Padrino.after_load.clear
89
+ Padrino::Reloader.clear!
90
+ Thread.current[:padrino_loaded] = nil
91
+ end
92
+
93
+ ##
94
+ # Method for reloading required applications and their files.
95
+ #
96
+ def reload!
97
+ Padrino.before_load.each(&:call) # Run before hooks
98
+ Padrino::Reloader.reload! # detects the modified files
99
+ Padrino.after_load.each(&:call) # Run after hooks
100
+ end
101
+
102
+ ##
103
+ # This adds the ablity to instantiate {Padrino.load!} after
104
+ # {Padrino::Application} definition.
105
+ #
106
+ def called_from
107
+ @_called_from || first_caller
108
+ end
109
+
110
+ ##
111
+ # Determines whether Padrino was loaded with {Padrino.load!}.
112
+ #
113
+ # @return [Boolean]
114
+ # Specifies whether Padrino was loaded.
115
+ #
116
+ def loaded?
117
+ Thread.current[:padrino_loaded]
118
+ end
119
+
120
+ ##
121
+ # Attempts to require all dependency libs that we need.
122
+ # If you use this method we can perform correctly a Padrino.reload!
123
+ # Another good thing that this method are dependency check, for example:
124
+ #
125
+ # # models
126
+ # # \-- a.rb => require something of b.rb
127
+ # # \-- b.rb
128
+ #
129
+ # In the example above if we do:
130
+ #
131
+ # Dir["/models/*.rb"].each { |r| require r }
132
+ #
133
+ # we get an error, because we try to require first +a.rb+ that need
134
+ # _something_ of +b.rb+.
135
+ #
136
+ # With this method we don't have this problem.
137
+ #
138
+ # @param [Array<String>] paths
139
+ # The paths to require.
140
+ #
141
+ # @example For require all our app libs we need to do:
142
+ # require_dependencies("#{Padrino.root}/lib/**/*.rb")
143
+ #
144
+ def require_dependencies(*paths)
145
+ options = paths.extract_options!
146
+
147
+ # Extract all files to load
148
+ files = paths.flatten.map { |path| Dir[path] }.flatten.uniq.sort
149
+
150
+ while files.present?
151
+ # List of errors and failed files
152
+ errors, failed = [], []
153
+
154
+ # We need a size to make sure things are loading
155
+ size_at_start = files.size
156
+
157
+ # Now we try to require our dependencies, we dup files
158
+ # so we don't perform delete on the original array during
159
+ # iteration, this prevent problems with rubinus
160
+ files.dup.each do |file|
161
+ begin
162
+ Padrino::Reloader.safe_load(file, options.dup)
163
+ files.delete(file)
164
+ rescue LoadError => e
165
+ errors << e
166
+ failed << file
167
+ rescue NameError => e
168
+ errors << e
169
+ failed << file
170
+ rescue Exception => e
171
+ raise e
172
+ end
173
+ end
174
+
175
+ # Stop processing if nothing loads or if everything has loaded
176
+ raise errors.last if files.size == size_at_start && files.present?
177
+ break if files.empty?
178
+ end
179
+ end
180
+
181
+ ##
182
+ # Returns default list of path globs to load as dependencies
183
+ # Appends custom dependency patterns to the be loaded for Padrino.
184
+ #
185
+ # @return [Array<String>]
186
+ # The dependencey paths.
187
+ #
188
+ # @example
189
+ # Padrino.dependency_paths << "#{Padrino.root}/uploaders/*.rb"
190
+ #
191
+ def dependency_paths
192
+ @_dependency_paths_was = [
193
+ "#{root}/config/database.rb", "#{root}/lib/**/*.rb", "#{root}/shared/lib/**/*.rb",
194
+ "#{root}/models/**/*.rb", "#{root}/shared/models/**/*.rb", "#{root}/config/apps.rb"
195
+ ]
196
+ @_dependency_paths ||= @_dependency_paths_was
197
+ end
198
+
199
+ ##
200
+ # Concat to +$LOAD_PATH+ the given paths.
201
+ #
202
+ # @param [Array<String>] paths
203
+ # The paths to concat.
204
+ #
205
+ def set_load_paths(*paths)
206
+ $:.concat(paths); load_paths.concat(paths)
207
+ $:.uniq!; load_paths.uniq!
208
+ end
209
+ end # self
210
+ end # Padrino