middleman-core-x86-mingw32 3.0.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.cane +2 -0
- data/.cane-exclusions.yml +5 -0
- data/.gemtest +0 -0
- data/Rakefile +7 -0
- data/bin/middleman +25 -0
- data/features/3rd_party_cli.feature +15 -0
- data/features/auto_layout.feature +36 -0
- data/features/automatic_directory_matcher.feature +32 -0
- data/features/builder.feature +50 -0
- data/features/chained_templates.feature +19 -0
- data/features/clean_build.feature +28 -0
- data/features/cli_extension.feature +14 -0
- data/features/cli_init.feature +89 -0
- data/features/current_page_request_path_backwards.feature +6 -0
- data/features/custom_layout_engines.feature +8 -0
- data/features/custom_layouts.feature +64 -0
- data/features/data.feature +22 -0
- data/features/dynamic_pages.feature +133 -0
- data/features/extensionless_text_files.feature +24 -0
- data/features/feature_params.feature +6 -0
- data/features/front-matter.feature +72 -0
- data/features/frontmatter_page_settings.feature +43 -0
- data/features/helpers_external.feature +12 -0
- data/features/ignore.feature +121 -0
- data/features/implied_extensions.feature +69 -0
- data/features/instance_vars.feature +9 -0
- data/features/mount_rack.feature +8 -0
- data/features/preview_changes.feature +29 -0
- data/features/request_params.feature +6 -0
- data/features/sitemap_traversal.feature +73 -0
- data/features/static_server.feature +6 -0
- data/features/step_definitions/page_layout_steps.rb +15 -0
- data/features/strip_url.feature +40 -0
- data/features/support/env.rb +6 -0
- data/features/unicode_filenames.feature +36 -0
- data/features/wildcard_page_helper.feature +10 -0
- data/fixtures/automatic-directory-matcher-app/config.rb +1 -0
- data/fixtures/automatic-directory-matcher-app/source/root-plain.html +1 -0
- data/fixtures/automatic-directory-matcher-app/source/root.html.erb +1 -0
- data/fixtures/automatic-directory-matcher-app/source/sub--sub--sub-plain.html +1 -0
- data/fixtures/automatic-directory-matcher-app/source/sub--sub--sub.html.erb +1 -0
- data/fixtures/automatic-directory-matcher-app/source/sub--sub-plain.html +1 -0
- data/fixtures/automatic-directory-matcher-app/source/sub--sub.html.erb +1 -0
- data/fixtures/basic-data-app/config.rb +4 -0
- data/fixtures/basic-data-app/data/test.yml +4 -0
- data/fixtures/basic-data-app/data/test2.json +4 -0
- data/fixtures/basic-data-app/source/data.html.erb +1 -0
- data/fixtures/basic-data-app/source/data3.html.erb +1 -0
- data/fixtures/build-with-errors-app/config.rb +1 -0
- data/fixtures/build-with-errors-app/source/index.html.erb +1 -0
- data/fixtures/chained-app/config.rb +0 -0
- data/fixtures/chained-app/data/article.yml +2 -0
- data/fixtures/chained-app/source/index.html.str.erb +8 -0
- data/fixtures/clean-app/config-complications.rb +11 -0
- data/fixtures/clean-app/config-empty.rb +0 -0
- data/fixtures/clean-app/config.rb +11 -0
- data/fixtures/clean-app/source/index.html.erb +1 -0
- data/fixtures/clean-app/source/layout.erb +9 -0
- data/fixtures/clean-app/source/layouts/custom.erb +8 -0
- data/fixtures/clean-app/source/real/index.html.erb +5 -0
- data/fixtures/clean-app/source/real.html +1 -0
- data/fixtures/clean-app/source/should_be_ignored.html +1 -0
- data/fixtures/clean-app/source/should_be_ignored2.html +1 -0
- data/fixtures/clean-app/source/should_be_ignored3.html +1 -0
- data/fixtures/clean-app/source/static.html +1 -0
- data/fixtures/clean-nested-app/config.rb +3 -0
- data/fixtures/clean-nested-app/source/about.html +1 -0
- data/fixtures/csspie/config.rb +0 -0
- data/fixtures/csspie/source/stylesheets/PIE.htc +96 -0
- data/fixtures/current-page-app/config.rb +3 -0
- data/fixtures/current-page-app/source/request-path.html.erb +1 -0
- 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.str +9 -0
- data/fixtures/custom-layout-app2/config.rb +0 -0
- data/fixtures/custom-layout-app2/source/custom-layout-dir/index.html.erb +1 -0
- data/fixtures/custom-layout-app2/source/custom-layout.html.erb +1 -0
- data/fixtures/custom-layout-app2/source/layouts/custom.erb +8 -0
- data/fixtures/data-app/config.rb +3 -0
- data/fixtures/data-app/data/pages.yml +6 -0
- data/fixtures/data-app/source/index.html.erb +1 -0
- data/fixtures/data-app/source/layout.erb +5 -0
- data/fixtures/different-engine-layout/config.rb +0 -0
- data/fixtures/different-engine-layout/source/index.html.str +1 -0
- data/fixtures/different-engine-layout/source/layout.erb +9 -0
- data/fixtures/dynamic-pages-app/config.rb +52 -0
- data/fixtures/dynamic-pages-app/source/real/index.html.erb +9 -0
- data/fixtures/dynamic-pages-app/source/real.html +1 -0
- data/fixtures/dynamic-pages-app/source/should_be_ignored.html +1 -0
- data/fixtures/dynamic-pages-app/source/should_be_ignored2.html +1 -0
- data/fixtures/dynamic-pages-app/source/should_be_ignored3.html +1 -0
- data/fixtures/dynamic-pages-app/source/should_be_ignored4.html +1 -0
- data/fixtures/dynamic-pages-app/source/should_be_ignored5.html +1 -0
- data/fixtures/dynamic-pages-app/source/should_be_ignored6.html +1 -0
- data/fixtures/dynamic-pages-app/source/should_be_ignored7.html +1 -0
- data/fixtures/dynamic-pages-app/source/should_be_ignored8.html +1 -0
- data/fixtures/empty-app/not-config.rb +0 -0
- data/fixtures/engine-matching-layout/config.rb +0 -0
- data/fixtures/engine-matching-layout/source/index.html.erb +1 -0
- data/fixtures/engine-matching-layout/source/layout.erb +9 -0
- data/fixtures/extensionless-text-files-app/config.rb +0 -0
- data/fixtures/extensionless-text-files-app/source/CNAME +1 -0
- data/fixtures/extensionless-text-files-app/source/LICENSE +1 -0
- data/fixtures/extensionless-text-files-app/source/README +1 -0
- data/fixtures/extensionless-text-files-app/source/index.html +1 -0
- data/fixtures/external-helpers/config.rb +4 -0
- data/fixtures/external-helpers/helpers/derp.rb +3 -0
- data/fixtures/external-helpers/helpers/four_helpers.rb +3 -0
- data/fixtures/external-helpers/helpers/one_helper.rb +3 -0
- data/fixtures/external-helpers/helpers/yet_another_thingy.rb +3 -0
- data/fixtures/external-helpers/lib/hello_helper.rb +5 -0
- data/fixtures/external-helpers/source/automatic.html.erb +1 -0
- data/fixtures/external-helpers/source/index.html.erb +1 -0
- data/fixtures/feature-params-app/config.rb +12 -0
- data/fixtures/feature-params-app/source/index.html.erb +3 -0
- data/fixtures/frontmatter-app/config.rb +0 -0
- data/fixtures/frontmatter-app/source/front-matter-2.php.erb +7 -0
- data/fixtures/frontmatter-app/source/front-matter-auto.erb +6 -0
- data/fixtures/frontmatter-app/source/front-matter-change.html.erb +5 -0
- data/fixtures/frontmatter-app/source/front-matter-encoding.html.erb +7 -0
- data/fixtures/frontmatter-app/source/front-matter-line-2.html.erb +7 -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-encoding.html.erb +7 -0
- data/fixtures/frontmatter-app/source/json-front-matter-line-2.html.erb +7 -0
- data/fixtures/frontmatter-app/source/json-front-matter.html.erb +6 -0
- data/fixtures/frontmatter-settings-app/config.rb +4 -0
- data/fixtures/frontmatter-settings-app/source/alternate_layout.html.erb +5 -0
- data/fixtures/frontmatter-settings-app/source/ignored.html.erb +5 -0
- data/fixtures/frontmatter-settings-app/source/layouts/alternate.erb +3 -0
- data/fixtures/frontmatter-settings-app/source/layouts/override.erb +2 -0
- data/fixtures/frontmatter-settings-app/source/override_layout.html.erb +4 -0
- data/fixtures/frontmatter-settings-app/source/page_mentioned.html.erb +4 -0
- data/fixtures/generator-test/config.rb +80 -0
- data/fixtures/generator-test/source/index.html.erb +10 -0
- data/fixtures/glob-app/config.rb +1 -0
- data/fixtures/glob-app/source/index.html.erb +4 -0
- data/fixtures/glob-app/source/stylesheets/site.css.str +3 -0
- data/fixtures/ignore-app/source/about.html.erb +1 -0
- data/fixtures/ignore-app/source/images/icon/messages.png +0 -0
- data/fixtures/ignore-app/source/images/pic.png +0 -0
- data/fixtures/ignore-app/source/images/portrait.jpg +0 -0
- data/fixtures/ignore-app/source/index.html.erb +0 -0
- data/fixtures/ignore-app/source/plain.html +1 -0
- data/fixtures/ignore-app/source/reports/another.html +0 -0
- data/fixtures/ignore-app/source/reports/index.html +0 -0
- data/fixtures/implied-extensions-app/config.rb +0 -0
- data/fixtures/implied-extensions-app/source/index.erb +1 -0
- data/fixtures/indexable-app/config.rb +0 -0
- data/fixtures/indexable-app/source/.htaccess +1 -0
- data/fixtures/indexable-app/source/a_folder/needs_index.html +1 -0
- data/fixtures/indexable-app/source/leave_me_alone.html +1 -0
- data/fixtures/indexable-app/source/needs_index.html +1 -0
- data/fixtures/indexable-app/source/regular/index.html +1 -0
- data/fixtures/indexable-app/source/wildcard_leave_me_alone.html +1 -0
- data/fixtures/instance-vars-app/config.rb +7 -0
- data/fixtures/instance-vars-app/source/content.html.erb +2 -0
- data/fixtures/instance-vars-app/source/layout.erb +1 -0
- data/fixtures/large-build-app/config.rb +3 -0
- data/fixtures/large-build-app/source/.htaccess +1 -0
- data/fixtures/large-build-app/source/_partial.erb +1 -0
- data/fixtures/large-build-app/source/feed.xml.builder +4 -0
- data/fixtures/large-build-app/source/images/Child folder/regular_file(example).txt +1 -0
- data/fixtures/large-build-app/source/images/Read me (example).txt +1 -0
- data/fixtures/large-build-app/source/images/blank.gif +0 -0
- data/fixtures/large-build-app/source/index.html.erb +1 -0
- data/fixtures/large-build-app/source/layout.erb +9 -0
- data/fixtures/large-build-app/source/layouts/content_for.erb +4 -0
- data/fixtures/large-build-app/source/layouts/custom.erb +8 -0
- data/fixtures/large-build-app/source/other_layout.erb +1 -0
- data/fixtures/large-build-app/source/services/index.html.erb +1 -0
- data/fixtures/large-build-app/source/spaces in file.html.erb +1 -0
- data/fixtures/large-build-app/source/static.html +1 -0
- data/fixtures/large-build-app/source/stylesheets/static.css +2 -0
- data/fixtures/manual-layout/config.rb +1 -0
- data/fixtures/manual-layout/source/index.html.erb +1 -0
- data/fixtures/manual-layout/source/layouts/custom.erb +9 -0
- data/fixtures/manual-layout-missing/config.rb +1 -0
- data/fixtures/manual-layout-missing/source/index.html.erb +1 -0
- data/fixtures/manual-layout-override/config.rb +3 -0
- data/fixtures/manual-layout-override/source/index.html.erb +1 -0
- data/fixtures/manual-layout-override/source/layouts/another.erb +9 -0
- data/fixtures/manual-layout-override/source/layouts/custom.erb +9 -0
- data/fixtures/multiple-layouts/config.rb +0 -0
- data/fixtures/multiple-layouts/source/index.html.erb +1 -0
- data/fixtures/multiple-layouts/source/layout.erb +9 -0
- data/fixtures/multiple-layouts/source/layout.str +9 -0
- data/fixtures/no-layout/config.rb +0 -0
- data/fixtures/no-layout/source/index.html.erb +1 -0
- data/fixtures/page-helper-layout-block-app/config.rb +6 -0
- data/fixtures/page-helper-layout-block-app/source/index.html.erb +1 -0
- data/fixtures/page-helper-layout-block-app/source/layouts/alt.erb +3 -0
- data/fixtures/page-helper-layout-block-app/source/layouts/layout.erb +3 -0
- data/fixtures/page-helper-layout-block-app/source/path/child.html.erb +1 -0
- data/fixtures/page-helper-layout-block-app/source/path/index.html.erb +1 -0
- data/fixtures/plain-app/index.html +1 -0
- data/fixtures/preview-app/config.rb +0 -0
- data/fixtures/preview-app/source/content.html.erb +1 -0
- data/fixtures/preview-app/source/layout.erb +1 -0
- data/fixtures/request-app/config.rb +0 -0
- data/fixtures/request-app/source/index.html.erb +3 -0
- data/fixtures/sinatra-app/config.rb +11 -0
- data/fixtures/sinatra-app/source/index.html.erb +5 -0
- data/fixtures/strip-url-app/config.rb +0 -0
- data/fixtures/strip-url-app/source/index.html.erb +1 -0
- data/fixtures/strip-url-app/source/other.html.erb +1 -0
- data/fixtures/strip-url-app/source/subdir/index.html.erb +1 -0
- data/fixtures/traversal-app/config.rb +5 -0
- data/fixtures/traversal-app/source/directory-indexed/sibling.html.erb +3 -0
- data/fixtures/traversal-app/source/directory-indexed/sibling2.html.erb +3 -0
- data/fixtures/traversal-app/source/directory-indexed/sub2/index.html.erb +0 -0
- data/fixtures/traversal-app/source/directory-indexed/sub3/deep.html.erb +0 -0
- data/fixtures/traversal-app/source/directory-indexed.html.erb +0 -0
- data/fixtures/traversal-app/source/index.html.erb +0 -0
- data/fixtures/traversal-app/source/layout.erb +21 -0
- data/fixtures/traversal-app/source/proxied.html.erb +0 -0
- data/fixtures/traversal-app/source/root.html.erb +0 -0
- data/fixtures/traversal-app/source/sub/index.html.erb +0 -0
- data/fixtures/traversal-app/source/sub/sibling.html.erb +0 -0
- data/fixtures/traversal-app/source/sub/sibling2.html.erb +0 -0
- data/fixtures/traversal-app/source/sub/sub2/index.html.erb +0 -0
- data/fixtures/traversal-app/source/sub/sub3/deep.html.erb +0 -0
- data/fixtures/wildcard-app/config.rb +1 -0
- data/fixtures/wildcard-app/source/admin/index.html.erb +1 -0
- data/fixtures/wildcard-app/source/admin/page.html.erb +1 -0
- data/fixtures/wildcard-app/source/index.html.erb +1 -0
- data/fixtures/wildcard-app/source/layouts/admin.erb +2 -0
- data/fixtures/wildcard-app/source/layouts/layout.erb +2 -0
- data/lib/middleman/rack.rb +4 -0
- data/lib/middleman-core/application.rb +245 -0
- data/lib/middleman-core/cli/build.rb +286 -0
- data/lib/middleman-core/cli/bundler.rb +40 -0
- data/lib/middleman-core/cli/extension.rb +49 -0
- data/lib/middleman-core/cli/init.rb +58 -0
- data/lib/middleman-core/cli/server.rb +73 -0
- data/lib/middleman-core/cli.rb +89 -0
- data/lib/middleman-core/core_extensions/builder.rb +17 -0
- data/lib/middleman-core/core_extensions/data.rb +180 -0
- data/lib/middleman-core/core_extensions/extensions.rb +161 -0
- data/lib/middleman-core/core_extensions/external_helpers.rb +39 -0
- data/lib/middleman-core/core_extensions/file_watcher.rb +167 -0
- data/lib/middleman-core/core_extensions/front_matter.rb +213 -0
- data/lib/middleman-core/core_extensions/rendering.rb +439 -0
- data/lib/middleman-core/core_extensions/request.rb +338 -0
- data/lib/middleman-core/core_extensions/routing.rb +94 -0
- data/lib/middleman-core/core_extensions/ruby_encoding.rb +24 -0
- data/lib/middleman-core/core_extensions/show_exceptions.rb +31 -0
- data/lib/middleman-core/core_extensions.rb +33 -0
- data/lib/middleman-core/extensions.rb +103 -0
- data/lib/middleman-core/load_paths.rb +56 -0
- data/lib/middleman-core/logger.rb +29 -0
- data/lib/middleman-core/preview_server.rb +186 -0
- data/lib/middleman-core/profiling.rb +58 -0
- data/lib/middleman-core/renderers/coffee_script.rb +45 -0
- data/lib/middleman-core/renderers/erb.rb +36 -0
- data/lib/middleman-core/renderers/haml.rb +30 -0
- data/lib/middleman-core/renderers/less.rb +49 -0
- data/lib/middleman-core/renderers/liquid.rb +35 -0
- data/lib/middleman-core/renderers/markdown.rb +56 -0
- data/lib/middleman-core/renderers/redcarpet.rb +58 -0
- data/lib/middleman-core/renderers/sass.rb +101 -0
- data/lib/middleman-core/renderers/slim.rb +38 -0
- data/lib/middleman-core/sitemap/extensions/ignores.rb +91 -0
- data/lib/middleman-core/sitemap/extensions/on_disk.rb +84 -0
- data/lib/middleman-core/sitemap/extensions/proxies.rb +114 -0
- data/lib/middleman-core/sitemap/extensions/traversal.rb +84 -0
- data/lib/middleman-core/sitemap/resource.rb +149 -0
- data/lib/middleman-core/sitemap/store.rb +219 -0
- data/lib/middleman-core/sitemap.rb +78 -0
- data/lib/middleman-core/step_definitions/builder_steps.rb +56 -0
- data/lib/middleman-core/step_definitions/middleman_steps.rb +17 -0
- data/lib/middleman-core/step_definitions/server_steps.rb +91 -0
- data/lib/middleman-core/step_definitions.rb +12 -0
- data/lib/middleman-core/templates/default/source/images/background.png +0 -0
- data/lib/middleman-core/templates/default/source/images/middleman.png +0 -0
- data/lib/middleman-core/templates/default/source/index.html.erb +10 -0
- data/lib/middleman-core/templates/default/source/javascripts/all.js +1 -0
- data/lib/middleman-core/templates/default/source/layouts/layout.erb +19 -0
- data/lib/middleman-core/templates/default/source/stylesheets/all.css +55 -0
- data/lib/middleman-core/templates/default/source/stylesheets/normalize.css +431 -0
- data/lib/middleman-core/templates/default.rb +38 -0
- data/lib/middleman-core/templates/extension/Gemfile +17 -0
- data/lib/middleman-core/templates/extension/Rakefile +14 -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/gitignore +2 -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/html5/source/404.html +43 -0
- data/lib/middleman-core/templates/html5/source/README.md +55 -0
- data/lib/middleman-core/templates/html5/source/apple-touch-icon-114x114-precomposed.png +0 -0
- data/lib/middleman-core/templates/html5/source/apple-touch-icon-57x57-precomposed.png +0 -0
- data/lib/middleman-core/templates/html5/source/apple-touch-icon-72x72-precomposed.png +0 -0
- data/lib/middleman-core/templates/html5/source/apple-touch-icon-precomposed.png +0 -0
- data/lib/middleman-core/templates/html5/source/apple-touch-icon.png +0 -0
- data/lib/middleman-core/templates/html5/source/crossdomain.xml +25 -0
- data/lib/middleman-core/templates/html5/source/css/style.css +293 -0
- data/lib/middleman-core/templates/html5/source/favicon.ico +0 -0
- data/lib/middleman-core/templates/html5/source/humans.txt +43 -0
- data/lib/middleman-core/templates/html5/source/img/.gitignore +0 -0
- data/lib/middleman-core/templates/html5/source/index.html +67 -0
- data/lib/middleman-core/templates/html5/source/js/libs/jquery-1.7.1.js +9266 -0
- data/lib/middleman-core/templates/html5/source/js/libs/jquery-1.7.1.min.js +4 -0
- data/lib/middleman-core/templates/html5/source/js/libs/modernizr-2.5.3.min.js +4 -0
- data/lib/middleman-core/templates/html5/source/js/plugins.js +11 -0
- data/lib/middleman-core/templates/html5/source/js/script.js +8 -0
- data/lib/middleman-core/templates/html5/source/robots.txt +4 -0
- data/lib/middleman-core/templates/html5.rb +30 -0
- data/lib/middleman-core/templates/local.rb +28 -0
- data/lib/middleman-core/templates/mobile/source/404.html +37 -0
- data/lib/middleman-core/templates/mobile/source/README.markdown +21 -0
- data/lib/middleman-core/templates/mobile/source/crossdomain.xml +25 -0
- data/lib/middleman-core/templates/mobile/source/css/style.css +315 -0
- data/lib/middleman-core/templates/mobile/source/humans.txt +43 -0
- data/lib/middleman-core/templates/mobile/source/img/h/apple-touch-icon.png +0 -0
- data/lib/middleman-core/templates/mobile/source/img/h/splash.png +0 -0
- data/lib/middleman-core/templates/mobile/source/img/l/apple-touch-icon-precomposed.png +0 -0
- data/lib/middleman-core/templates/mobile/source/img/l/apple-touch-icon.png +0 -0
- data/lib/middleman-core/templates/mobile/source/img/l/splash.png +0 -0
- data/lib/middleman-core/templates/mobile/source/img/m/apple-touch-icon.png +0 -0
- data/lib/middleman-core/templates/mobile/source/index.html +92 -0
- data/lib/middleman-core/templates/mobile/source/js/libs/modernizr-custom.js +14 -0
- data/lib/middleman-core/templates/mobile/source/js/libs/respond.min.js +7 -0
- data/lib/middleman-core/templates/mobile/source/js/mylibs/helper.js +171 -0
- data/lib/middleman-core/templates/mobile/source/js/plugins.js +20 -0
- data/lib/middleman-core/templates/mobile/source/js/script.js +0 -0
- data/lib/middleman-core/templates/mobile/source/robots.txt +4 -0
- data/lib/middleman-core/templates/mobile/source/sitemap.xml +9 -0
- data/lib/middleman-core/templates/mobile/source/test/index.html +31 -0
- data/lib/middleman-core/templates/mobile/source/test/qunit/qunit.css +148 -0
- data/lib/middleman-core/templates/mobile/source/test/qunit/qunit.js +1265 -0
- data/lib/middleman-core/templates/mobile/source/test/tests.js +21 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/Readme.PDF +0 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/aspx/aspx1.snippet +31 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/aspx/aspx2.snippet +2 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/aspx/ga.aspx +195 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/aspx/sample.aspx +44 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/jsp/ga.jsp +225 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/jsp/jsp1.snippet +35 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/jsp/jsp2.snippet +2 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/jsp/sample.jsp +51 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/php/ga.php +176 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/php/php1.snippet +30 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/php/php2.snippet +4 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/php/sample.php +44 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/pl/ga.pl +195 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/pl/perl1.snippet +27 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/pl/perl2.snippet +1 -0
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/pl/sample.pl +38 -0
- data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/COPYING +202 -0
- data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/bookmark_bubble.js +559 -0
- data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/example/example.html +43 -0
- data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/example/example.js +57 -0
- data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/images/arrow.png +0 -0
- data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/images/close.png +0 -0
- data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/images/generate_base64_images +33 -0
- data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/images/icon_calendar.png +0 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/README +27 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/databasefactory.js +45 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbworker.js +324 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbworker_test.html +393 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbworkerstarter.js +32 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapper_gears.js +595 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapper_gears_test.html +404 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapper_html5.js +203 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapper_html5_test.html +468 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapperapi.js +202 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapperapi_test.html +51 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/gears_resultset.js +71 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/gears_resultset_test.html +86 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/gears_transaction.js +196 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/gears_transaction_test.html +221 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/gearsutils.js +94 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/gearsutils_test.html +84 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/global_functions.js +72 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/simplenotes/index.html +347 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/simplenotes/simplenotes.js +503 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/simplenotes/styles.css +66 -0
- data/lib/middleman-core/templates/mobile/source/tools/wspl/simplenotes/template.js +75 -0
- data/lib/middleman-core/templates/mobile.rb +25 -0
- data/lib/middleman-core/templates/shared/Gemfile.tt +3 -0
- data/lib/middleman-core/templates/shared/config.ru +4 -0
- data/lib/middleman-core/templates/shared/config.tt +92 -0
- data/lib/middleman-core/templates/shared/gitignore +14 -0
- data/lib/middleman-core/templates.rb +85 -0
- data/lib/middleman-core/util.rb +174 -0
- data/lib/middleman-core/vendor/hooks-0.2.0/CHANGES.textile +9 -0
- data/lib/middleman-core/vendor/hooks-0.2.0/Gemfile +3 -0
- data/lib/middleman-core/vendor/hooks-0.2.0/README.rdoc +107 -0
- data/lib/middleman-core/vendor/hooks-0.2.0/Rakefile +12 -0
- data/lib/middleman-core/vendor/hooks-0.2.0/hooks.gemspec +22 -0
- data/lib/middleman-core/vendor/hooks-0.2.0/lib/hooks/inheritable_attribute.rb +33 -0
- data/lib/middleman-core/vendor/hooks-0.2.0/lib/hooks.rb +109 -0
- data/lib/middleman-core/vendor/hooks-0.2.0/test/hooks_test.rb +141 -0
- data/lib/middleman-core/vendor/hooks-0.2.0/test/inheritable_attribute_test.rb +55 -0
- data/lib/middleman-core/vendor/hooks-0.2.0/test/test_helper.rb +10 -0
- data/lib/middleman-core/version.rb +5 -0
- data/lib/middleman-core.rb +16 -0
- data/middleman-core-x86-mingw32.gemspec +38 -0
- data/middleman-core.gemspec +39 -0
- metadata +806 -0
@@ -0,0 +1,91 @@
|
|
1
|
+
module Middleman
|
2
|
+
|
3
|
+
module Sitemap
|
4
|
+
|
5
|
+
module Extensions
|
6
|
+
|
7
|
+
module Ignores
|
8
|
+
|
9
|
+
# Setup extension
|
10
|
+
class << self
|
11
|
+
|
12
|
+
# Once registered
|
13
|
+
def registered(app)
|
14
|
+
# Include methods
|
15
|
+
app.send :include, InstanceMethods
|
16
|
+
|
17
|
+
::Middleman::Sitemap::Resource.send :include, ResourceInstanceMethods
|
18
|
+
end
|
19
|
+
|
20
|
+
alias :included :registered
|
21
|
+
end
|
22
|
+
|
23
|
+
# Helpers methods for Resources
|
24
|
+
module ResourceInstanceMethods
|
25
|
+
|
26
|
+
# Whether the Resource is ignored
|
27
|
+
# @return [Boolean]
|
28
|
+
def ignored?
|
29
|
+
@app.ignore_manager.ignored?(path) ||
|
30
|
+
(!proxy? &&
|
31
|
+
@app.ignore_manager.ignored?(source_file.sub("#{@app.source_dir}/", ""))
|
32
|
+
)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Ignore-related instance methods
|
37
|
+
module InstanceMethods
|
38
|
+
def ignore_manager
|
39
|
+
@_ignore_manager ||= IgnoreManager.new(self)
|
40
|
+
end
|
41
|
+
|
42
|
+
# Ignore a path or add an ignore callback
|
43
|
+
# @param [String, Regexp] path Path glob expression, or path regex
|
44
|
+
# @return [void]
|
45
|
+
def ignore(path=nil, &block)
|
46
|
+
ignore_manager.ignore(path, &block)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
# Class to handle managing ignores
|
51
|
+
class IgnoreManager
|
52
|
+
def initialize(app)
|
53
|
+
@app = app
|
54
|
+
|
55
|
+
# Array of callbacks which can ass ignored
|
56
|
+
@ignored_callbacks = []
|
57
|
+
end
|
58
|
+
|
59
|
+
# Ignore a path or add an ignore callback
|
60
|
+
# @param [String, Regexp] path Path glob expression, or path regex
|
61
|
+
# @return [void]
|
62
|
+
def ignore(path=nil, &block)
|
63
|
+
original_callback_size = @ignored_callbacks.size
|
64
|
+
|
65
|
+
if path.is_a? Regexp
|
66
|
+
@ignored_callbacks << Proc.new {|p| p =~ path }
|
67
|
+
elsif path.is_a? String
|
68
|
+
path_clean = ::Middleman::Util.normalize_path(path)
|
69
|
+
if path_clean.include?("*") # It's a glob
|
70
|
+
@ignored_callbacks << Proc.new {|p| File.fnmatch(path_clean, p) }
|
71
|
+
else
|
72
|
+
# Add a specific-path ignore unless that path is already covered
|
73
|
+
@ignored_callbacks << Proc.new {|p| p == path_clean } unless ignored?(path_clean)
|
74
|
+
end
|
75
|
+
elsif block_given?
|
76
|
+
@ignored_callbacks << block
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
# Whether a path is ignored
|
81
|
+
# @param [String] path
|
82
|
+
# @return [Boolean]
|
83
|
+
def ignored?(path)
|
84
|
+
path_clean = ::Middleman::Util.normalize_path(path)
|
85
|
+
@ignored_callbacks.any? { |b| b.call(path_clean) }
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'set'
|
2
|
+
|
3
|
+
module Middleman
|
4
|
+
|
5
|
+
module Sitemap
|
6
|
+
|
7
|
+
module Extensions
|
8
|
+
|
9
|
+
class OnDisk
|
10
|
+
|
11
|
+
attr_accessor :sitemap
|
12
|
+
attr_accessor :waiting_for_ready
|
13
|
+
|
14
|
+
def initialize(sitemap)
|
15
|
+
@sitemap = sitemap
|
16
|
+
@app = @sitemap.app
|
17
|
+
|
18
|
+
@file_paths_on_disk = Set.new
|
19
|
+
|
20
|
+
scoped_self = self
|
21
|
+
@waiting_for_ready = true
|
22
|
+
|
23
|
+
# Register file change callback
|
24
|
+
@app.files.changed do |file|
|
25
|
+
scoped_self.touch_file(file, !scoped_self.waiting_for_ready)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Register file delete callback
|
29
|
+
@app.files.deleted do |file|
|
30
|
+
scoped_self.remove_file(file, !scoped_self.waiting_for_ready)
|
31
|
+
end
|
32
|
+
|
33
|
+
@app.ready do
|
34
|
+
scoped_self.waiting_for_ready = false
|
35
|
+
scoped_self.sitemap.rebuild_resource_list!(:on_disk_ready)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Update or add an on-disk file path
|
40
|
+
# @param [String] file
|
41
|
+
# @return [Boolean]
|
42
|
+
def touch_file(file, rebuild=true)
|
43
|
+
return false if File.directory?(file)
|
44
|
+
|
45
|
+
path = @sitemap.file_to_path(file)
|
46
|
+
return false unless path
|
47
|
+
|
48
|
+
ignored = @app.ignored_sitemap_matchers.any? do |name, callback|
|
49
|
+
callback.call(file)
|
50
|
+
end
|
51
|
+
|
52
|
+
@file_paths_on_disk << file unless ignored
|
53
|
+
|
54
|
+
# Rebuild the sitemap any time a file is touched
|
55
|
+
# in case one of the other manipulators
|
56
|
+
# (like asset_hash) cares about the contents of this file,
|
57
|
+
# whether or not it belongs in the sitemap (like a partial)
|
58
|
+
@sitemap.rebuild_resource_list!(:touched_file) if rebuild
|
59
|
+
end
|
60
|
+
|
61
|
+
# Remove a file from the store
|
62
|
+
# @param [String] file
|
63
|
+
# @return [void]
|
64
|
+
def remove_file(file, rebuild=true)
|
65
|
+
if @file_paths_on_disk.delete?(file)
|
66
|
+
@sitemap.rebuild_resource_list!(:removed_file) if rebuild
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Update the main sitemap resource list
|
71
|
+
# @return [void]
|
72
|
+
def manipulate_resource_list(resources)
|
73
|
+
resources + @file_paths_on_disk.map do |file|
|
74
|
+
::Middleman::Sitemap::Resource.new(
|
75
|
+
@sitemap,
|
76
|
+
@sitemap.file_to_path(file),
|
77
|
+
File.expand_path(file, @app.root)
|
78
|
+
)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
module Middleman
|
2
|
+
|
3
|
+
module Sitemap
|
4
|
+
|
5
|
+
module Extensions
|
6
|
+
|
7
|
+
module Proxies
|
8
|
+
|
9
|
+
# Setup extension
|
10
|
+
class << self
|
11
|
+
|
12
|
+
# Once registered
|
13
|
+
def registered(app)
|
14
|
+
::Middleman::Sitemap::Resource.send :include, ResourceInstanceMethods
|
15
|
+
|
16
|
+
# Include methods
|
17
|
+
app.send :include, InstanceMethods
|
18
|
+
end
|
19
|
+
|
20
|
+
alias :included :registered
|
21
|
+
end
|
22
|
+
|
23
|
+
module ResourceInstanceMethods
|
24
|
+
# Whether this page is a proxy
|
25
|
+
# @return [Boolean]
|
26
|
+
def proxy?
|
27
|
+
!!@proxied_to
|
28
|
+
end
|
29
|
+
|
30
|
+
# Set this page to proxy to a target path
|
31
|
+
# @param [String] target
|
32
|
+
# @return [void]
|
33
|
+
def proxy_to(target)
|
34
|
+
target = ::Middleman::Util.normalize_path(target)
|
35
|
+
raise "You can't proxy #{path} to itself!" if target == path
|
36
|
+
@proxied_to = target
|
37
|
+
end
|
38
|
+
|
39
|
+
# The path of the page this page is proxied to, or nil if it's not proxied.
|
40
|
+
# @return [String]
|
41
|
+
def proxied_to
|
42
|
+
@proxied_to
|
43
|
+
end
|
44
|
+
|
45
|
+
# Whether this page has a template file
|
46
|
+
# @return [Boolean]
|
47
|
+
def template?
|
48
|
+
if proxy?
|
49
|
+
store.find_resource_by_path(proxied_to).template?
|
50
|
+
else
|
51
|
+
super
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def get_source_file
|
56
|
+
if proxy?
|
57
|
+
proxy_resource = store.find_resource_by_path(proxied_to)
|
58
|
+
|
59
|
+
unless proxy_resource
|
60
|
+
raise "Path #{path} proxies to unknown file #{proxied_to}:#{store.resources.map(&:path)}"
|
61
|
+
end
|
62
|
+
|
63
|
+
if proxy_resource.proxy?
|
64
|
+
raise "You can't proxy #{path} to #{proxied_to} which is itself a proxy."
|
65
|
+
end
|
66
|
+
|
67
|
+
proxy_resource.source_file
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
module InstanceMethods
|
73
|
+
def proxy_manager
|
74
|
+
@_proxy_manager ||= ProxyManager.new(self)
|
75
|
+
end
|
76
|
+
|
77
|
+
def proxy(*args)
|
78
|
+
proxy_manager.proxy(*args)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
class ProxyManager
|
83
|
+
def initialize(app)
|
84
|
+
@app = app
|
85
|
+
|
86
|
+
@proxy_paths = {}
|
87
|
+
end
|
88
|
+
|
89
|
+
# Setup a proxy from a path to a target
|
90
|
+
# @param [String] path
|
91
|
+
# @param [String] target
|
92
|
+
# @return [void]
|
93
|
+
def proxy(path, target)
|
94
|
+
@proxy_paths[::Middleman::Util.normalize_path(path)] = ::Middleman::Util.normalize_path(target)
|
95
|
+
@app.sitemap.rebuild_resource_list!(:added_proxy)
|
96
|
+
end
|
97
|
+
|
98
|
+
# Update the main sitemap resource list
|
99
|
+
# @return [void]
|
100
|
+
def manipulate_resource_list(resources)
|
101
|
+
resources + @proxy_paths.map do |key, value|
|
102
|
+
p = ::Middleman::Sitemap::Resource.new(
|
103
|
+
@app.sitemap,
|
104
|
+
key
|
105
|
+
)
|
106
|
+
p.proxy_to(value)
|
107
|
+
p
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,84 @@
|
|
1
|
+
module Middleman
|
2
|
+
|
3
|
+
module Sitemap
|
4
|
+
|
5
|
+
module Extensions
|
6
|
+
|
7
|
+
module Traversal
|
8
|
+
# This resource's parent resource
|
9
|
+
# @return [Middleman::Sitemap::Resource, nil]
|
10
|
+
def parent
|
11
|
+
parts = path.split("/")
|
12
|
+
parts.pop if path.include?(app.index_file)
|
13
|
+
|
14
|
+
return nil if parts.length < 1
|
15
|
+
|
16
|
+
parts.pop
|
17
|
+
parts << app.index_file
|
18
|
+
|
19
|
+
parent_path = "/" + parts.join("/")
|
20
|
+
|
21
|
+
store.find_resource_by_destination_path(parent_path)
|
22
|
+
end
|
23
|
+
|
24
|
+
# This resource's child resources
|
25
|
+
# @return [Array<Middleman::Sitemap::Resource>]
|
26
|
+
def children
|
27
|
+
return [] unless directory_index?
|
28
|
+
|
29
|
+
if eponymous_directory?
|
30
|
+
base_path = eponymous_directory_path
|
31
|
+
prefix = %r|^#{base_path.sub("/", "\\/")}|
|
32
|
+
else
|
33
|
+
base_path = path.sub("#{app.index_file}", "")
|
34
|
+
prefix = %r|^#{base_path.sub("/", "\\/")}|
|
35
|
+
end
|
36
|
+
|
37
|
+
store.resources.select do |sub_resource|
|
38
|
+
if sub_resource.path == self.path || sub_resource.path !~ prefix
|
39
|
+
false
|
40
|
+
else
|
41
|
+
inner_path = sub_resource.path.sub(prefix, "")
|
42
|
+
parts = inner_path.split("/")
|
43
|
+
if parts.length == 1
|
44
|
+
true
|
45
|
+
elsif parts.length == 2
|
46
|
+
parts.last == app.index_file
|
47
|
+
else
|
48
|
+
false
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# This resource's sibling resources
|
55
|
+
# @return [Array<Middleman::Sitemap::Resource>]
|
56
|
+
def siblings
|
57
|
+
return [] unless parent
|
58
|
+
parent.children.reject { |p| p == self }
|
59
|
+
end
|
60
|
+
|
61
|
+
# Whether this resource either a directory index, or has the same name as an existing directory in the source
|
62
|
+
# @return [Boolean]
|
63
|
+
def directory_index?
|
64
|
+
path.include?(app.index_file) || path =~ /\/$/ || eponymous_directory?
|
65
|
+
end
|
66
|
+
|
67
|
+
# Whether the resource has the same name as a directory in the source
|
68
|
+
# (e.g., if the resource is named 'gallery.html' and a path exists named 'gallery/', this would return true)
|
69
|
+
# @return [Boolean]
|
70
|
+
def eponymous_directory?
|
71
|
+
full_path = File.join(app.source_dir, eponymous_directory_path)
|
72
|
+
!!(File.exists?(full_path) && File.directory?(full_path))
|
73
|
+
end
|
74
|
+
|
75
|
+
# The path for this resource if it were a directory, and not a file
|
76
|
+
# (e.g., for 'gallery.html' this would return 'gallery/')
|
77
|
+
# @return [String]
|
78
|
+
def eponymous_directory_path
|
79
|
+
path.sub(ext, '/').sub(/\/$/, "") + "/"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,149 @@
|
|
1
|
+
require "middleman-core/sitemap/extensions/traversal"
|
2
|
+
|
3
|
+
module Middleman
|
4
|
+
|
5
|
+
# Sitemap namespace
|
6
|
+
module Sitemap
|
7
|
+
|
8
|
+
# Sitemap Resource class
|
9
|
+
class Resource
|
10
|
+
include Middleman::Sitemap::Extensions::Traversal
|
11
|
+
|
12
|
+
# @return [Middleman::Application]
|
13
|
+
attr_reader :app
|
14
|
+
delegate :logger, :instrument, :to => :app
|
15
|
+
|
16
|
+
# @return [Middleman::Sitemap::Store]
|
17
|
+
attr_reader :store
|
18
|
+
|
19
|
+
# The source path of this resource (relative to the source directory,
|
20
|
+
# without template extensions)
|
21
|
+
# @return [String]
|
22
|
+
attr_reader :path
|
23
|
+
|
24
|
+
# Set the on-disk source file for this resource
|
25
|
+
# @return [String]
|
26
|
+
# attr_reader :source_file
|
27
|
+
|
28
|
+
def source_file
|
29
|
+
@source_file || get_source_file
|
30
|
+
end
|
31
|
+
|
32
|
+
# Initialize resource with parent store and URL
|
33
|
+
# @param [Middleman::Sitemap::Store] store
|
34
|
+
# @param [String] path
|
35
|
+
# @param [String] source_file
|
36
|
+
def initialize(store, path, source_file=nil)
|
37
|
+
@store = store
|
38
|
+
@app = @store.app
|
39
|
+
@path = path
|
40
|
+
@source_file = source_file
|
41
|
+
|
42
|
+
@destination_paths = [@path]
|
43
|
+
|
44
|
+
@local_metadata = { :options => {}, :locals => {}, :page => {}, :blocks => [] }
|
45
|
+
end
|
46
|
+
|
47
|
+
# Whether this resource has a template file
|
48
|
+
# @return [Boolean]
|
49
|
+
def template?
|
50
|
+
return false if source_file.nil?
|
51
|
+
!::Tilt[source_file].nil?
|
52
|
+
end
|
53
|
+
|
54
|
+
# Get the metadata for both the current source_file and the current path
|
55
|
+
# @return [Hash]
|
56
|
+
def metadata
|
57
|
+
result = store.metadata_for_path(path).dup
|
58
|
+
|
59
|
+
file_meta = store.metadata_for_file(source_file).dup
|
60
|
+
if file_meta.has_key?(:blocks)
|
61
|
+
result[:blocks] << file_meta.delete(:blocks)
|
62
|
+
end
|
63
|
+
result.deep_merge!(file_meta)
|
64
|
+
|
65
|
+
local_meta = @local_metadata.dup
|
66
|
+
if local_meta.has_key?(:blocks)
|
67
|
+
result[:blocks] << local_meta.delete(:blocks)
|
68
|
+
end
|
69
|
+
result.deep_merge!(local_meta)
|
70
|
+
|
71
|
+
result[:blocks] = result[:blocks].flatten.compact
|
72
|
+
|
73
|
+
result
|
74
|
+
end
|
75
|
+
|
76
|
+
# Merge in new metadata specific to this resource.
|
77
|
+
# @param [Hash] metadata A metadata block like provides_metadata_for_path takes
|
78
|
+
def add_metadata(metadata={}, &block)
|
79
|
+
if metadata.has_key?(:blocks)
|
80
|
+
@local_metadata[:blocks] << metadata.delete(:blocks)
|
81
|
+
end
|
82
|
+
@local_metadata.deep_merge!(metadata)
|
83
|
+
@local_metadata[:blocks] << block if block_given?
|
84
|
+
end
|
85
|
+
|
86
|
+
# Get the output/preview URL for this resource
|
87
|
+
# @return [String]
|
88
|
+
def destination_path
|
89
|
+
@destination_paths.last
|
90
|
+
end
|
91
|
+
|
92
|
+
# Set the output/preview URL for this resource
|
93
|
+
# @param [String] path
|
94
|
+
# @return [void]
|
95
|
+
def destination_path=(path)
|
96
|
+
@destination_paths << path
|
97
|
+
end
|
98
|
+
|
99
|
+
# Extension of the path (i.e. '.js')
|
100
|
+
# @return [String]
|
101
|
+
def ext
|
102
|
+
File.extname(path)
|
103
|
+
end
|
104
|
+
|
105
|
+
# Mime type of the path
|
106
|
+
# @return [String]
|
107
|
+
def mime_type
|
108
|
+
app.mime_type ext
|
109
|
+
end
|
110
|
+
|
111
|
+
# Render this resource
|
112
|
+
# @return [String]
|
113
|
+
def render(opts={}, locs={}, &block)
|
114
|
+
return File.open(source_file).read unless template?
|
115
|
+
|
116
|
+
relative_source = Pathname(source_file).relative_path_from(Pathname(app.root))
|
117
|
+
|
118
|
+
instrument "render.resource", :path => relative_source do
|
119
|
+
md = metadata.dup
|
120
|
+
opts = md[:options].deep_merge(opts)
|
121
|
+
locs = md[:locals].deep_merge(locs)
|
122
|
+
|
123
|
+
# Forward remaining data to helpers
|
124
|
+
if md.has_key?(:page)
|
125
|
+
app.data.store("page", md[:page])
|
126
|
+
end
|
127
|
+
|
128
|
+
blocks = md[:blocks].dup rescue []
|
129
|
+
blocks << block if block_given?
|
130
|
+
|
131
|
+
app.current_path ||= self.destination_path
|
132
|
+
app.render_template(source_file, locs, opts, blocks)
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
# A path without the directory index - so foo/index.html becomes
|
137
|
+
# just foo. Best for linking.
|
138
|
+
# @return [String]
|
139
|
+
def url
|
140
|
+
url_path = destination_path
|
141
|
+
if app.strip_index_file
|
142
|
+
url_path = url_path.sub(/(^|\/)#{Regexp.escape(app.index_file)}$/,
|
143
|
+
app.trailing_slash ? '/' : '')
|
144
|
+
end
|
145
|
+
File.join(app.respond_to?(:http_prefix) ? app.http_prefix : '/', url_path)
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|