middleman-core 3.0.0.beta.2 → 3.0.0.beta.3
Sign up to get free protection for your applications and to get access to all the features.
- data/features/cli_extension.feature +13 -0
- data/features/{cli.feature → cli_init.feature} +1 -10
- data/features/directory_index.feature +29 -1
- data/features/dynamic_pages.feature +1 -0
- data/features/extensionless_text_files.feature +0 -2
- data/features/front-matter.feature +17 -1
- data/features/frontmatter_page_settings.feature +16 -1
- data/features/helpers_relative_link_to.feature +68 -0
- data/features/unicode_filenames.feature +14 -0
- data/fixtures/csspie/config.rb +0 -0
- data/fixtures/csspie/source/stylesheets/PIE.htc +96 -0
- data/fixtures/dynamic-pages-app/config.rb +3 -0
- data/fixtures/frontmatter-app/source/front-matter-auto.erb +6 -0
- data/fixtures/frontmatter-app/source/front-matter.html.erb +2 -0
- data/fixtures/frontmatter-app/source/json-front-matter-2.php.erb +7 -0
- data/fixtures/frontmatter-app/source/json-front-matter-auto.erb +6 -0
- data/fixtures/frontmatter-app/source/json-front-matter.html.erb +6 -0
- data/fixtures/unicode-filenames-app/config.rb +1 -0
- data/fixtures/unicode-filenames-app/source/snowmen-rule-/342/230/203.html +4 -0
- data/lib/middleman-core/application.rb +43 -335
- data/lib/middleman-core/cli/build.rb +11 -4
- data/lib/middleman-core/cli/bundler.rb +40 -0
- data/lib/middleman-core/cli/extension.rb +36 -0
- data/lib/middleman-core/cli/server.rb +2 -2
- data/lib/middleman-core/cli.rb +2 -6
- data/lib/middleman-core/core_extensions/assets.rb +35 -31
- data/lib/middleman-core/core_extensions/builder.rb +14 -9
- data/lib/middleman-core/core_extensions/data.rb +150 -145
- data/lib/middleman-core/core_extensions/default_helpers.rb +159 -97
- data/lib/middleman-core/core_extensions/extensions.rb +103 -97
- data/lib/middleman-core/core_extensions/external_helpers.rb +27 -23
- data/lib/middleman-core/core_extensions/file_watcher.rb +140 -110
- data/lib/middleman-core/core_extensions/front_matter.rb +155 -175
- data/lib/middleman-core/core_extensions/i18n.rb +111 -102
- data/lib/middleman-core/core_extensions/rendering.rb +293 -295
- data/lib/middleman-core/core_extensions/request.rb +338 -0
- data/lib/middleman-core/core_extensions/routing.rb +72 -68
- data/lib/middleman-core/core_extensions/show_exceptions.rb +23 -18
- data/lib/middleman-core/core_extensions.rb +39 -0
- data/lib/middleman-core/extensions/directory_indexes.rb +1 -4
- data/lib/middleman-core/extensions/lorem.rb +10 -3
- data/lib/middleman-core/extensions.rb +2 -64
- data/lib/middleman-core/preview_server.rb +157 -0
- data/lib/middleman-core/sitemap/extensions/ignores.rb +73 -68
- data/lib/middleman-core/sitemap/extensions/on_disk.rb +65 -58
- data/lib/middleman-core/sitemap/extensions/proxies.rb +86 -75
- data/lib/middleman-core/sitemap/extensions/traversal.rb +68 -61
- data/lib/middleman-core/sitemap/resource.rb +123 -102
- data/lib/middleman-core/sitemap/store.rb +170 -149
- data/lib/middleman-core/sitemap.rb +57 -57
- data/lib/middleman-core/step_definitions/server_steps.rb +13 -3
- data/lib/middleman-core/templates/extension/Gemfile +4 -0
- data/lib/middleman-core/templates/extension/Rakefile +12 -0
- data/lib/middleman-core/templates/extension/features/support/env.rb +4 -0
- data/lib/middleman-core/templates/extension/gemspec +24 -0
- data/lib/middleman-core/templates/extension/lib/lib.rb +49 -0
- data/lib/middleman-core/templates/extension/lib/middleman_extension.rb +1 -0
- data/lib/middleman-core/templates/shared/gitignore +14 -0
- data/lib/middleman-core/templates.rb +14 -8
- data/lib/middleman-core/util.rb +31 -9
- data/lib/middleman-core/version.rb +1 -1
- data/lib/middleman-core.rb +6 -4
- data/middleman-core.gemspec +4 -6
- metadata +62 -203
- data/lib/middleman-core/vendor/padrino-core-0.10.6/.document +0 -5
- data/lib/middleman-core/vendor/padrino-core-0.10.6/.gitignore +0 -22
- data/lib/middleman-core/vendor/padrino-core-0.10.6/.yardopts +0 -1
- data/lib/middleman-core/vendor/padrino-core-0.10.6/LICENSE.txt +0 -20
- data/lib/middleman-core/vendor/padrino-core-0.10.6/README.rdoc +0 -294
- data/lib/middleman-core/vendor/padrino-core-0.10.6/Rakefile +0 -5
- data/lib/middleman-core/vendor/padrino-core-0.10.6/bin/padrino +0 -9
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/rendering.rb +0 -292
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/routing.rb +0 -943
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application/showexceptions.rb +0 -20
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/application.rb +0 -269
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/caller.rb +0 -53
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/adapter.rb +0 -24
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/base.rb +0 -150
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/console.rb +0 -20
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/rake.rb +0 -24
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/cli/rake_tasks.rb +0 -59
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/command.rb +0 -38
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/images/404.png +0 -0
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/images/500.png +0 -0
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/loader.rb +0 -211
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/cs.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/da.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/de.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/en.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/es.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/fr.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/hu.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/it.yml +0 -40
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/ja.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/lv.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/nl.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/no.yml +0 -35
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/pl.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/pt_br.yml +0 -40
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/ru.yml +0 -35
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/tr.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/uk.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/zh_cn.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/locale/zh_tw.yml +0 -34
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/logger.rb +0 -428
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/mounter.rb +0 -224
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/reloader.rb +0 -254
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/router.rb +0 -98
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/server.rb +0 -79
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/support_lite.rb +0 -199
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/tasks.rb +0 -21
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core/version.rb +0 -20
- data/lib/middleman-core/vendor/padrino-core-0.10.6/lib/padrino-core.rb +0 -152
- data/lib/middleman-core/vendor/padrino-core-0.10.6/padrino-core.gemspec +0 -38
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/.components +0 -6
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/.gitignore +0 -7
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/complex.rb +0 -32
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/apps/simple.rb +0 -33
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/a.rb +0 -9
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/b.rb +0 -4
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/c.rb +0 -1
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/e.rb +0 -13
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/f.rb +0 -2
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/circular/g.rb +0 -2
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/fixtures/dependencies/d.rb +0 -4
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/helper.rb +0 -83
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/mini_shoulda.rb +0 -45
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_application.rb +0 -108
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_core.rb +0 -77
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_dependencies.rb +0 -44
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_filters.rb +0 -278
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_locale.rb +0 -21
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_logger.rb +0 -154
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_mounter.rb +0 -177
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_reloader_complex.rb +0 -75
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_reloader_simple.rb +0 -98
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_rendering.rb +0 -461
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_restful_routing.rb +0 -33
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_router.rb +0 -146
- data/lib/middleman-core/vendor/padrino-core-0.10.6/test/test_routing.rb +0 -1680
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.document +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.gitignore +0 -21
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/.yardopts +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/LICENSE.txt +0 -20
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/README.rdoc +0 -239
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/Rakefile +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/asset_tag_helpers.rb +0 -417
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_builder/abstract_form_builder.rb +0 -251
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_builder/standard_form_builder.rb +0 -43
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/form_helpers.rb +0 -787
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/format_helpers.rb +0 -381
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/cs.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/da.yml +0 -91
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/de.yml +0 -81
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/en.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/es.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/fr.yml +0 -80
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/hu.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/it.yml +0 -89
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/ja.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/lv.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/nl.yml +0 -82
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/no.yml +0 -91
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/pl.yml +0 -95
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/pt_br.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/ru.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/tr.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/uk.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/zh_cn.yml +0 -104
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/locale/zh_tw.yml +0 -103
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/number_helpers.rb +0 -288
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/abstract_handler.rb +0 -98
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/erb_handler.rb +0 -79
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/haml_handler.rb +0 -63
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers/slim_handler.rb +0 -81
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/output_helpers.rb +0 -175
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/render_helpers.rb +0 -60
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/tag_helpers.rb +0 -260
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers/translation_helpers.rb +0 -38
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/lib/padrino-helpers.rb +0 -59
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/padrino-helpers.gemspec +0 -27
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/app.rb +0 -73
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.erb +0 -14
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.haml +0 -12
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/capture_concat.slim +0 -13
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.erb +0 -14
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.haml +0 -12
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_for.slim +0 -12
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.erb +0 -11
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.haml +0 -9
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/content_tag.slim +0 -9
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.erb +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.haml +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/current_engine.slim +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.erb +0 -20
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.haml +0 -15
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/fields_for.slim +0 -15
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.erb +0 -72
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.haml +0 -59
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_for.slim +0 -59
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.erb +0 -86
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.haml +0 -70
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/form_tag.slim +0 -70
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.erb +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.haml +0 -4
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/link_to.slim +0 -4
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.erb +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.haml +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/mail_to.slim +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.erb +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.haml +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/meta_tag.slim +0 -3
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_erb.erb +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_haml.haml +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/partials/_slim.slim +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.erb +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.haml +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/markup_app/views/simple_partial.slim +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/app.rb +0 -50
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engine.haml +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_erb.erb +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_haml.haml +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/current_engines/_slim.slim +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/erb/test.erb +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/explicit_engine.haml +0 -5
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/haml/test.haml +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/_user.haml +0 -7
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/haml_template.haml +0 -1
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/fixtures/render_app/views/template/some_template.haml +0 -2
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/helper.rb +0 -66
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_asset_tag_helpers.rb +0 -328
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_builder.rb +0 -1106
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_form_helpers.rb +0 -770
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_format_helpers.rb +0 -227
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_locale.rb +0 -20
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_number_helpers.rb +0 -139
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_output_helpers.rb +0 -153
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_render_helpers.rb +0 -76
- data/lib/middleman-core/vendor/padrino-helpers-0.10.6/test/test_tag_helpers.rb +0 -106
- data/lib/middleman-core/watcher.rb +0 -196
@@ -1,199 +0,0 @@
|
|
1
|
-
##
|
2
|
-
# This file loads certain extensions required by Padrino from ActiveSupport.
|
3
|
-
#
|
4
|
-
require 'active_support/core_ext/module/aliasing' # alias_method_chain
|
5
|
-
require 'active_support/core_ext/hash/keys' # symbolize_keys
|
6
|
-
require 'active_support/core_ext/hash/reverse_merge' # reverse_merge
|
7
|
-
require 'active_support/core_ext/hash/slice' # slice
|
8
|
-
require 'active_support/core_ext/object/blank' # present?
|
9
|
-
require 'active_support/core_ext/array/extract_options' # extract_options
|
10
|
-
require 'active_support/inflector/methods' # constantize
|
11
|
-
require 'active_support/inflector/inflections' # pluralize
|
12
|
-
require 'active_support/inflections' # load default inflections
|
13
|
-
require 'yaml' unless defined?(YAML) # load yaml for i18n
|
14
|
-
require 'win32console' if RUBY_PLATFORM =~ /(win|m)32/ # ruby color support for win
|
15
|
-
|
16
|
-
##
|
17
|
-
# This is an adapted version of active_support/core_ext/string/inflections.rb
|
18
|
-
# to prevent loading several dependencies including I18n gem.
|
19
|
-
#
|
20
|
-
# Issue: https://github.com/rails/rails/issues/1526
|
21
|
-
#
|
22
|
-
class String
|
23
|
-
##
|
24
|
-
# Returns the plural form of the word in the string.
|
25
|
-
#
|
26
|
-
# "post".pluralize # => "posts"
|
27
|
-
# "octopus".pluralize # => "octopi"
|
28
|
-
# "sheep".pluralize # => "sheep"
|
29
|
-
# "words".pluralize # => "words"
|
30
|
-
# "the blue mailman".pluralize # => "the blue mailmen"
|
31
|
-
# "CamelOctopus".pluralize # => "CamelOctopi"
|
32
|
-
#
|
33
|
-
def pluralize
|
34
|
-
ActiveSupport::Inflector.pluralize(self)
|
35
|
-
end
|
36
|
-
|
37
|
-
##
|
38
|
-
# Returns the singular form of the word in the string.
|
39
|
-
#
|
40
|
-
# "posts".singularize # => "post"
|
41
|
-
# "octopi".singularize # => "octopus"
|
42
|
-
# "sheep".singularize # => "sheep"
|
43
|
-
# "words".singularize # => "word"
|
44
|
-
# "the blue mailmen".singularize # => "the blue mailman"
|
45
|
-
# "CamelOctopi".singularize # => "CamelOctopus"
|
46
|
-
#
|
47
|
-
def singularize
|
48
|
-
ActiveSupport::Inflector.singularize(self)
|
49
|
-
end
|
50
|
-
|
51
|
-
##
|
52
|
-
# +constantize+ tries to find a declared constant with the name specified
|
53
|
-
# in the string. It raises a NameError when the name is not in CamelCase
|
54
|
-
# or is not initialized.
|
55
|
-
#
|
56
|
-
# "Module".constantize # => Module
|
57
|
-
# "Class".constantize # => Class
|
58
|
-
#
|
59
|
-
def constantize
|
60
|
-
ActiveSupport::Inflector.constantize(self)
|
61
|
-
end
|
62
|
-
|
63
|
-
##
|
64
|
-
# The reverse of +camelize+. Makes an underscored, lowercase form from the expression in the string.
|
65
|
-
#
|
66
|
-
# +underscore+ will also change '::' to '/' to convert namespaces to paths.
|
67
|
-
#
|
68
|
-
# "ActiveRecord".underscore # => "active_record"
|
69
|
-
# "ActiveRecord::Errors".underscore # => active_record/errors
|
70
|
-
#
|
71
|
-
def underscore
|
72
|
-
ActiveSupport::Inflector.underscore(self)
|
73
|
-
end
|
74
|
-
|
75
|
-
##
|
76
|
-
# By default, +camelize+ converts strings to UpperCamelCase. If the argument to camelize
|
77
|
-
# is set to <tt>:lower</tt> then camelize produces lowerCamelCase.
|
78
|
-
#
|
79
|
-
# +camelize+ will also convert '/' to '::' which is useful for converting paths to namespaces.
|
80
|
-
#
|
81
|
-
# "active_record".camelize # => "ActiveRecord"
|
82
|
-
# "active_record".camelize(:lower) # => "activeRecord"
|
83
|
-
# "active_record/errors".camelize # => "ActiveRecord::Errors"
|
84
|
-
# "active_record/errors".camelize(:lower) # => "activeRecord::Errors"
|
85
|
-
#
|
86
|
-
def camelize(first_letter = :upper)
|
87
|
-
case first_letter
|
88
|
-
when :upper then ActiveSupport::Inflector.camelize(self, true)
|
89
|
-
when :lower then ActiveSupport::Inflector.camelize(self, false)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
alias_method :camelcase, :camelize
|
93
|
-
|
94
|
-
##
|
95
|
-
# Create a class name from a plural table name like Rails does for table names to models.
|
96
|
-
# Note that this returns a string and not a class. (To convert to an actual class
|
97
|
-
# follow +classify+ with +constantize+.)
|
98
|
-
#
|
99
|
-
# "egg_and_hams".classify # => "EggAndHam"
|
100
|
-
# "posts".classify # => "Post"
|
101
|
-
#
|
102
|
-
# Singular names are not handled correctly.
|
103
|
-
#
|
104
|
-
# "business".classify # => "Busines"
|
105
|
-
#
|
106
|
-
def classify
|
107
|
-
ActiveSupport::Inflector.classify(self)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
|
111
|
-
module ObjectSpace
|
112
|
-
class << self
|
113
|
-
# Returns all the classes in the object space.
|
114
|
-
def classes
|
115
|
-
ObjectSpace.each_object(Module).select do |klass|
|
116
|
-
# Why? Ruby, when you remove a costant dosen't remove it from
|
117
|
-
# rb_tables, this mean that here we can find classes that was
|
118
|
-
# removed.
|
119
|
-
klass.name rescue false
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
##
|
126
|
-
# FileSet helper method for iterating and interacting with files inside a directory
|
127
|
-
#
|
128
|
-
module FileSet
|
129
|
-
extend self
|
130
|
-
##
|
131
|
-
# Iterates over every file in the glob pattern and yields to a block
|
132
|
-
# Returns the list of files matching the glob pattern
|
133
|
-
# FileSet.glob('padrino-core/application/*.rb', __FILE__) { |file| load file }
|
134
|
-
#
|
135
|
-
def glob(glob_pattern, file_path=nil, &block)
|
136
|
-
glob_pattern = File.join(File.dirname(file_path), glob_pattern) if file_path
|
137
|
-
file_list = Dir.glob(glob_pattern).sort
|
138
|
-
file_list.each { |file| block.call(file) }
|
139
|
-
file_list
|
140
|
-
end
|
141
|
-
|
142
|
-
##
|
143
|
-
# Requires each file matched in the glob pattern into the application
|
144
|
-
# FileSet.glob_require('padrino-core/application/*.rb', __FILE__)
|
145
|
-
#
|
146
|
-
def glob_require(glob_pattern, file_path=nil)
|
147
|
-
glob(glob_pattern, file_path) { |f| require f }
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
##
|
152
|
-
# Removes indentation
|
153
|
-
# Add colors
|
154
|
-
#
|
155
|
-
# @example
|
156
|
-
# help <<-EOS.undent
|
157
|
-
# Here my help usage
|
158
|
-
# sample_code
|
159
|
-
#
|
160
|
-
# Fix
|
161
|
-
# EOS
|
162
|
-
# puts help.red.bold
|
163
|
-
#
|
164
|
-
class String
|
165
|
-
def self.colors
|
166
|
-
@_colors ||= {
|
167
|
-
:clear => 0,
|
168
|
-
:bold => 1,
|
169
|
-
:black => 30,
|
170
|
-
:red => 31,
|
171
|
-
:green => 32,
|
172
|
-
:yellow => 33,
|
173
|
-
:blue => 34,
|
174
|
-
:magenta => 35,
|
175
|
-
:cyan => 36,
|
176
|
-
:white => 37
|
177
|
-
}
|
178
|
-
end
|
179
|
-
|
180
|
-
colors.each do |color, value|
|
181
|
-
define_method(color) do
|
182
|
-
["\e[", value.to_s, "m", self, "\e[", self.class.colors[:clear], "m"] * ''
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
def undent
|
187
|
-
gsub(/^.{#{slice(/^ +/).size}}/, '')
|
188
|
-
end
|
189
|
-
end
|
190
|
-
|
191
|
-
##
|
192
|
-
# Loads our locale configuration files
|
193
|
-
#
|
194
|
-
### I18n.load_path += Dir["#{File.dirname(__FILE__)}/locale/*.yml"] if defined?(I18n) ### !!! FIXME middleman ###
|
195
|
-
|
196
|
-
##
|
197
|
-
# Used to determine if this file has already been required
|
198
|
-
#
|
199
|
-
module SupportLite; end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
module Padrino
|
2
|
-
##
|
3
|
-
# This module it's used for bootstrap with padrino rake
|
4
|
-
# thirdy party tasks, in your gem/plugin/extension you
|
5
|
-
# need only do this:
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# Padrino::Tasks.files << yourtask.rb
|
9
|
-
# Padrino::Tasks.files.concat(Dir["/path/to/all/my/tasks/*.rb"])
|
10
|
-
# Padrino::Tasks.files.unshift("yourtask.rb")
|
11
|
-
#
|
12
|
-
module Tasks
|
13
|
-
|
14
|
-
##
|
15
|
-
# Returns a list of files to handle with padrino rake
|
16
|
-
#
|
17
|
-
def self.files
|
18
|
-
@files ||= []
|
19
|
-
end
|
20
|
-
end # Tasks
|
21
|
-
end # Padrino
|
@@ -1,20 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Manages current Padrino version for use in gem generation.
|
3
|
-
#
|
4
|
-
# We put this in a separate file so you can get padrino version
|
5
|
-
# without include full padrino core.
|
6
|
-
#
|
7
|
-
module Padrino
|
8
|
-
# The version constant for the current version of Padrino.
|
9
|
-
VERSION = '0.10.6' unless defined?(Padrino::VERSION)
|
10
|
-
|
11
|
-
#
|
12
|
-
# The current Padrino version.
|
13
|
-
#
|
14
|
-
# @return [String]
|
15
|
-
# The version number.
|
16
|
-
#
|
17
|
-
def self.version
|
18
|
-
VERSION
|
19
|
-
end
|
20
|
-
end # Padrino
|
@@ -1,152 +0,0 @@
|
|
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
|
-
# A Rack::Builder object that allows to add middlewares in front of all
|
117
|
-
# Padrino applications.
|
118
|
-
#
|
119
|
-
# @return [Array<Array<Class, Array, Proc>>]
|
120
|
-
# The middleware classes.
|
121
|
-
#
|
122
|
-
def middleware
|
123
|
-
@middleware ||= []
|
124
|
-
end
|
125
|
-
|
126
|
-
##
|
127
|
-
# Clears all previously configured middlewares.
|
128
|
-
#
|
129
|
-
# @return [Array]
|
130
|
-
# An empty array
|
131
|
-
#
|
132
|
-
def clear_middleware!
|
133
|
-
@middleware = []
|
134
|
-
end
|
135
|
-
|
136
|
-
##
|
137
|
-
# Convenience method for adding a Middleware to the whole padrino app.
|
138
|
-
#
|
139
|
-
# @param [Class] m
|
140
|
-
# The middleware class.
|
141
|
-
#
|
142
|
-
# @param [Array] args
|
143
|
-
# The arguments for the middleware.
|
144
|
-
#
|
145
|
-
# @yield []
|
146
|
-
# The given block will be passed to the initialized middleware.
|
147
|
-
#
|
148
|
-
def use(m, *args, &block)
|
149
|
-
middleware << [m, args, block]
|
150
|
-
end
|
151
|
-
end # self
|
152
|
-
end # Padrino
|
@@ -1,38 +0,0 @@
|
|
1
|
-
#!/usr/bin/env gem build
|
2
|
-
# encoding: utf-8
|
3
|
-
|
4
|
-
require File.expand_path("../lib/padrino-core/version.rb", __FILE__)
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = "padrino-core"
|
8
|
-
s.rubyforge_project = "padrino-core"
|
9
|
-
s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
|
10
|
-
s.email = "padrinorb@gmail.com"
|
11
|
-
s.summary = "The required Padrino core gem"
|
12
|
-
s.homepage = "http://www.padrinorb.com"
|
13
|
-
s.description = "The Padrino core gem required for use of this framework"
|
14
|
-
s.required_rubygems_version = ">= 1.3.6"
|
15
|
-
s.version = Padrino.version
|
16
|
-
s.date = Time.now.strftime("%Y-%m-%d")
|
17
|
-
|
18
|
-
s.extra_rdoc_files = Dir["*.rdoc"]
|
19
|
-
s.files = `git ls-files`.split("\n")
|
20
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
22
|
-
s.require_paths = ["lib"]
|
23
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
24
|
-
|
25
|
-
# TODO remove after a couple versions
|
26
|
-
# s.post_install_message = "\e[32m" + ("*" * 20)
|
27
|
-
# s.post_install_message << "\n UPGRADE NOTES\n\n\e[31m When upgrading, please 'enable :sessions' for each application"
|
28
|
-
# s.post_install_message << " as shown here:\e[0m http://bit.ly/kODKMx\n"
|
29
|
-
# s.post_install_message << "\e[31m When upgrading, please 'register Padrino::Rendering' for each application"
|
30
|
-
# s.post_install_message << " as shown here:\e[0m https://gist.github.com/1d36a35794dbbd664ea4"
|
31
|
-
# s.post_install_message << "\n\e[32m" + ("*" * 20) + "\n\e[0m"
|
32
|
-
|
33
|
-
s.add_dependency("tilt", "~> 1.3.0")
|
34
|
-
s.add_dependency("sinatra", "~> 1.3.1")
|
35
|
-
s.add_dependency("http_router", "~> 0.10.2")
|
36
|
-
s.add_dependency("thor", "~> 0.14.3")
|
37
|
-
s.add_dependency("activesupport", "~> 3.2.0")
|
38
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
PADRINO_ROOT = File.dirname(__FILE__) unless defined? PADRINO_ROOT
|
2
|
-
|
3
|
-
module LibDemo
|
4
|
-
def self.give_me_a_random
|
5
|
-
@rand ||= rand(100)
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
|
-
class Complex1Demo < Padrino::Application
|
10
|
-
set :reload, true
|
11
|
-
get("/old"){ "Old Sinatra Way" }
|
12
|
-
end
|
13
|
-
|
14
|
-
class Complex2Demo < Padrino::Application
|
15
|
-
set :reload, true
|
16
|
-
get("/old"){ "Old Sinatra Way" }
|
17
|
-
|
18
|
-
controllers :var do
|
19
|
-
get(:destroy){ params.inspect }
|
20
|
-
end
|
21
|
-
|
22
|
-
get("/"){ "The magick number is: 12!" } # Change only the number!!!
|
23
|
-
end
|
24
|
-
|
25
|
-
Complex1Demo.controllers do
|
26
|
-
get("/"){ "Given random #{LibDemo.give_me_a_random}" }
|
27
|
-
end
|
28
|
-
|
29
|
-
Complex2Demo.controllers do
|
30
|
-
end
|
31
|
-
|
32
|
-
Padrino.load!
|
@@ -1,33 +0,0 @@
|
|
1
|
-
PADRINO_ROOT = File.dirname(__FILE__) unless defined? PADRINO_ROOT
|
2
|
-
# Remove this comment if you want do some like this: ruby PADRINO_ENV=test app.rb
|
3
|
-
#
|
4
|
-
# require 'rubygems'
|
5
|
-
# require 'padrino-core'
|
6
|
-
#
|
7
|
-
|
8
|
-
class SimpleDemo < Padrino::Application
|
9
|
-
set :reload, true
|
10
|
-
before { true }
|
11
|
-
after { true }
|
12
|
-
error(404) { "404" }
|
13
|
-
end
|
14
|
-
|
15
|
-
SimpleDemo.controllers do
|
16
|
-
get "/" do
|
17
|
-
'The magick number is: 2767356926488785838763860464013972991031534522105386787489885890443740254365!' # Change only the number!!!
|
18
|
-
end
|
19
|
-
|
20
|
-
get "/rand" do
|
21
|
-
rand(2 ** 256).to_s
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
## If you want use this as a standalone app uncomment:
|
26
|
-
#
|
27
|
-
# Padrino.mount("SimpleDemo").to("/")
|
28
|
-
# Padrino.run! unless Padrino.loaded? # If you enable reloader prevent to re-run the app
|
29
|
-
#
|
30
|
-
# Then run it from your console: ruby -I"lib" test/fixtures/apps/simple.rb
|
31
|
-
#
|
32
|
-
|
33
|
-
Padrino.load!
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# This file will be safe loaded three times.
|
2
|
-
# The first one fail because B and C constant are not defined
|
3
|
-
# The second one file because B requires C constant so will not be loaded
|
4
|
-
# The third one B and C are defined
|
5
|
-
|
6
|
-
# But here we need some of b.rb
|
7
|
-
A_result = [B, C]
|
8
|
-
|
9
|
-
A = "A"
|
@@ -1 +0,0 @@
|
|
1
|
-
C = "C"
|
@@ -1,83 +0,0 @@
|
|
1
|
-
ENV['PADRINO_ENV'] = 'test'
|
2
|
-
PADRINO_ROOT = File.dirname(__FILE__) unless defined?(PADRINO_ROOT)
|
3
|
-
|
4
|
-
require File.expand_path('../../../load_paths', __FILE__)
|
5
|
-
require File.expand_path('../mini_shoulda', __FILE__)
|
6
|
-
require 'padrino-core'
|
7
|
-
require 'json'
|
8
|
-
require 'rack/test'
|
9
|
-
require 'rack'
|
10
|
-
|
11
|
-
# Rubies < 1.9 don't handle hashes in the properly order so to prevent
|
12
|
-
# this issue for now we remove extra values from mimetypes.
|
13
|
-
Rack::Mime::MIME_TYPES.delete(".xsl") # In this way application/xml respond only to .xml
|
14
|
-
|
15
|
-
class Sinatra::Base
|
16
|
-
# Allow assertions in request context
|
17
|
-
include MiniTest::Assertions
|
18
|
-
end
|
19
|
-
|
20
|
-
class MiniTest::Spec
|
21
|
-
include Rack::Test::Methods
|
22
|
-
|
23
|
-
# Sets up a Sinatra::Base subclass defined with the block
|
24
|
-
# given. Used in setup or individual spec methods to establish
|
25
|
-
# the application.
|
26
|
-
def mock_app(base=Padrino::Application, &block)
|
27
|
-
@app = Sinatra.new(base, &block)
|
28
|
-
end
|
29
|
-
|
30
|
-
def app
|
31
|
-
Rack::Lint.new(@app)
|
32
|
-
end
|
33
|
-
|
34
|
-
# Asserts that a file matches the pattern
|
35
|
-
def assert_match_in_file(pattern, file)
|
36
|
-
assert File.exist?(file), "File '#{file}' does not exist!"
|
37
|
-
assert_match pattern, File.read(file)
|
38
|
-
end
|
39
|
-
|
40
|
-
# Delegate other missing methods to response.
|
41
|
-
def method_missing(name, *args, &block)
|
42
|
-
if response && response.respond_to?(name)
|
43
|
-
response.send(name, *args, &block)
|
44
|
-
else
|
45
|
-
super(name, *args, &block)
|
46
|
-
end
|
47
|
-
rescue Rack::Test::Error # no response yet
|
48
|
-
super(name, *args, &block)
|
49
|
-
end
|
50
|
-
|
51
|
-
alias :response :last_response
|
52
|
-
|
53
|
-
def create_template(name, content, options={})
|
54
|
-
FileUtils.mkdir_p(File.dirname(__FILE__) + "/views")
|
55
|
-
FileUtils.mkdir_p(File.dirname(__FILE__) + "/views/layouts")
|
56
|
-
path = "/views/#{name}"
|
57
|
-
path += ".#{options.delete(:locale)}" if options[:locale].present?
|
58
|
-
path += ".#{options[:format]}" if options[:format].present?
|
59
|
-
path += ".erb" unless options[:format].to_s =~ /haml|rss|atom/
|
60
|
-
path += ".builder" if options[:format].to_s =~ /rss|atom/
|
61
|
-
file = File.dirname(__FILE__) + path
|
62
|
-
File.open(file, 'w') { |io| io.write content }
|
63
|
-
file
|
64
|
-
end
|
65
|
-
alias :create_view :create_template
|
66
|
-
alias :create_layout :create_template
|
67
|
-
|
68
|
-
def remove_views
|
69
|
-
FileUtils.rm_rf(File.dirname(__FILE__) + "/views")
|
70
|
-
end
|
71
|
-
|
72
|
-
def with_template(name, content, options={})
|
73
|
-
# Build a temp layout
|
74
|
-
template = create_template(name, content, options)
|
75
|
-
yield
|
76
|
-
ensure
|
77
|
-
# Remove temp layout
|
78
|
-
File.unlink(template) rescue nil
|
79
|
-
remove_views
|
80
|
-
end
|
81
|
-
alias :with_view :with_template
|
82
|
-
alias :with_layout :with_template
|
83
|
-
end
|