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,40 +0,0 @@
|
|
1
|
-
pt_br:
|
2
|
-
date:
|
3
|
-
formats:
|
4
|
-
# Use the strftime parameters for formats.
|
5
|
-
# When no format has been given, it uses default.
|
6
|
-
# You can provide other formats here if you like!
|
7
|
-
default: "%d-%m-%Y"
|
8
|
-
short: "%d %b"
|
9
|
-
long: "%d %B %Y"
|
10
|
-
only_day: "%e"
|
11
|
-
|
12
|
-
day_names: [Domingo, Segunda-feira, Terça-feira, Quarta-feira, Quinta-feira, Sexta-feira, Sábado]
|
13
|
-
abbr_day_names: [Dom, Seg, Ter, Qua, Qui, Sex, Sab]
|
14
|
-
month_names: [~, Janeiro, Fevereiro, Março, Abril, Maio, Junho, Julho, Agosto, Setembro, Outubro, Novembro, Dezembro]
|
15
|
-
abbr_month_names: [~, Jan, Fev, Mar, Abr, Maio, Jun, Jul, Ago, Set, Out, Nov, Dez]
|
16
|
-
order:
|
17
|
-
- day
|
18
|
-
- month
|
19
|
-
- year
|
20
|
-
|
21
|
-
time:
|
22
|
-
formats:
|
23
|
-
default: "%a %d %b %Y, %H:%M:%S %z"
|
24
|
-
time: "%H:%M"
|
25
|
-
short: "%d %b %H:%M"
|
26
|
-
long: "%d %B %Y %H:%M"
|
27
|
-
only_second: "%S"
|
28
|
-
|
29
|
-
datetime:
|
30
|
-
formats:
|
31
|
-
default: "%d-%m-%YT%H:%M:%S%Z"
|
32
|
-
|
33
|
-
am: 'am'
|
34
|
-
pm: 'pm'
|
35
|
-
|
36
|
-
# Used in array.to_sentence.
|
37
|
-
support:
|
38
|
-
array:
|
39
|
-
sentence_connector: "e"
|
40
|
-
skip_last_comma: false
|
@@ -1,35 +0,0 @@
|
|
1
|
-
ru:
|
2
|
-
date:
|
3
|
-
formats:
|
4
|
-
# Use the strftime parameters for formats.
|
5
|
-
# When no format has been given, it uses default.
|
6
|
-
# You can provide other formats here if you like!
|
7
|
-
default: "%d.%m.%Y"
|
8
|
-
short: "%d %b"
|
9
|
-
long: "%e %B, %Y"
|
10
|
-
only_day: "%e"
|
11
|
-
|
12
|
-
day_names: [Воскресенье, Понедельник, Вторник, Среда, Четверг, Пятница, Суббота]
|
13
|
-
abbr_day_names: [Вс, Пн, Вт, Ср, Чт, Пт, Сб]
|
14
|
-
month_names: [~, Январь, Февраль, Март, Апрель, Май, Июнь, Июль, Август, Сентябрь, Октябрь, Ноябрь, Декабрь]
|
15
|
-
abbr_month_names: [~, Янв, Феб, Мар, Апр, Май, Июн, Июл, Авг, Сен, Окт, Ноя, Дек]
|
16
|
-
order:
|
17
|
-
- year
|
18
|
-
- month
|
19
|
-
- day
|
20
|
-
|
21
|
-
time:
|
22
|
-
formats:
|
23
|
-
default: "%a, %d %b %Y %H:%M:%S %z"
|
24
|
-
short: "%d %b %H:%M"
|
25
|
-
long: "%e %B, %Y %H:%M"
|
26
|
-
am: "д.п."
|
27
|
-
pm: "п.п."
|
28
|
-
|
29
|
-
# Used in array.to_sentence.
|
30
|
-
support:
|
31
|
-
array:
|
32
|
-
words_connector: ", "
|
33
|
-
two_words_connector: " и "
|
34
|
-
last_word_connector: " и "
|
35
|
-
|
@@ -1,34 +0,0 @@
|
|
1
|
-
tr:
|
2
|
-
date:
|
3
|
-
formats:
|
4
|
-
# Use the strftime parameters for formats.
|
5
|
-
# When no format has been given, it uses default.
|
6
|
-
# You can provide other formats here if you like!
|
7
|
-
default: "%d/%m/%Y"
|
8
|
-
short: "%d %b"
|
9
|
-
long: "%d %B %Y"
|
10
|
-
only_day: "%e"
|
11
|
-
|
12
|
-
day_names: [Pazar, Pazartesi, Salı, Çarşamba, Perşembe, Cuma, Cumartesi]
|
13
|
-
abbr_day_names: [Paz, Pts, Sal, Çar, Per, Cum, Cts]
|
14
|
-
month_names: [~, Ocak, Şubat, Mart, Nisan, Mayıs, Haziran, Temmuz, Ağustos, Eylül, Ekim, Kasım, Aralık]
|
15
|
-
abbr_month_names: [~, Oca, Şub, Mar, Nis, May, Haz, Tem, Ağu, Eyl, Eki, Kas, Ara]
|
16
|
-
order:
|
17
|
-
- day
|
18
|
-
- month
|
19
|
-
- year
|
20
|
-
|
21
|
-
time:
|
22
|
-
formats:
|
23
|
-
default: "%a, %b %b %Y %H:%M:%S %z"
|
24
|
-
short: "%b %d %H:%M"
|
25
|
-
long: "%d %B, %Y %H:%M"
|
26
|
-
am: "öö"
|
27
|
-
pm: "ös"
|
28
|
-
|
29
|
-
# Used in array.to_sentence.
|
30
|
-
support:
|
31
|
-
array:
|
32
|
-
words_connector: ", "
|
33
|
-
two_words_connector: " ve "
|
34
|
-
last_word_connector: " ve "
|
@@ -1,34 +0,0 @@
|
|
1
|
-
uk:
|
2
|
-
date:
|
3
|
-
formats:
|
4
|
-
# Use the strftime parameters for formats.
|
5
|
-
# When no format has been given, it uses default.
|
6
|
-
# You can provide other formats here if you like!
|
7
|
-
default: "%d.%m.%Y"
|
8
|
-
short: "%d %b"
|
9
|
-
long: "%e %B, %Y"
|
10
|
-
only_day: "%e"
|
11
|
-
|
12
|
-
day_names: [Неділя, Понеділок, Вівторок, Середа, Четвер, Пятница, Субота]
|
13
|
-
abbr_day_names: [Нд, Пн, Вт, Ср, Чт, Пт, Сб]
|
14
|
-
month_names: [~, Січено, Лютий, Березень, Квітень, Травень, Червень, Липень, Серпень, Вересень, Жовтень, Листопад, Грудень]
|
15
|
-
abbr_month_names: [~, Січ, Лют, Бер, Кві, Тра, Чер, Лип, Сер, Вер, Жов, Лис, Гру]
|
16
|
-
order:
|
17
|
-
- year
|
18
|
-
- month
|
19
|
-
- day
|
20
|
-
|
21
|
-
time:
|
22
|
-
formats:
|
23
|
-
default: "%a, %d %b %Y %H:%M:%S %z"
|
24
|
-
short: "%d %b %H:%M"
|
25
|
-
long: "%e %B, %Y %H:%M"
|
26
|
-
am: "д.п."
|
27
|
-
pm: "п.п"
|
28
|
-
|
29
|
-
# Used in array.to_sentence.
|
30
|
-
support:
|
31
|
-
array:
|
32
|
-
words_connector: ", "
|
33
|
-
two_words_connector: " і "
|
34
|
-
last_word_connector: ", і "
|
@@ -1,34 +0,0 @@
|
|
1
|
-
zh_cn:
|
2
|
-
date:
|
3
|
-
formats:
|
4
|
-
# Use the strftime parameters for formats.
|
5
|
-
# When no format has been given, it uses default.
|
6
|
-
# You can provide other formats here if you like!
|
7
|
-
default: "%Y-%m-%d"
|
8
|
-
short: "%b%d日"
|
9
|
-
long: "%Y年%b%d日"
|
10
|
-
only_day: "%e"
|
11
|
-
|
12
|
-
day_names: [星期日, 星期一, 星期二, 星期三, 星期四, 星期五, 星期六]
|
13
|
-
abbr_day_names: [日, 一, 二, 三, 四, 五, 六]
|
14
|
-
month_names: [~, 一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, 九月, 十月, 十一月, 十二月]
|
15
|
-
abbr_month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月]
|
16
|
-
order:
|
17
|
-
- year
|
18
|
-
- month
|
19
|
-
- day
|
20
|
-
|
21
|
-
time:
|
22
|
-
formats:
|
23
|
-
default: "%Y年%b%d日 %A %H:%M:%S %Z"
|
24
|
-
short: "%b%d日 %H:%M"
|
25
|
-
long: "%Y年%b%d日 %H:%M"
|
26
|
-
am: "上午"
|
27
|
-
pm: "下午"
|
28
|
-
|
29
|
-
# Used in array.to_sentence.
|
30
|
-
support:
|
31
|
-
array:
|
32
|
-
words_connector: ", "
|
33
|
-
two_words_connector: " 和 "
|
34
|
-
last_word_connector: ", 和 "
|
@@ -1,34 +0,0 @@
|
|
1
|
-
zh_tw:
|
2
|
-
date:
|
3
|
-
formats:
|
4
|
-
# Use the strftime parameters for formats.
|
5
|
-
# When no format has been given, it uses default.
|
6
|
-
# You can provide other formats here if you like!
|
7
|
-
default: "%Y-%m-%d"
|
8
|
-
short: "%b%d日"
|
9
|
-
long: "%Y年%b%d日"
|
10
|
-
only_day: "%e"
|
11
|
-
|
12
|
-
day_names: [星期日, 星期一, 星期二, 星期三, 星期四, 星期五, 星期六]
|
13
|
-
abbr_day_names: [日, 一, 二, 三, 四, 五, 六]
|
14
|
-
month_names: [~, 一月, 二月, 三月, 四月, 五月, 六月, 七月, 八月, 九月, 十月, 十一月, 十二月]
|
15
|
-
abbr_month_names: [~, 1月, 2月, 3月, 4月, 5月, 6月, 7月, 8月, 9月, 10月, 11月, 12月]
|
16
|
-
order:
|
17
|
-
- year
|
18
|
-
- month
|
19
|
-
- day
|
20
|
-
|
21
|
-
time:
|
22
|
-
formats:
|
23
|
-
default: "%Y年%b%d日 %A %H:%M:%S %Z"
|
24
|
-
short: "%b%d日 %H:%M"
|
25
|
-
long: "%Y年%b%d日 %H:%M"
|
26
|
-
am: "上午"
|
27
|
-
pm: "下午"
|
28
|
-
|
29
|
-
# Used in array.to_sentence.
|
30
|
-
support:
|
31
|
-
array:
|
32
|
-
words_connector: ", "
|
33
|
-
two_words_connector: " 和 "
|
34
|
-
last_word_connector: ", 和 "
|
@@ -1,428 +0,0 @@
|
|
1
|
-
# Defines the log level for a Padrino project.
|
2
|
-
PADRINO_LOG_LEVEL = ENV['PADRINO_LOG_LEVEL'] unless defined?(PADRINO_LOG_LEVEL)
|
3
|
-
|
4
|
-
# Defines the logger used for a Padrino project.
|
5
|
-
PADRINO_LOGGER = ENV['PADRINO_LOGGER'] unless defined?(PADRINO_LOGGER)
|
6
|
-
|
7
|
-
module Padrino
|
8
|
-
##
|
9
|
-
# @return [Padrino::Logger]
|
10
|
-
#
|
11
|
-
# @example
|
12
|
-
# logger.debug "foo"
|
13
|
-
# logger.warn "bar"
|
14
|
-
#
|
15
|
-
def self.logger
|
16
|
-
Padrino::Logger.setup! if Thread.current[:padrino_logger].nil?
|
17
|
-
Thread.current[:padrino_logger]
|
18
|
-
end
|
19
|
-
|
20
|
-
##
|
21
|
-
# Set the padrino logger
|
22
|
-
#
|
23
|
-
# @param [Object] value
|
24
|
-
# an object that respond to <<, write, puts, debug, warn etc..
|
25
|
-
#
|
26
|
-
# @return [Object]
|
27
|
-
# the given value
|
28
|
-
#
|
29
|
-
# @example using ruby default logger
|
30
|
-
# require 'logger'
|
31
|
-
# Padrino.logger = Logger.new(STDOUT)
|
32
|
-
#
|
33
|
-
# @example using ActiveSupport
|
34
|
-
# require 'active_support/buffered_logger'
|
35
|
-
# Padrino.logger = Buffered.new(STDOUT)
|
36
|
-
#
|
37
|
-
def self.logger=(value)
|
38
|
-
value.extend(Padrino::Logger::Extensions) unless (Padrino::Logger::Extensions === value)
|
39
|
-
Thread.current[:padrino_logger] = value
|
40
|
-
end
|
41
|
-
|
42
|
-
##
|
43
|
-
# Padrinos internal logger, using all of Padrino log extensions.
|
44
|
-
#
|
45
|
-
class Logger
|
46
|
-
##
|
47
|
-
# Ruby (standard) logger levels:
|
48
|
-
#
|
49
|
-
# :fatal:: An unhandleable error that results in a program crash
|
50
|
-
# :error:: A handleable error condition
|
51
|
-
# :warn:: A warning
|
52
|
-
# :info:: generic (useful) information about system operation
|
53
|
-
# :debug:: low-level information for developers
|
54
|
-
# :devel:: Development-related information that is unnecessary in debug mode
|
55
|
-
#
|
56
|
-
Levels = {
|
57
|
-
:fatal => 7,
|
58
|
-
:error => 6,
|
59
|
-
:warn => 4,
|
60
|
-
:info => 3,
|
61
|
-
:debug => 0,
|
62
|
-
:devel => -1,
|
63
|
-
} unless const_defined?(:Levels)
|
64
|
-
|
65
|
-
module Extensions
|
66
|
-
##
|
67
|
-
# Generate the logging methods for {Padrino.logger} for each log level.
|
68
|
-
#
|
69
|
-
Padrino::Logger::Levels.each_pair do |name, number|
|
70
|
-
define_method(name) do |*args|
|
71
|
-
return if number < level
|
72
|
-
if args.size > 1
|
73
|
-
bench(args[0], args[1], args[2], name)
|
74
|
-
else
|
75
|
-
push(args * '', name)
|
76
|
-
end
|
77
|
-
end
|
78
|
-
|
79
|
-
define_method(:"#{name}?") do
|
80
|
-
number >= level
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
##
|
85
|
-
# Append a to development logger a given action with time
|
86
|
-
#
|
87
|
-
# @param [string] action
|
88
|
-
# The action
|
89
|
-
#
|
90
|
-
# @param [float] time
|
91
|
-
# Time duration for the given action
|
92
|
-
#
|
93
|
-
# @param [message] string
|
94
|
-
# The message that you want to log
|
95
|
-
#
|
96
|
-
# @example
|
97
|
-
# logger.bench 'GET', started_at, '/blog/categories'
|
98
|
-
# # => DEBUG - GET (0.056ms) - /blog/categories
|
99
|
-
#
|
100
|
-
def bench(action, began_at, message, level=:debug, color=:yellow)
|
101
|
-
@_pad ||= 8
|
102
|
-
@_pad = action.to_s.size if action.to_s.size > @_pad
|
103
|
-
duration = Time.now - began_at
|
104
|
-
color = :red if duration > 1
|
105
|
-
action = colorize(action.to_s.upcase.rjust(@_pad), color)
|
106
|
-
duration = colorize('%0.4fms' % duration, :bold, color)
|
107
|
-
push "#{action} (#{duration}) #{message}", level
|
108
|
-
end
|
109
|
-
|
110
|
-
##
|
111
|
-
# Appends a message to the log. The methods yield to an optional block and
|
112
|
-
# the output of this block will be appended to the message.
|
113
|
-
#
|
114
|
-
# @param [String] message
|
115
|
-
# The message that you want write to your stream
|
116
|
-
#
|
117
|
-
# @param [String] level
|
118
|
-
# The level one of :debug, :warn etc...
|
119
|
-
#
|
120
|
-
#
|
121
|
-
def push(message = nil, level = nil)
|
122
|
-
add(Padrino::Logger::Levels[level], format(message, level))
|
123
|
-
end
|
124
|
-
|
125
|
-
##
|
126
|
-
# Formats the log message. This method is a noop and should be implemented by other
|
127
|
-
# logger components such as {Padrino::Logger}.
|
128
|
-
#
|
129
|
-
# @param [String] message
|
130
|
-
# The message to format
|
131
|
-
#
|
132
|
-
# @param [String,Symbol] level
|
133
|
-
# The log level, one of :debug, :warn...
|
134
|
-
def format(message, level)
|
135
|
-
message
|
136
|
-
end
|
137
|
-
|
138
|
-
##
|
139
|
-
# The debug level, with some style added. May be reimplemented.
|
140
|
-
#
|
141
|
-
# @example
|
142
|
-
# stylized_level(:debug) => DEBUG
|
143
|
-
#
|
144
|
-
# @param [String,Symbol] level
|
145
|
-
# The log level
|
146
|
-
#
|
147
|
-
def stylized_level(level)
|
148
|
-
level.to_s.upcase.rjust(7)
|
149
|
-
end
|
150
|
-
|
151
|
-
##
|
152
|
-
# Colorizes a string for colored console output. This is a noop and can be reimplemented
|
153
|
-
# to colorize the string as needed.
|
154
|
-
#
|
155
|
-
# @see
|
156
|
-
# ColorizedLogger
|
157
|
-
#
|
158
|
-
# @param [string]
|
159
|
-
# The string to be colorized.
|
160
|
-
#
|
161
|
-
# @param [Array<Symbol>]
|
162
|
-
# The colors to use. Should be applied in the order given.
|
163
|
-
def colorize(string, *colors)
|
164
|
-
string
|
165
|
-
end
|
166
|
-
|
167
|
-
##
|
168
|
-
# Turns a logger with LoggingExtensions into a logger with colorized output.
|
169
|
-
#
|
170
|
-
# @example
|
171
|
-
# Padrino.logger = Logger.new($stdout)
|
172
|
-
# Padrino.logger.colorize!
|
173
|
-
# Padrino.logger.debug("Fancy Padrino debug string")
|
174
|
-
def colorize!
|
175
|
-
self.extend(Colorize)
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
module Colorize
|
180
|
-
# Colors for levels
|
181
|
-
ColoredLevels = {
|
182
|
-
:fatal => [:bold, :red],
|
183
|
-
:error => [:red],
|
184
|
-
:warn => [:yellow],
|
185
|
-
:info => [:green],
|
186
|
-
:debug => [:cyan],
|
187
|
-
:devel => [:magenta]
|
188
|
-
} unless defined?(ColoredLevels)
|
189
|
-
|
190
|
-
##
|
191
|
-
# Colorize our level
|
192
|
-
#
|
193
|
-
# @param [String, Symbol] level
|
194
|
-
#
|
195
|
-
# @see Padrino::Logging::ColorizedLogger::ColoredLevels
|
196
|
-
#
|
197
|
-
def colorize(string, *colors)
|
198
|
-
colors.each do |c|
|
199
|
-
string = string.send(c)
|
200
|
-
end
|
201
|
-
string
|
202
|
-
end
|
203
|
-
|
204
|
-
def stylized_level(level)
|
205
|
-
style = ColoredLevels[level].map { |c| "\e[%dm" % String.colors[c] } * ''
|
206
|
-
[style, super, "\e[0m"] * ''
|
207
|
-
end
|
208
|
-
end
|
209
|
-
|
210
|
-
include Extensions
|
211
|
-
include Colorize
|
212
|
-
|
213
|
-
attr_accessor :level
|
214
|
-
attr_accessor :auto_flush
|
215
|
-
attr_reader :buffer
|
216
|
-
attr_reader :log
|
217
|
-
attr_reader :init_args
|
218
|
-
attr_accessor :log_static
|
219
|
-
|
220
|
-
@@mutex = {}
|
221
|
-
|
222
|
-
##
|
223
|
-
# Configuration for a given environment, possible options are:
|
224
|
-
#
|
225
|
-
# :log_level:: Once of [:fatal, :error, :warn, :info, :debug]
|
226
|
-
# :stream:: Once of [:to_file, :null, :stdout, :stderr] our your custom stream
|
227
|
-
# :log_level::
|
228
|
-
# The log level from, e.g. :fatal or :info. Defaults to :warn in the
|
229
|
-
# production environment and :debug otherwise.
|
230
|
-
# :auto_flush::
|
231
|
-
# Whether the log should automatically flush after new messages are
|
232
|
-
# added. Defaults to true.
|
233
|
-
# :format_datetime:: Format of datetime. Defaults to: "%d/%b/%Y %H:%M:%S"
|
234
|
-
# :format_message:: Format of message. Defaults to: ""%s - - [%s] \"%s\"""
|
235
|
-
# :log_static:: Whether or not to show log messages for static files. Defaults to: false
|
236
|
-
#
|
237
|
-
# @example
|
238
|
-
# Padrino::Logger::Config[:development] = { :log_level => :debug, :stream => :to_file }
|
239
|
-
# # or you can edit our defaults
|
240
|
-
# Padrino::Logger::Config[:development][:log_level] = :error
|
241
|
-
# # or you can use your stream
|
242
|
-
# Padrino::Logger::Config[:development][:stream] = StringIO.new
|
243
|
-
#
|
244
|
-
# Defaults are:
|
245
|
-
#
|
246
|
-
# :production => { :log_level => :warn, :stream => :to_file }
|
247
|
-
# :development => { :log_level => :debug, :stream => :stdout }
|
248
|
-
# :test => { :log_level => :fatal, :stream => :null }
|
249
|
-
#
|
250
|
-
# In some cases, configuring the loggers before loading the framework is necessary.
|
251
|
-
# You can do so by setting PADRINO_LOGGER:
|
252
|
-
#
|
253
|
-
# PADRINO_LOGGER = { :staging => { :log_level => :debug, :stream => :to_file }}
|
254
|
-
#
|
255
|
-
Config = {
|
256
|
-
:production => { :log_level => :warn, :stream => :to_file },
|
257
|
-
:development => { :log_level => :debug, :stream => :stdout, :format_datetime => ' ' },
|
258
|
-
:test => { :log_level => :debug, :stream => :null }
|
259
|
-
}
|
260
|
-
Config.merge!(PADRINO_LOGGER) if PADRINO_LOGGER
|
261
|
-
|
262
|
-
##
|
263
|
-
# Setup a new logger
|
264
|
-
#
|
265
|
-
# @return [Padrino::Logger]
|
266
|
-
# A {Padrino::Logger} instance
|
267
|
-
#
|
268
|
-
def self.setup!
|
269
|
-
config_level = (PADRINO_LOG_LEVEL || Padrino.env || :test).to_sym # need this for PADRINO_LOG_LEVEL
|
270
|
-
config = Config[config_level]
|
271
|
-
|
272
|
-
unless config
|
273
|
-
warn("No logging configuration for :#{config_level} found, falling back to :production")
|
274
|
-
config = Config[:production]
|
275
|
-
end
|
276
|
-
|
277
|
-
stream = case config[:stream]
|
278
|
-
when :to_file
|
279
|
-
FileUtils.mkdir_p(Padrino.root('log')) unless File.exists?(Padrino.root('log'))
|
280
|
-
File.new(Padrino.root('log', "#{Padrino.env}.log"), 'a+')
|
281
|
-
when :null then StringIO.new
|
282
|
-
when :stdout then $stdout
|
283
|
-
when :stderr then $stderr
|
284
|
-
else config[:stream] # return itself, probabilly is a custom stream.
|
285
|
-
end
|
286
|
-
|
287
|
-
Thread.current[:padrino_logger] = Padrino::Logger.new(config.merge(:stream => stream))
|
288
|
-
end
|
289
|
-
|
290
|
-
##
|
291
|
-
# To initialize the logger you create a new object, proxies to set_log.
|
292
|
-
#
|
293
|
-
# @param [Hash] options
|
294
|
-
#
|
295
|
-
# @option options [Symbol] :stream ($stdout)
|
296
|
-
# Either an IO object or a name of a logfile. Defaults to $stdout
|
297
|
-
#
|
298
|
-
# @option options [Symbol] :log_level (:production in the production environment and :debug otherwise)
|
299
|
-
# The log level from, e.g. :fatal or :info.
|
300
|
-
#
|
301
|
-
# @option options [Symbol] :auto_flush (true)
|
302
|
-
# Whether the log should automatically flush after new messages are
|
303
|
-
# added. Defaults to true.
|
304
|
-
#
|
305
|
-
# @option options [Symbol] :format_datetime (" [%d/%b/%Y %H:%M:%S] ")
|
306
|
-
# Format of datetime
|
307
|
-
#
|
308
|
-
# @option options [Symbol] :format_message ("%s -%s%s")
|
309
|
-
# Format of message
|
310
|
-
#
|
311
|
-
# @option options [Symbol] :log_static (false)
|
312
|
-
# Whether or not to show log messages for static files.
|
313
|
-
#
|
314
|
-
def initialize(options={})
|
315
|
-
@buffer = []
|
316
|
-
@auto_flush = options.has_key?(:auto_flush) ? options[:auto_flush] : true
|
317
|
-
@level = options[:log_level] ? Padrino::Logger::Levels[options[:log_level]] : Padrino::Logger::Levels[:debug]
|
318
|
-
@log = options[:stream] || $stdout
|
319
|
-
@log.sync = true
|
320
|
-
@mutex = @@mutex[@log] ||= Mutex.new
|
321
|
-
@format_datetime = options[:format_datetime] || "%d/%b/%Y %H:%M:%S"
|
322
|
-
@format_message = options[:format_message] || "%s -%s%s"
|
323
|
-
@log_static = options.has_key?(:log_static) ? options[:log_static] : false
|
324
|
-
end
|
325
|
-
|
326
|
-
##
|
327
|
-
# Flush the entire buffer to the log object.
|
328
|
-
#
|
329
|
-
def flush
|
330
|
-
return unless @buffer.size > 0
|
331
|
-
@mutex.synchronize do
|
332
|
-
@log.write(@buffer.slice!(0..-1).join(''))
|
333
|
-
end
|
334
|
-
end
|
335
|
-
|
336
|
-
##
|
337
|
-
# Close and remove the current log object.
|
338
|
-
#
|
339
|
-
# @return [NilClass]
|
340
|
-
#
|
341
|
-
def close
|
342
|
-
flush
|
343
|
-
@log.close if @log.respond_to?(:close) && !@log.tty?
|
344
|
-
@log = nil
|
345
|
-
end
|
346
|
-
|
347
|
-
##
|
348
|
-
# Adds a message to the log - for compatibility with other loggers.
|
349
|
-
#
|
350
|
-
# @private
|
351
|
-
def add(level, message = nil)
|
352
|
-
write(message)
|
353
|
-
end
|
354
|
-
|
355
|
-
##
|
356
|
-
# Directly append message to the log.
|
357
|
-
#
|
358
|
-
# @param [String] message
|
359
|
-
# The message
|
360
|
-
#
|
361
|
-
def <<(message = nil)
|
362
|
-
message << "\n" unless message[-1] == ?\n
|
363
|
-
@buffer << message
|
364
|
-
flush if @auto_flush
|
365
|
-
message
|
366
|
-
end
|
367
|
-
alias :write :<<
|
368
|
-
|
369
|
-
def format(message, level)
|
370
|
-
@format_message % [stylized_level(level), colorize(Time.now.strftime(@format_datetime), :yellow), message.to_s.strip]
|
371
|
-
end
|
372
|
-
|
373
|
-
##
|
374
|
-
# Padrino::Loggger::Rack forwards every request to an +app+ given, and
|
375
|
-
# logs a line in the Apache common log format to the +logger+, or
|
376
|
-
# rack.errors by default.
|
377
|
-
#
|
378
|
-
class Rack
|
379
|
-
|
380
|
-
def initialize(app, uri_root) # @private
|
381
|
-
@app = app
|
382
|
-
@uri_root = uri_root.sub(/\/$/,"")
|
383
|
-
end
|
384
|
-
|
385
|
-
def call(env) # @private
|
386
|
-
env['rack.logger'] = Padrino.logger
|
387
|
-
began_at = Time.now
|
388
|
-
status, header, body = @app.call(env)
|
389
|
-
log(env, status, header, began_at)
|
390
|
-
[status, header, body]
|
391
|
-
end
|
392
|
-
|
393
|
-
private
|
394
|
-
def log(env, status, header, began_at)
|
395
|
-
return if env['sinatra.static_file'] && (!logger.respond_to?(:log_static) || !logger.log_static)
|
396
|
-
logger.bench(
|
397
|
-
env["REQUEST_METHOD"],
|
398
|
-
began_at,
|
399
|
-
[
|
400
|
-
@uri_root.to_s,
|
401
|
-
env["PATH_INFO"],
|
402
|
-
env["QUERY_STRING"].empty? ? "" : "?" + env["QUERY_STRING"],
|
403
|
-
' - ',
|
404
|
-
logger.colorize(status.to_s[0..3], :bold),
|
405
|
-
' ',
|
406
|
-
code_to_name(status)
|
407
|
-
] * '',
|
408
|
-
:debug,
|
409
|
-
:magenta
|
410
|
-
)
|
411
|
-
end
|
412
|
-
|
413
|
-
def code_to_name(status)
|
414
|
-
::Rack::Utils::HTTP_STATUS_CODES[status.to_i] || ''
|
415
|
-
end
|
416
|
-
end # Rack
|
417
|
-
end # Logger
|
418
|
-
end # Padrino
|
419
|
-
|
420
|
-
module Kernel # @private
|
421
|
-
##
|
422
|
-
# Define a logger available every where in our app
|
423
|
-
#
|
424
|
-
def logger
|
425
|
-
Padrino.logger
|
426
|
-
end
|
427
|
-
end # Kernel
|
428
|
-
|