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.
- data/.gitignore +2 -1
- data/CHANGELOG +16 -8
- data/features/builder.feature +2 -5
- data/features/cache_buster.feature +1 -1
- data/features/clean_build.feature +0 -1
- data/features/coffee-script.feature +3 -3
- data/features/custom_layout_engines.feature +10 -0
- data/features/directory_index.feature +0 -1
- data/features/dynamic_pages.feature +0 -1
- data/features/fonts.feature +0 -1
- data/features/{padrino_helpers.feature → former_padrino_helpers.feature} +1 -1
- data/features/sprockets.feature +34 -5
- data/features/sprockets_gems.feature +7 -4
- data/features/step_definitions/asset_host_steps.rb +7 -6
- data/features/step_definitions/builder_steps.rb +4 -0
- data/features/step_definitions/middleman_steps.rb +22 -16
- data/features/step_definitions/page_layout_steps.rb +10 -8
- data/fixtures/custom-layout-app/config.rb +1 -0
- data/fixtures/custom-layout-app/source/index.html.erb +1 -0
- data/fixtures/custom-layout-app/source/layout.haml +6 -0
- data/fixtures/sprockets-app/config.rb +2 -1
- data/fixtures/sprockets-app/source/library/css/bootstrap_include.css.scss +1 -0
- data/fixtures/sprockets-app/source/library/css/plain.css +3 -0
- data/fixtures/sprockets-app/source/library/css/sprockets_base1.css.scss +1 -0
- data/fixtures/sprockets-app/source/library/css/sprockets_base2.css.scss +1 -0
- data/fixtures/sprockets-app/source/library/css/sprockets_sub.css.scss +1 -0
- data/fixtures/sprockets-app/source/{jquery_include.js → library/js/jquery_include.js} +0 -0
- data/fixtures/sprockets-app/source/library/js/plain.js +3 -0
- data/fixtures/sprockets-app/source/library/{javascripts → js}/sprockets_base.js +0 -0
- data/fixtures/sprockets-app/source/library/{javascripts → js}/sprockets_sub.js +0 -0
- data/fixtures/test-app/config.rb +5 -4
- data/fixtures/test-app/source/{padrino_test.html.haml → former_padrino_test.html.haml} +0 -0
- data/fixtures/test-app/source/stylesheets/sprockets_base1.css.scss +1 -0
- data/fixtures/test-app/source/stylesheets/sprockets_base2.css.scss +1 -0
- data/fixtures/test-app/source/stylesheets/sprockets_sub.css.scss +1 -0
- data/lib/middleman.rb +27 -25
- data/lib/middleman/base.rb +408 -166
- data/lib/middleman/builder.rb +78 -162
- data/lib/middleman/cli.rb +61 -32
- data/lib/middleman/core_extensions/assets.rb +4 -44
- data/lib/middleman/core_extensions/builder.rb +12 -16
- data/lib/middleman/core_extensions/compass.rb +28 -57
- data/lib/middleman/core_extensions/data.rb +65 -49
- data/lib/middleman/core_extensions/default_helpers.rb +33 -18
- data/lib/middleman/core_extensions/features.rb +48 -26
- data/lib/middleman/core_extensions/file_watcher.rb +66 -0
- data/lib/middleman/core_extensions/front_matter.rb +91 -86
- data/lib/middleman/core_extensions/rendering.rb +9 -8
- data/lib/middleman/core_extensions/routing.rb +19 -53
- data/lib/middleman/core_extensions/sitemap.rb +229 -0
- data/lib/middleman/core_extensions/sprockets.rb +53 -37
- data/lib/middleman/features/asset_host.rb +20 -10
- data/lib/middleman/features/automatic_image_sizes.rb +12 -9
- data/lib/middleman/features/cache_buster.rb +38 -25
- data/lib/middleman/features/directory_indexes.rb +31 -28
- data/lib/middleman/features/minify_css.rb +3 -2
- data/lib/middleman/features/minify_css/cssmin.rb +55 -0
- data/lib/middleman/features/minify_javascript.rb +12 -5
- data/lib/middleman/features/relative_assets.rb +28 -25
- data/lib/middleman/features/sitemap_tree.rb +34 -0
- data/lib/middleman/guard.rb +57 -23
- data/lib/middleman/renderers/erb.rb +29 -0
- data/lib/middleman/renderers/liquid.rb +3 -12
- data/lib/middleman/renderers/markdown.rb +16 -15
- data/lib/middleman/renderers/sass.rb +34 -38
- data/lib/middleman/vendor/hooks-0.2.0/CHANGES.textile +9 -0
- data/lib/middleman/vendor/hooks-0.2.0/Gemfile +3 -0
- data/lib/middleman/vendor/hooks-0.2.0/README.rdoc +107 -0
- data/lib/middleman/vendor/hooks-0.2.0/Rakefile +12 -0
- data/lib/middleman/vendor/hooks-0.2.0/hooks.gemspec +22 -0
- data/lib/middleman/vendor/hooks-0.2.0/lib/hooks.rb +109 -0
- data/lib/middleman/vendor/hooks-0.2.0/lib/hooks/inheritable_attribute.rb +33 -0
- data/lib/middleman/vendor/hooks-0.2.0/test/hooks_test.rb +141 -0
- data/lib/middleman/vendor/hooks-0.2.0/test/inheritable_attribute_test.rb +55 -0
- data/lib/middleman/vendor/hooks-0.2.0/test/test_helper.rb +10 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/.document +5 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/.gitignore +22 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/.yardopts +1 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/LICENSE.txt +20 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/README.rdoc +294 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/Rakefile +5 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/bin/padrino +9 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core.rb +167 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/application.rb +270 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/application/rendering.rb +292 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/application/routing.rb +934 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/application/showexceptions.rb +20 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/caller.rb +53 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/cli/adapter.rb +24 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/cli/base.rb +151 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/cli/console.rb +20 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/cli/rake.rb +24 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/cli/rake_tasks.rb +59 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/command.rb +38 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/images/404.png +0 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/images/500.png +0 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/loader.rb +210 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/cs.yml +34 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/da.yml +34 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/de.yml +34 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/en.yml +34 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/es.yml +34 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/fr.yml +34 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/hu.yml +34 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/it.yml +40 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/ja.yml +34 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/lv.yml +34 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/nl.yml +34 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/no.yml +35 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/pl.yml +34 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/pt_br.yml +40 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/ru.yml +35 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/tr.yml +34 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/uk.yml +34 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/zh_cn.yml +34 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/locale/zh_tw.yml +34 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/logger.rb +345 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/mounter.rb +224 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/reloader.rb +254 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/router.rb +98 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/server.rb +79 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/support_lite.rb +199 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/tasks.rb +21 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/lib/padrino-core/version.rb +20 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/padrino-core.gemspec +38 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/apps/.components +6 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/apps/.gitignore +7 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/apps/complex.rb +32 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/apps/simple.rb +33 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/a.rb +9 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/b.rb +4 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/c.rb +1 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/circular/e.rb +13 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/circular/f.rb +2 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/circular/g.rb +2 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/fixtures/dependencies/d.rb +4 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/helper.rb +81 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/mini_shoulda.rb +45 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/test_application.rb +108 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/test_core.rb +79 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/test_dependencies.rb +44 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/test_filters.rb +278 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/test_locale.rb +21 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/test_logger.rb +100 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/test_mounter.rb +177 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/test_reloader_complex.rb +75 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/test_reloader_simple.rb +98 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/test_rendering.rb +461 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/test_restful_routing.rb +33 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/test_router.rb +146 -0
- data/lib/middleman/vendor/padrino-core-0.10.5/test/test_routing.rb +1673 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/.document +5 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/.gitignore +21 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/.yardopts +1 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/LICENSE.txt +20 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/README.rdoc +239 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/Rakefile +5 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers.rb +58 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/asset_tag_helpers.rb +420 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/form_builder/abstract_form_builder.rb +220 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/form_builder/standard_form_builder.rb +43 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/form_helpers.rb +602 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/format_helpers.rb +381 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/cs.yml +103 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/da.yml +91 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/de.yml +81 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/en.yml +103 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/es.yml +103 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/fr.yml +80 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/hu.yml +103 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/it.yml +89 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/ja.yml +103 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/lv.yml +103 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/nl.yml +82 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/no.yml +91 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/pl.yml +95 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/pt_br.yml +103 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/ru.yml +103 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/tr.yml +103 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/uk.yml +103 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/zh_cn.yml +104 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/locale/zh_tw.yml +103 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/number_helpers.rb +288 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/output_helpers.rb +175 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/output_helpers/abstract_handler.rb +98 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/output_helpers/erb_handler.rb +79 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/output_helpers/haml_handler.rb +63 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/output_helpers/slim_handler.rb +81 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/render_helpers.rb +60 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/tag_helpers.rb +103 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/lib/padrino-helpers/translation_helpers.rb +38 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/padrino-helpers.gemspec +27 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/app.rb +73 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/capture_concat.erb +14 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/capture_concat.haml +12 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/capture_concat.slim +13 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_for.erb +14 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_for.haml +12 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_for.slim +12 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_tag.erb +11 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_tag.haml +9 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/content_tag.slim +9 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/current_engine.erb +5 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/current_engine.haml +5 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/current_engine.slim +5 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/fields_for.erb +20 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/fields_for.haml +15 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/fields_for.slim +15 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_for.erb +56 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_for.haml +47 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_for.slim +47 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_tag.erb +56 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_tag.haml +45 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/form_tag.slim +45 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/link_to.erb +5 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/link_to.haml +4 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/link_to.slim +4 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/mail_to.erb +3 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/mail_to.haml +3 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/mail_to.slim +3 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/meta_tag.erb +3 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/meta_tag.haml +3 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/meta_tag.slim +3 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/partials/_erb.erb +1 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/partials/_haml.haml +1 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/partials/_slim.slim +1 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/simple_partial.erb +1 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/simple_partial.haml +1 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/markup_app/views/simple_partial.slim +1 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/app.rb +50 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/current_engine.haml +5 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/current_engines/_erb.erb +1 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/current_engines/_haml.haml +1 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/current_engines/_slim.slim +1 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/erb/test.erb +1 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/explicit_engine.haml +5 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/haml/test.haml +1 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/template/_user.haml +7 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/template/haml_template.haml +1 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/fixtures/render_app/views/template/some_template.haml +2 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/helper.rb +66 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_asset_tag_helpers.rb +320 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_form_builder.rb +996 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_form_helpers.rb +645 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_format_helpers.rb +227 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_locale.rb +20 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_number_helpers.rb +136 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_output_helpers.rb +153 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_render_helpers.rb +76 -0
- data/lib/middleman/vendor/padrino-helpers-0.10.5/test/test_tag_helpers.rb +105 -0
- data/lib/middleman/version.rb +1 -1
- data/middleman-x86-mingw32.gemspec +16 -33
- data/middleman.gemspec +16 -31
- metadata +590 -349
- data/features/sinatra.feature +0 -6
- data/lib/middleman/core_extensions/rack_map.rb +0 -35
- data/lib/middleman/renderers/coffee_script.rb +0 -8
- data/lib/middleman/renderers/haml.rb +0 -31
- data/lib/middleman/renderers/slim.rb +0 -8
@@ -0,0 +1,9 @@
|
|
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)
|
@@ -0,0 +1,167 @@
|
|
1
|
+
require 'sinatra/base'
|
2
|
+
require 'padrino-core/support_lite' unless defined?(SupportLite)
|
3
|
+
|
4
|
+
FileSet.glob_require('padrino-core/application/*.rb', __FILE__)
|
5
|
+
FileSet.glob_require('padrino-core/*.rb', __FILE__)
|
6
|
+
|
7
|
+
# The Padrino environment (falls back to the rack env or finally develop)
|
8
|
+
PADRINO_ENV = ENV["PADRINO_ENV"] ||= ENV["RACK_ENV"] ||= "development" unless defined?(PADRINO_ENV)
|
9
|
+
# The Padrino project root path (falls back to the first caller)
|
10
|
+
PADRINO_ROOT = ENV["PADRINO_ROOT"] ||= File.dirname(Padrino.first_caller) unless defined?(PADRINO_ROOT)
|
11
|
+
|
12
|
+
module Padrino
|
13
|
+
class ApplicationLoadError < RuntimeError # @private
|
14
|
+
end
|
15
|
+
|
16
|
+
class << self
|
17
|
+
##
|
18
|
+
# Helper method for file references.
|
19
|
+
#
|
20
|
+
# @param [Array<String>] args
|
21
|
+
# The directories to join to {PADRINO_ROOT}.
|
22
|
+
#
|
23
|
+
# @return [String]
|
24
|
+
# The absolute path.
|
25
|
+
#
|
26
|
+
# @example
|
27
|
+
# # Referencing a file in config called settings.yml
|
28
|
+
# Padrino.root("config", "settings.yml")
|
29
|
+
# # returns PADRINO_ROOT + "/config/setting.yml"
|
30
|
+
#
|
31
|
+
def root(*args)
|
32
|
+
File.expand_path(File.join(PADRINO_ROOT, *args))
|
33
|
+
end
|
34
|
+
|
35
|
+
##
|
36
|
+
# Helper method that return {PADRINO_ENV}.
|
37
|
+
#
|
38
|
+
# @return [Symbol]
|
39
|
+
# The Padrino Environment.
|
40
|
+
#
|
41
|
+
def env
|
42
|
+
@_env ||= PADRINO_ENV.to_s.downcase.to_sym
|
43
|
+
end
|
44
|
+
|
45
|
+
##
|
46
|
+
# The resulting rack builder mapping each 'mounted' application.
|
47
|
+
#
|
48
|
+
# @return [Padrino::Router]
|
49
|
+
# The router for the application.
|
50
|
+
#
|
51
|
+
# @raise [ApplicationLoadError]
|
52
|
+
# No applications were mounted.
|
53
|
+
#
|
54
|
+
def application
|
55
|
+
raise ApplicationLoadError, "At least one app must be mounted!" unless Padrino.mounted_apps && Padrino.mounted_apps.any?
|
56
|
+
router = Padrino::Router.new
|
57
|
+
Padrino.mounted_apps.each { |app| app.map_onto(router) }
|
58
|
+
|
59
|
+
if middleware.present?
|
60
|
+
builder = Rack::Builder.new
|
61
|
+
middleware.each { |c,a,b| builder.use(c, *a, &b) }
|
62
|
+
builder.run(router)
|
63
|
+
builder.to_app
|
64
|
+
else
|
65
|
+
router
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
##
|
70
|
+
# Configure Global Project Settings for mounted apps. These can be overloaded
|
71
|
+
# in each individual app's own personal configuration. This can be used like:
|
72
|
+
#
|
73
|
+
# @yield []
|
74
|
+
# The given block will be called to configure each application.
|
75
|
+
#
|
76
|
+
# @example
|
77
|
+
# Padrino.configure_apps do
|
78
|
+
# enable :sessions
|
79
|
+
# disable :raise_errors
|
80
|
+
# end
|
81
|
+
#
|
82
|
+
def configure_apps(&block)
|
83
|
+
@_global_configuration = block if block_given?
|
84
|
+
end
|
85
|
+
|
86
|
+
##
|
87
|
+
# Returns project-wide configuration settings defined in
|
88
|
+
# {configure_apps} block.
|
89
|
+
#
|
90
|
+
def apps_configuration
|
91
|
+
@_global_configuration
|
92
|
+
end
|
93
|
+
|
94
|
+
##
|
95
|
+
# Set +Encoding.default_internal+ and +Encoding.default_external+
|
96
|
+
# to +Encoding::UFT_8+.
|
97
|
+
#
|
98
|
+
# Please note that in +1.9.2+ with some template engines like +haml+
|
99
|
+
# you should turn off Encoding.default_internal to prevent problems.
|
100
|
+
#
|
101
|
+
# @see https://github.com/rtomayko/tilt/issues/75
|
102
|
+
#
|
103
|
+
# @return [NilClass]
|
104
|
+
#
|
105
|
+
def set_encoding
|
106
|
+
if RUBY_VERSION < '1.9'
|
107
|
+
$KCODE='u'
|
108
|
+
else
|
109
|
+
Encoding.default_external = Encoding::UTF_8
|
110
|
+
Encoding.default_internal = Encoding::UTF_8
|
111
|
+
end
|
112
|
+
nil
|
113
|
+
end
|
114
|
+
|
115
|
+
##
|
116
|
+
# Determines whether the dependencies are locked by Bundler.
|
117
|
+
# otherwise return nil
|
118
|
+
#
|
119
|
+
# @return [:locked, :unlocked, nil]
|
120
|
+
# Returns +:locked+ if the +Gemfile.lock+ file exists, or +:unlocked+
|
121
|
+
# if only the +Gemfile+ exists.
|
122
|
+
#
|
123
|
+
# @deprecated Will be removed in 1.0.0
|
124
|
+
#
|
125
|
+
def bundle
|
126
|
+
return :locked if File.exist?(root('Gemfile.lock'))
|
127
|
+
return :unlocked if File.exist?(root("Gemfile"))
|
128
|
+
end
|
129
|
+
|
130
|
+
##
|
131
|
+
# A Rack::Builder object that allows to add middlewares in front of all
|
132
|
+
# Padrino applications.
|
133
|
+
#
|
134
|
+
# @return [Array<Array<Class, Array, Proc>>]
|
135
|
+
# The middleware classes.
|
136
|
+
#
|
137
|
+
def middleware
|
138
|
+
@middleware ||= []
|
139
|
+
end
|
140
|
+
|
141
|
+
##
|
142
|
+
# Clears all previously configured middlewares.
|
143
|
+
#
|
144
|
+
# @return [Array]
|
145
|
+
# An empty array
|
146
|
+
#
|
147
|
+
def clear_middleware!
|
148
|
+
@middleware = []
|
149
|
+
end
|
150
|
+
|
151
|
+
##
|
152
|
+
# Convenience method for adding a Middleware to the whole padrino app.
|
153
|
+
#
|
154
|
+
# @param [Class] m
|
155
|
+
# The middleware class.
|
156
|
+
#
|
157
|
+
# @param [Array] args
|
158
|
+
# The arguments for the middleware.
|
159
|
+
#
|
160
|
+
# @yield []
|
161
|
+
# The given block will be passed to the initialized middleware.
|
162
|
+
#
|
163
|
+
def use(m, *args, &block)
|
164
|
+
middleware << [m, args, block]
|
165
|
+
end
|
166
|
+
end # self
|
167
|
+
end # Padrino
|
@@ -0,0 +1,270 @@
|
|
1
|
+
module Padrino
|
2
|
+
class ApplicationSetupError < RuntimeError # @private
|
3
|
+
end
|
4
|
+
|
5
|
+
##
|
6
|
+
# Subclasses of this become independent Padrino applications (stemming from Sinatra::Application)
|
7
|
+
# These subclassed applications can be easily mounted into other Padrino applications as well.
|
8
|
+
#
|
9
|
+
class Application < Sinatra::Base
|
10
|
+
# Support for advanced routing, controllers, url_for
|
11
|
+
register Padrino::Routing
|
12
|
+
|
13
|
+
##
|
14
|
+
# Returns the logger for this application.
|
15
|
+
#
|
16
|
+
# @return [Padrino::Logger] Logger associated with this app.
|
17
|
+
#
|
18
|
+
def logger
|
19
|
+
Padrino.logger
|
20
|
+
end
|
21
|
+
|
22
|
+
class << self
|
23
|
+
|
24
|
+
def inherited(base) # @private
|
25
|
+
logger.devel "Setup #{base}"
|
26
|
+
CALLERS_TO_IGNORE.concat(PADRINO_IGNORE_CALLERS)
|
27
|
+
base.default_configuration!
|
28
|
+
base.prerequisites.concat([
|
29
|
+
File.join(base.root, "/models.rb"),
|
30
|
+
File.join(base.root, "/models/**/*.rb"),
|
31
|
+
File.join(base.root, "/lib.rb"),
|
32
|
+
File.join(base.root, "/lib/**/*.rb")
|
33
|
+
]).uniq!
|
34
|
+
Padrino.require_dependencies(base.prerequisites)
|
35
|
+
super(base) # Loading the subclass inherited method
|
36
|
+
end
|
37
|
+
|
38
|
+
##
|
39
|
+
# Reloads the application files from all defined load paths
|
40
|
+
#
|
41
|
+
# This method is used from our Padrino Reloader during development mode
|
42
|
+
# in order to reload the source files.
|
43
|
+
#
|
44
|
+
# @return [TrueClass]
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
# MyApp.reload!
|
48
|
+
#
|
49
|
+
def reload!
|
50
|
+
logger.devel "Reloading #{self}"
|
51
|
+
@_dependencies = nil # Reset dependencies
|
52
|
+
reset! # Reset sinatra app
|
53
|
+
reset_router! # Reset all routes
|
54
|
+
Padrino.require_dependencies(self.app_file, :force => true) # Reload the app file
|
55
|
+
require_dependencies # Reload dependencies
|
56
|
+
default_filters! # Reload filters
|
57
|
+
default_routes! # Reload default routes
|
58
|
+
default_errors! # Reload our errors
|
59
|
+
I18n.reload! if defined?(I18n) # Reload also our translations
|
60
|
+
true
|
61
|
+
end
|
62
|
+
|
63
|
+
##
|
64
|
+
# Resets application routes to only routes not defined by the user
|
65
|
+
#
|
66
|
+
# @return [TrueClass]
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
# MyApp.reset_routes!
|
70
|
+
#
|
71
|
+
def reset_routes!
|
72
|
+
reset_router!
|
73
|
+
default_routes!
|
74
|
+
true
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# Returns the routes of our app.
|
79
|
+
#
|
80
|
+
# @example
|
81
|
+
# MyApp.routes
|
82
|
+
#
|
83
|
+
def routes
|
84
|
+
router.routes
|
85
|
+
end
|
86
|
+
|
87
|
+
##
|
88
|
+
# Setup the application by registering initializers, load paths and logger
|
89
|
+
# Invoked automatically when an application is first instantiated
|
90
|
+
#
|
91
|
+
# @return [TrueClass]
|
92
|
+
#
|
93
|
+
def setup_application!
|
94
|
+
return if @_configured
|
95
|
+
self.require_dependencies
|
96
|
+
self.default_filters!
|
97
|
+
self.default_routes!
|
98
|
+
self.default_errors!
|
99
|
+
if defined?(I18n)
|
100
|
+
I18n.load_path << self.locale_path
|
101
|
+
I18n.reload!
|
102
|
+
end
|
103
|
+
@_configured = true
|
104
|
+
@_configured
|
105
|
+
end
|
106
|
+
|
107
|
+
##
|
108
|
+
# Run the Padrino app as a self-hosted server using
|
109
|
+
# Thin, Mongrel or WEBrick (in that order)
|
110
|
+
#
|
111
|
+
# @see Padrino::Server#start
|
112
|
+
#
|
113
|
+
def run!(options={})
|
114
|
+
return unless Padrino.load!
|
115
|
+
Padrino.mount(self.to_s).to("/")
|
116
|
+
Padrino.run!(options)
|
117
|
+
end
|
118
|
+
|
119
|
+
##
|
120
|
+
# @return [Array]
|
121
|
+
# directory that need to be added to +$LOAD_PATHS+ from this application
|
122
|
+
#
|
123
|
+
def load_paths
|
124
|
+
@_load_paths ||= %w(models lib mailers controllers helpers).map { |path| File.join(self.root, path) }
|
125
|
+
end
|
126
|
+
|
127
|
+
##
|
128
|
+
# Returns default list of path globs to load as dependencies
|
129
|
+
# Appends custom dependency patterns to the be loaded for your Application
|
130
|
+
#
|
131
|
+
# @return [Array]
|
132
|
+
# list of path globs to load as dependencies
|
133
|
+
#
|
134
|
+
# @example
|
135
|
+
# MyApp.dependencies << "#{Padrino.root}/uploaders/**/*.rb"
|
136
|
+
# MyApp.dependencies << Padrino.root('other_app', 'controllers.rb')
|
137
|
+
#
|
138
|
+
def dependencies
|
139
|
+
@_dependencies ||= [
|
140
|
+
"urls.rb", "config/urls.rb", "mailers/*.rb", "mailers.rb",
|
141
|
+
"controllers/**/*.rb", "controllers.rb", "helpers/**/*.rb", "helpers.rb"
|
142
|
+
].map { |file| Dir[File.join(self.root, file)] }.flatten
|
143
|
+
end
|
144
|
+
|
145
|
+
##
|
146
|
+
# An array of file to load before your app.rb, basically are files wich our app depends on.
|
147
|
+
#
|
148
|
+
# By default we look for files:
|
149
|
+
#
|
150
|
+
# # List of default files that we are looking for:
|
151
|
+
# yourapp/models.rb
|
152
|
+
# yourapp/models/**/*.rb
|
153
|
+
# yourapp/lib.rb
|
154
|
+
# yourapp/lib/**/*.rb
|
155
|
+
#
|
156
|
+
# @example Adding a custom perequisite
|
157
|
+
# MyApp.prerequisites << Padrino.root('my_app', 'custom_model.rb')
|
158
|
+
#
|
159
|
+
def prerequisites
|
160
|
+
@_prerequisites ||= []
|
161
|
+
end
|
162
|
+
|
163
|
+
protected
|
164
|
+
##
|
165
|
+
# Defines default settings for Padrino application
|
166
|
+
#
|
167
|
+
def default_configuration!
|
168
|
+
# Overwriting Sinatra defaults
|
169
|
+
set :app_file, File.expand_path(caller_files.first || $0) # Assume app file is first caller
|
170
|
+
set :environment, Padrino.env
|
171
|
+
set :reload, Proc.new { development? }
|
172
|
+
set :logging, Proc.new { development? }
|
173
|
+
set :method_override, true
|
174
|
+
set :sessions, false
|
175
|
+
set :public_folder, Proc.new { Padrino.root('public', uri_root) }
|
176
|
+
set :views, Proc.new { File.join(root, "views") }
|
177
|
+
set :images_path, Proc.new { File.join(public, "images") }
|
178
|
+
set :protection, false
|
179
|
+
# Padrino specific
|
180
|
+
set :uri_root, "/"
|
181
|
+
set :app_name, self.to_s.underscore.to_sym
|
182
|
+
set :default_builder, 'StandardFormBuilder'
|
183
|
+
set :flash, defined?(Sinatra::Flash) || defined?(Rack::Flash)
|
184
|
+
set :authentication, false
|
185
|
+
# Padrino locale
|
186
|
+
set :locale_path, Proc.new { Dir[File.join(self.root, "/locale/**/*.{rb,yml}")] }
|
187
|
+
# Load the Global Configurations
|
188
|
+
class_eval(&Padrino.apps_configuration) if Padrino.apps_configuration
|
189
|
+
end
|
190
|
+
|
191
|
+
##
|
192
|
+
# We need to add almost __sinatra__ images.
|
193
|
+
#
|
194
|
+
def default_routes!
|
195
|
+
configure :development do
|
196
|
+
get '*__sinatra__/:image.png' do
|
197
|
+
content_type :png
|
198
|
+
filename = File.dirname(__FILE__) + "/images/#{params[:image]}.png"
|
199
|
+
send_file filename
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
|
204
|
+
##
|
205
|
+
# This filter it's used for know the format of the request, and automatically set the content type.
|
206
|
+
#
|
207
|
+
def default_filters!
|
208
|
+
before do
|
209
|
+
unless @_content_type
|
210
|
+
@_content_type = :html
|
211
|
+
response['Content-Type'] = 'text/html;charset=utf-8'
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
##
|
217
|
+
# This log errors for production environments
|
218
|
+
#
|
219
|
+
def default_errors!
|
220
|
+
configure :production do
|
221
|
+
error ::Exception do
|
222
|
+
boom = env['sinatra.error']
|
223
|
+
logger.error ["#{boom.class} - #{boom.message}:", *boom.backtrace].join("\n ")
|
224
|
+
response.status = 500
|
225
|
+
content_type 'text/html'
|
226
|
+
'<h1>Internal Server Error</h1>'
|
227
|
+
end unless errors.has_key?(::Exception)
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
##
|
232
|
+
# Requires all files within the application load paths
|
233
|
+
#
|
234
|
+
def require_dependencies
|
235
|
+
Padrino.set_load_paths(*load_paths)
|
236
|
+
Padrino.require_dependencies(dependencies, :force => true)
|
237
|
+
end
|
238
|
+
|
239
|
+
private
|
240
|
+
|
241
|
+
# Overrides the default middleware for Sinatra based on Padrino conventions
|
242
|
+
# Also initializes the application after setting up the middleware
|
243
|
+
def setup_default_middleware(builder)
|
244
|
+
setup_sessions builder
|
245
|
+
setup_flash builder
|
246
|
+
builder.use Padrino::ShowExceptions if show_exceptions?
|
247
|
+
builder.use Padrino::Logger::Rack, uri_root if Padrino.logger && logging?
|
248
|
+
builder.use Padrino::Reloader::Rack if reload?
|
249
|
+
builder.use Rack::MethodOverride if method_override?
|
250
|
+
builder.use Rack::Head
|
251
|
+
setup_protection builder
|
252
|
+
setup_application!
|
253
|
+
end
|
254
|
+
|
255
|
+
# TODO Remove this in a few versions (rack-flash deprecation)
|
256
|
+
# Move register Sinatra::Flash into setup_default_middleware
|
257
|
+
# Initializes flash using sinatra-flash or rack-flash
|
258
|
+
def setup_flash(builder)
|
259
|
+
register Sinatra::Flash if flash? && defined?(Sinatra::Flash)
|
260
|
+
if defined?(Rack::Flash) && !defined?(Sinatra::Flash)
|
261
|
+
logger.warn %Q{
|
262
|
+
[Deprecation] In Gemfile, 'rack-flash' should be replaced with 'sinatra-flash'!
|
263
|
+
Rack-Flash is not compatible with later versions of Rack and should be replaced.
|
264
|
+
}
|
265
|
+
builder.use Rack::Flash, :sweep => true if flash?
|
266
|
+
end
|
267
|
+
end
|
268
|
+
end # self
|
269
|
+
end # Application
|
270
|
+
end # Padrino
|