middleman-core 4.0.0.rc.1 → 4.0.0.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/Rakefile +0 -1
- data/cucumber.yml +2 -0
- data/features/asset_hash.feature +25 -16
- data/features/asset_host.feature +5 -1
- data/features/chained_templates.feature +8 -5
- data/features/clean_build.feature +18 -0
- data/features/cli/preview_server-hook.feature +17 -0
- data/features/cli/preview_server.feature +533 -0
- data/features/cli_init.feature +3 -3
- data/features/collections.feature +5 -3
- data/features/content_type.feature +3 -0
- data/features/default-layout.feature +90 -0
- data/features/extension_api_deprecations.feature +10 -0
- data/features/front-matter.feature +6 -1
- data/features/i18n_link_to.feature +209 -0
- data/features/import_files.feature +17 -0
- data/features/javascript-testing.feature +18 -0
- data/features/markdown_redcarpet.feature +0 -1
- data/features/markdown_redcarpet_in_haml.feature +0 -1
- data/features/minify_css.feature +87 -5
- data/features/minify_javascript.feature +55 -8
- data/features/move_files.feature +44 -0
- data/features/redirects.feature +1 -0
- data/features/relative_assets.feature +13 -2
- data/features/slim.feature +1 -1
- data/features/stylus.feature +0 -1
- data/features/support/env.rb +5 -1
- data/features/support/preserve_mime_types.rb +7 -0
- data/fixtures/asset-hash-app/source/fonts/fontawesome-webfont.woff +0 -0
- data/fixtures/asset-hash-app/source/fonts/fontawesome-webfont.woff2 +0 -0
- data/fixtures/asset-hash-app/source/stylesheets/site.css.scss +2 -2
- data/fixtures/asset-hash-app/source/stylesheets/uses_fonts.css +4 -0
- data/fixtures/asset-host-app/source/asset_host.html.erb +5 -1
- data/fixtures/chained-app/source/test.erb.combobreaker.str.erb +8 -0
- data/fixtures/clean-app/config-hidden-dir-after.rb +5 -0
- data/fixtures/clean-app/config-hidden-dir-before.rb +1 -0
- data/fixtures/content-type-app/source/index.php +1 -0
- data/fixtures/extension-api-deprecations-app/config.rb +11 -0
- data/fixtures/extension-api-deprecations-app/source/index.html.erb +1 -0
- data/fixtures/extension-api-deprecations-app/source/layouts/layout.erb +3 -0
- data/fixtures/frontmatter-app/config.rb +1 -0
- data/fixtures/frontmatter-app/source/front-matter-haml.html.haml +6 -0
- data/fixtures/frontmatter-neighbor-app/config.rb +1 -1
- data/fixtures/frontmatter-settings-neighbor-app/config.rb +1 -1
- data/fixtures/i18n-test-app/source/localizable/partials/index.html.erb +3 -1
- data/fixtures/import-app/bower.json +21 -0
- data/fixtures/import-app/bower_components/jquery/.bower.json +39 -0
- data/fixtures/import-app/bower_components/jquery/MIT-LICENSE.txt +21 -0
- data/fixtures/import-app/bower_components/jquery/bower.json +28 -0
- data/fixtures/import-app/bower_components/jquery/dist/jquery.js +9210 -0
- data/fixtures/import-app/bower_components/jquery/dist/jquery.min.js +5 -0
- data/fixtures/import-app/bower_components/jquery/dist/jquery.min.map +1 -0
- data/fixtures/import-app/bower_components/jquery/src/ajax.js +786 -0
- data/fixtures/import-app/bower_components/jquery/src/ajax/jsonp.js +89 -0
- data/fixtures/import-app/bower_components/jquery/src/ajax/load.js +75 -0
- data/fixtures/import-app/bower_components/jquery/src/ajax/parseJSON.js +13 -0
- data/fixtures/import-app/bower_components/jquery/src/ajax/parseXML.js +28 -0
- data/fixtures/import-app/bower_components/jquery/src/ajax/script.js +64 -0
- data/fixtures/import-app/bower_components/jquery/src/ajax/var/nonce.js +5 -0
- data/fixtures/import-app/bower_components/jquery/src/ajax/var/rquery.js +3 -0
- data/fixtures/import-app/bower_components/jquery/src/ajax/xhr.js +136 -0
- data/fixtures/import-app/bower_components/jquery/src/attributes.js +11 -0
- data/fixtures/import-app/bower_components/jquery/src/attributes/attr.js +141 -0
- data/fixtures/import-app/bower_components/jquery/src/attributes/classes.js +158 -0
- data/fixtures/import-app/bower_components/jquery/src/attributes/prop.js +94 -0
- data/fixtures/import-app/bower_components/jquery/src/attributes/support.js +35 -0
- data/fixtures/import-app/bower_components/jquery/src/attributes/val.js +161 -0
- data/fixtures/import-app/bower_components/jquery/src/callbacks.js +205 -0
- data/fixtures/import-app/bower_components/jquery/src/core.js +502 -0
- data/fixtures/import-app/bower_components/jquery/src/core/access.js +60 -0
- data/fixtures/import-app/bower_components/jquery/src/core/init.js +123 -0
- data/fixtures/import-app/bower_components/jquery/src/core/parseHTML.js +39 -0
- data/fixtures/import-app/bower_components/jquery/src/core/ready.js +97 -0
- data/fixtures/import-app/bower_components/jquery/src/core/var/rsingleTag.js +4 -0
- data/fixtures/import-app/bower_components/jquery/src/css.js +450 -0
- data/fixtures/import-app/bower_components/jquery/src/css/addGetHookIf.js +22 -0
- data/fixtures/import-app/bower_components/jquery/src/css/curCSS.js +57 -0
- data/fixtures/import-app/bower_components/jquery/src/css/defaultDisplay.js +70 -0
- data/fixtures/import-app/bower_components/jquery/src/css/hiddenVisibleSelectors.js +15 -0
- data/fixtures/import-app/bower_components/jquery/src/css/support.js +96 -0
- data/fixtures/import-app/bower_components/jquery/src/css/swap.js +28 -0
- data/fixtures/import-app/bower_components/jquery/src/css/var/cssExpand.js +3 -0
- data/fixtures/import-app/bower_components/jquery/src/css/var/getStyles.js +12 -0
- data/fixtures/import-app/bower_components/jquery/src/css/var/isHidden.js +13 -0
- data/fixtures/import-app/bower_components/jquery/src/css/var/rmargin.js +3 -0
- data/fixtures/import-app/bower_components/jquery/src/css/var/rnumnonpx.js +5 -0
- data/fixtures/import-app/bower_components/jquery/src/data.js +178 -0
- data/fixtures/import-app/bower_components/jquery/src/data/Data.js +181 -0
- data/fixtures/import-app/bower_components/jquery/src/data/accepts.js +20 -0
- data/fixtures/import-app/bower_components/jquery/src/data/var/data_priv.js +5 -0
- data/fixtures/import-app/bower_components/jquery/src/data/var/data_user.js +5 -0
- data/fixtures/import-app/bower_components/jquery/src/deferred.js +149 -0
- data/fixtures/import-app/bower_components/jquery/src/deprecated.js +13 -0
- data/fixtures/import-app/bower_components/jquery/src/dimensions.js +50 -0
- data/fixtures/import-app/bower_components/jquery/src/effects.js +648 -0
- data/fixtures/import-app/bower_components/jquery/src/effects/Tween.js +114 -0
- data/fixtures/import-app/bower_components/jquery/src/effects/animatedSelector.js +13 -0
- data/fixtures/import-app/bower_components/jquery/src/event.js +868 -0
- data/fixtures/import-app/bower_components/jquery/src/event/ajax.js +13 -0
- data/fixtures/import-app/bower_components/jquery/src/event/alias.js +39 -0
- data/fixtures/import-app/bower_components/jquery/src/event/support.js +9 -0
- data/fixtures/import-app/bower_components/jquery/src/exports/amd.js +24 -0
- data/fixtures/import-app/bower_components/jquery/src/exports/global.js +32 -0
- data/fixtures/import-app/bower_components/jquery/src/intro.js +44 -0
- data/fixtures/import-app/bower_components/jquery/src/jquery.js +37 -0
- data/fixtures/import-app/bower_components/jquery/src/manipulation.js +580 -0
- data/fixtures/import-app/bower_components/jquery/src/manipulation/_evalUrl.js +18 -0
- data/fixtures/import-app/bower_components/jquery/src/manipulation/support.js +32 -0
- data/fixtures/import-app/bower_components/jquery/src/manipulation/var/rcheckableType.js +3 -0
- data/fixtures/import-app/bower_components/jquery/src/offset.js +207 -0
- data/fixtures/import-app/bower_components/jquery/src/outro.js +1 -0
- data/fixtures/import-app/bower_components/jquery/src/queue.js +142 -0
- data/fixtures/import-app/bower_components/jquery/src/queue/delay.js +22 -0
- data/fixtures/import-app/bower_components/jquery/src/selector-native.js +172 -0
- data/fixtures/import-app/bower_components/jquery/src/selector-sizzle.js +14 -0
- data/fixtures/import-app/bower_components/jquery/src/selector.js +1 -0
- data/fixtures/import-app/bower_components/jquery/src/serialize.js +111 -0
- data/fixtures/import-app/bower_components/jquery/src/sizzle/dist/sizzle.js +2067 -0
- data/fixtures/import-app/bower_components/jquery/src/sizzle/dist/sizzle.min.js +3 -0
- data/fixtures/import-app/bower_components/jquery/src/sizzle/dist/sizzle.min.map +1 -0
- data/fixtures/import-app/bower_components/jquery/src/traversing.js +199 -0
- data/fixtures/import-app/bower_components/jquery/src/traversing/findFilter.js +100 -0
- data/fixtures/import-app/bower_components/jquery/src/traversing/var/rneedsContext.js +6 -0
- data/fixtures/import-app/bower_components/jquery/src/var/arr.js +3 -0
- data/fixtures/import-app/bower_components/jquery/src/var/class2type.js +4 -0
- data/fixtures/import-app/bower_components/jquery/src/var/concat.js +5 -0
- data/fixtures/import-app/bower_components/jquery/src/var/hasOwn.js +5 -0
- data/fixtures/import-app/bower_components/jquery/src/var/indexOf.js +5 -0
- data/fixtures/import-app/bower_components/jquery/src/var/pnum.js +3 -0
- data/fixtures/import-app/bower_components/jquery/src/var/push.js +5 -0
- data/fixtures/import-app/bower_components/jquery/src/var/rnotwhite.js +3 -0
- data/fixtures/import-app/bower_components/jquery/src/var/slice.js +5 -0
- data/fixtures/import-app/bower_components/jquery/src/var/strundefined.js +3 -0
- data/fixtures/import-app/bower_components/jquery/src/var/support.js +4 -0
- data/fixtures/import-app/bower_components/jquery/src/var/toString.js +5 -0
- data/fixtures/import-app/bower_components/jquery/src/wrap.js +79 -0
- data/fixtures/import-app/config.rb +7 -0
- data/fixtures/{twitter-bootstrap-app/config.rb → import-app/source/test.html} +0 -0
- data/fixtures/import-app/static.html +1 -0
- data/fixtures/javascript-app/config.rb +0 -0
- data/fixtures/javascript-app/source/index.html +17 -0
- data/fixtures/minify-css-app/source/inline-css.php +8 -0
- data/fixtures/minify-css-app/source/stylesheets/base/_base.scss +15 -0
- data/fixtures/minify-css-app/source/stylesheets/base/_buttons.scss +35 -0
- data/fixtures/minify-css-app/source/stylesheets/base/_forms.scss +90 -0
- data/fixtures/minify-css-app/source/stylesheets/base/_grid-settings.scss +14 -0
- data/fixtures/minify-css-app/source/stylesheets/base/_lists.scss +31 -0
- data/fixtures/minify-css-app/source/stylesheets/base/_tables.scss +25 -0
- data/fixtures/minify-css-app/source/stylesheets/base/_typography.scss +49 -0
- data/fixtures/minify-css-app/source/stylesheets/base/_variables.scss +42 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/_bourbon-deprecated-upcoming.scss +411 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/_bourbon.scss +87 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_border-color.scss +26 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_border-radius.scss +48 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_border-style.scss +25 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_border-width.scss +25 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_buttons.scss +64 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_clearfix.scss +25 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_ellipsis.scss +30 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_font-stacks.scss +31 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_hide-text.scss +27 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_margin.scss +26 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_padding.scss +26 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_position.scss +48 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_prefixer.scss +66 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_retina-image.scss +25 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_size.scss +51 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_text-inputs.scss +113 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_timing-functions.scss +34 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_triangle.scss +63 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/addons/_word-wrap.scss +29 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_animation.scss +43 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_appearance.scss +3 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_backface-visibility.scss +3 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_background-image.scss +42 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_background.scss +55 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_border-image.scss +59 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_calc.scss +4 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_columns.scss +47 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_filter.scss +4 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_flex-box.scss +287 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_font-face.scss +24 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_font-feature-settings.scss +4 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_hidpi-media-query.scss +10 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_hyphens.scss +4 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_image-rendering.scss +14 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_keyframes.scss +36 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_linear-gradient.scss +38 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_perspective.scss +8 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_placeholder.scss +8 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_radial-gradient.scss +39 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_selection.scss +42 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_text-decoration.scss +19 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_transform.scss +15 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_transition.scss +71 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/css3/_user-select.scss +3 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/functions/_assign-inputs.scss +11 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/functions/_contains-falsy.scss +20 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/functions/_contains.scss +26 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/functions/_is-length.scss +11 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/functions/_is-light.scss +21 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/functions/_is-number.scss +11 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/functions/_is-size.scss +13 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/functions/_modular-scale.scss +69 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/functions/_px-to-em.scss +13 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/functions/_px-to-rem.scss +15 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/functions/_shade.scss +24 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/functions/_strip-units.scss +17 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/functions/_tint.scss +24 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/functions/_transition-property-name.scss +22 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/functions/_unpack.scss +27 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/helpers/_convert-units.scss +21 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/helpers/_directional-values.scss +96 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/helpers/_font-source-declaration.scss +43 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/helpers/_gradient-positions-parser.scss +13 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/helpers/_linear-angle-parser.scss +25 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/helpers/_linear-gradient-parser.scss +41 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/helpers/_linear-positions-parser.scss +61 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/helpers/_linear-side-corner-parser.scss +31 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/helpers/_radial-arg-parser.scss +69 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/helpers/_radial-gradient-parser.scss +50 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/helpers/_radial-positions-parser.scss +18 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/helpers/_render-gradients.scss +26 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/helpers/_shape-size-stripper.scss +10 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/helpers/_str-to-num.scss +50 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/settings/_asset-pipeline.scss +7 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/settings/_prefixer.scss +9 -0
- data/fixtures/minify-css-app/source/stylesheets/bourbon/settings/_px-to-em.scss +1 -0
- data/fixtures/minify-css-app/source/stylesheets/site.xcss.sass +6 -0
- data/fixtures/minify-js-app/source/inline-js.php +22 -0
- data/fixtures/minify-js-app/source/javascripts/js_test.xjs +8 -0
- data/fixtures/partials-app/source/locals.html.erb +1 -1
- data/fixtures/preview-server-app/bin/dns_server.rb +33 -0
- data/fixtures/preview-server-app/config.rb +0 -0
- data/fixtures/preview-server-app/source/index.html.erb +1 -0
- data/fixtures/preview-server-app/source/layout.erb +9 -0
- data/fixtures/preview-server-app/source/layouts/custom.erb +8 -0
- data/fixtures/preview-server-app/source/real.html +1 -0
- data/fixtures/preview-server-app/source/real/index.html.erb +5 -0
- data/fixtures/preview-server-app/source/should_be_ignored.html +1 -0
- data/fixtures/preview-server-app/source/should_be_ignored2.html +1 -0
- data/fixtures/preview-server-app/source/should_be_ignored3.html +1 -0
- data/fixtures/preview-server-app/source/static.html +1 -0
- data/fixtures/preview-server-hook-app/config.rb +19 -0
- data/fixtures/preview-server-hook-app/source/index.html.erb +9 -0
- data/fixtures/related-files-app/config.rb +0 -0
- data/fixtures/related-files-app/source/index.html.erb +0 -0
- data/fixtures/related-files-app/source/partials/_test.erb +0 -0
- data/fixtures/related-files-app/source/partials/_test2.haml +0 -0
- data/fixtures/related-files-app/source/stylesheets/_include3.sass +0 -0
- data/fixtures/related-files-app/source/stylesheets/_include4.scss +0 -0
- data/fixtures/related-files-app/source/stylesheets/include1.css +0 -0
- data/fixtures/related-files-app/source/stylesheets/include2.css.scss +0 -0
- data/fixtures/related-files-app/source/stylesheets/site.css.scss +0 -0
- data/fixtures/relative-assets-app/source/absolute_image_relative_css.html.erb +9 -0
- data/fixtures/relative-assets-app/source/javascripts/app.js +3 -0
- data/fixtures/relative-assets-app/source/relative_image.html.erb +1 -0
- data/fixtures/relative-assets-app/source/relative_image_absolute_css.html.erb +9 -0
- data/lib/middleman-core/application.rb +44 -18
- data/lib/middleman-core/builder.rb +1 -27
- data/lib/middleman-core/callback_manager.rb +3 -3
- data/lib/middleman-core/configuration.rb +1 -1
- data/lib/middleman-core/core_extensions/collections/step_context.rb +1 -1
- data/lib/middleman-core/core_extensions/data.rb +2 -2
- data/lib/middleman-core/core_extensions/default_helpers.rb +37 -3
- data/lib/middleman-core/core_extensions/external_helpers.rb +2 -1
- data/lib/middleman-core/core_extensions/front_matter.rb +5 -2
- data/lib/middleman-core/core_extensions/i18n.rb +95 -29
- data/lib/middleman-core/core_extensions/routing.rb +2 -2
- data/lib/middleman-core/dns_resolver.rb +73 -0
- data/lib/middleman-core/dns_resolver/basic_network_resolver.rb +52 -0
- data/lib/middleman-core/dns_resolver/hosts_resolver.rb +63 -0
- data/lib/middleman-core/dns_resolver/local_link_resolver.rb +44 -0
- data/lib/middleman-core/dns_resolver/network_resolver.rb +42 -0
- data/lib/middleman-core/extension.rb +1 -1
- data/lib/middleman-core/extensions/asset_hash.rb +3 -3
- data/lib/middleman-core/extensions/automatic_image_sizes.rb +9 -1
- data/lib/middleman-core/extensions/minify_css.rb +49 -17
- data/lib/middleman-core/extensions/minify_javascript.rb +60 -30
- data/lib/middleman-core/extensions/relative_assets.rb +13 -0
- data/lib/middleman-core/file_renderer.rb +2 -2
- data/lib/middleman-core/meta_pages.rb +1 -1
- data/lib/middleman-core/preview_server.rb +109 -47
- data/lib/middleman-core/preview_server/checks.rb +81 -0
- data/lib/middleman-core/preview_server/information.rb +273 -0
- data/lib/middleman-core/preview_server/network_interface_inventory.rb +65 -0
- data/lib/middleman-core/preview_server/server_hostname.rb +39 -0
- data/lib/middleman-core/preview_server/server_information.rb +153 -0
- data/lib/middleman-core/preview_server/server_information_callback_proxy.rb +35 -0
- data/lib/middleman-core/preview_server/server_information_validator.rb +18 -0
- data/lib/middleman-core/preview_server/server_ip_address.rb +55 -0
- data/lib/middleman-core/preview_server/server_url.rb +63 -0
- data/lib/middleman-core/preview_server/tcp_port_prober.rb +29 -0
- data/lib/middleman-core/rack.rb +7 -1
- data/lib/middleman-core/renderers/haml.rb +1 -2
- data/lib/middleman-core/renderers/liquid.rb +1 -1
- data/lib/middleman-core/renderers/sass.rb +23 -36
- data/lib/middleman-core/renderers/sass_functions.rb +20 -22
- data/lib/middleman-core/sitemap/extensions/ignores.rb +5 -1
- data/lib/middleman-core/sitemap/extensions/import.rb +108 -0
- data/lib/middleman-core/sitemap/extensions/move_file.rb +68 -0
- data/lib/middleman-core/sitemap/extensions/proxies.rb +7 -2
- data/lib/middleman-core/sitemap/extensions/redirects.rb +1 -0
- data/lib/middleman-core/sitemap/resource.rb +3 -7
- data/lib/middleman-core/sitemap/store.rb +22 -19
- data/lib/middleman-core/sources.rb +2 -3
- data/lib/middleman-core/sources/source_watcher.rb +21 -37
- data/lib/middleman-core/step_definitions.rb +1 -0
- data/lib/middleman-core/step_definitions/builder_steps.rb +0 -47
- data/lib/middleman-core/step_definitions/commandline_steps.rb +88 -0
- data/lib/middleman-core/step_definitions/middleman_steps.rb +51 -6
- data/lib/middleman-core/step_definitions/server_steps.rb +21 -53
- data/lib/middleman-core/template_context.rb +14 -13
- data/lib/middleman-core/util.rb +127 -4
- data/lib/middleman-core/util/data.rb +87 -138
- data/lib/middleman-core/version.rb +1 -1
- data/middleman-core.gemspec +11 -11
- data/spec/middleman-core/dns_resolver_spec.rb +118 -0
- data/spec/middleman-core/preview_server/server_hostname_spec.rb +39 -0
- data/spec/middleman-core/preview_server/server_ip_address_spec.rb +43 -0
- data/spec/middleman-core/util_spec.rb +111 -3
- data/spec/spec_helper.rb +29 -1
- data/spec/support/given.rb +42 -0
- metadata +528 -221
- data/features/twitter-bootstrap-compile.feature +0 -6
- data/features/working_directory.feature +0 -33
- data/fixtures/collections-app/config.rb +0 -16
- data/fixtures/collections-app/source/index.html.erb +0 -26
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/.gitignore +0 -36
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/.travis.yml +0 -3
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/LICENSE +0 -176
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/README.md +0 -137
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/img/glyphicons-halflings-white.png +0 -0
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/img/glyphicons-halflings.png +0 -0
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/.jshintrc +0 -10
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/README.md +0 -112
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/bootstrap-alert.js +0 -90
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/bootstrap-button.js +0 -96
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/bootstrap-carousel.js +0 -169
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/bootstrap-collapse.js +0 -157
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/bootstrap-dropdown.js +0 -100
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/bootstrap-modal.js +0 -218
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/bootstrap-popover.js +0 -98
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/bootstrap-scrollspy.js +0 -151
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/bootstrap-tab.js +0 -135
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/bootstrap-tooltip.js +0 -275
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/bootstrap-transition.js +0 -61
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/bootstrap-typeahead.js +0 -285
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/index.html +0 -54
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/phantom.js +0 -63
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/server.js +0 -14
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/unit/bootstrap-alert.js +0 -56
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/unit/bootstrap-button.js +0 -77
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/unit/bootstrap-carousel.js +0 -28
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/unit/bootstrap-collapse.js +0 -54
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/unit/bootstrap-dropdown.js +0 -87
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/unit/bootstrap-modal.js +0 -114
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/unit/bootstrap-phantom.js +0 -21
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/unit/bootstrap-popover.js +0 -93
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/unit/bootstrap-scrollspy.js +0 -31
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/unit/bootstrap-tab.js +0 -61
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/unit/bootstrap-tooltip.js +0 -155
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/unit/bootstrap-transition.js +0 -13
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/unit/bootstrap-typeahead.js +0 -148
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/vendor/jquery.js +0 -9252
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/vendor/qunit.css +0 -232
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/js/tests/vendor/qunit.js +0 -1510
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_accordion.less +0 -33
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_alerts.less +0 -58
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_breadcrumbs.less +0 -24
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_button-groups.less +0 -191
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_buttons.less +0 -191
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_carousel.less +0 -121
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_close.less +0 -29
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_code.less +0 -57
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_component-animations.less +0 -20
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_dropdowns.less +0 -143
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_forms.less +0 -583
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_grid.less +0 -5
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_hero-unit.less +0 -22
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_labels-badges.less +0 -55
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_layouts.less +0 -17
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_mixins.less +0 -646
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_modals.less +0 -90
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_navbar.less +0 -358
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_navs.less +0 -363
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_pager.less +0 -36
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_pagination.less +0 -56
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_popovers.less +0 -49
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_progress-bars.less +0 -117
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_reset.less +0 -131
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_responsive-1200px-min.less +0 -26
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_responsive-767px-max.less +0 -149
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_responsive-768px-979px.less +0 -17
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_responsive-navbar.less +0 -153
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_responsive-utilities.less +0 -41
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_scaffolding.less +0 -29
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_sprites.less +0 -191
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_tables.less +0 -176
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_thumbnails.less +0 -47
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_tooltip.less +0 -35
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_type.less +0 -232
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_utilities.less +0 -23
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_variables.less +0 -206
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/_wells.less +0 -27
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/bootstrap.less +0 -62
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/responsive.less +0 -48
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/tests/css-tests.css +0 -52
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/tests/css-tests.html +0 -917
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/tests/forms.html +0 -179
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/less/tests/navbar.html +0 -108
- data/fixtures/twitter-bootstrap-app/source/twitter-bootstrap-ebc6935/package.json +0 -25
- data/lib/middleman-core/cli/server.rb +0 -96
@@ -1,6 +1,10 @@
|
|
1
|
-
module
|
1
|
+
module Middleman
|
2
2
|
module Sass
|
3
3
|
module Functions
|
4
|
+
def asset_path(_source, _options)
|
5
|
+
# current_resource
|
6
|
+
end
|
7
|
+
|
4
8
|
# Using Middleman::Util#asset_path, return the full path
|
5
9
|
# for the given +source+ as a Sass String. This supports keyword
|
6
10
|
# arguments that mirror the +options+.
|
@@ -81,36 +85,30 @@ module Sprockets
|
|
81
85
|
options[:custom][:middleman_context]
|
82
86
|
end
|
83
87
|
|
88
|
+
# Returns a reference to Middleman's current resource.
|
89
|
+
def current_resource # :nodoc:
|
90
|
+
options[:custom][:current_resource]
|
91
|
+
end
|
92
|
+
|
84
93
|
# Returns an options hash where the keys are symbolized
|
85
94
|
# and the values are unwrapped Sass literals.
|
86
95
|
def map_options(options={}) # :nodoc:
|
87
96
|
::Sass::Util.map_hash(options) do |key, value|
|
88
97
|
[key.to_sym, value.respond_to?(:value) ? value.value : value]
|
89
98
|
end
|
99
|
+
|
100
|
+
options[:current_resource] = current_resource
|
101
|
+
|
102
|
+
options
|
90
103
|
end
|
91
104
|
end
|
92
105
|
end
|
93
106
|
end
|
94
107
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
# don't take precedence.
|
100
|
-
[:asset_path, :asset_url, :image_path, :image_url, :font_path, :font_url, :asset_data_uri].each do |method|
|
101
|
-
defined?(@signatures) && @signatures.delete(method)
|
102
|
-
end
|
103
|
-
|
104
|
-
declare :asset_path, [:source], var_kwargs: true
|
105
|
-
declare :asset_path, [:source, :kind]
|
106
|
-
declare :asset_url, [:source], var_kwargs: true
|
107
|
-
declare :asset_url, [:source, :kind]
|
108
|
-
declare :image_path, [:source], var_kwargs: true
|
109
|
-
declare :image_url, [:source], var_kwargs: true
|
110
|
-
declare :image_url, [:source, :only_path]
|
111
|
-
declare :image_url, [:source, :only_path, :cache_buster]
|
112
|
-
declare :font_path, [:source], var_kwargs: true
|
113
|
-
declare :font_url, [:source], var_kwargs: true
|
114
|
-
declare :font_url, [:source, :only_path]
|
115
|
-
declare :asset_data_uri, [:source]
|
108
|
+
SASS_MODULE = if defined?(::SassC)
|
109
|
+
::SassC
|
110
|
+
else
|
111
|
+
::Sass
|
116
112
|
end
|
113
|
+
|
114
|
+
SASS_MODULE::Script::Functions.send :include, ::Middleman::Sass::Functions
|
@@ -30,7 +30,11 @@ module Middleman
|
|
30
30
|
elsif path.is_a? String
|
31
31
|
path_clean = ::Middleman::Util.normalize_path(path)
|
32
32
|
if path_clean.include?('*') # It's a glob
|
33
|
-
|
33
|
+
if defined? File::FNM_EXTGLOB
|
34
|
+
@ignored_callbacks << proc { |p| File.fnmatch(path_clean, p, File::FNM_EXTGLOB) }
|
35
|
+
else
|
36
|
+
@ignored_callbacks << proc { |p| File.fnmatch(path_clean, p) }
|
37
|
+
end
|
34
38
|
else
|
35
39
|
# Add a specific-path ignore unless that path is already covered
|
36
40
|
return if ignored?(path_clean)
|
@@ -0,0 +1,108 @@
|
|
1
|
+
require 'set'
|
2
|
+
require 'middleman-core/contracts'
|
3
|
+
|
4
|
+
module Middleman
|
5
|
+
module Sitemap
|
6
|
+
module Extensions
|
7
|
+
class Import < Extension
|
8
|
+
self.resource_list_manipulator_priority = 1
|
9
|
+
|
10
|
+
ImportFileDescriptor = Struct.new(:from, :to)
|
11
|
+
ImportPathDescriptor = Struct.new(:from, :renameProc)
|
12
|
+
|
13
|
+
# Expose `create_import_file` to config as `import_file`
|
14
|
+
expose_to_config import_file: :create_import_file
|
15
|
+
|
16
|
+
# Expose `create_import_path` to config as `import_path`
|
17
|
+
expose_to_config import_path: :create_import_path
|
18
|
+
|
19
|
+
def initialize(app, config={}, &block)
|
20
|
+
super
|
21
|
+
|
22
|
+
@import_file_configs = Set.new
|
23
|
+
@import_path_configs = Set.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def after_configuration
|
27
|
+
::Middleman::CoreExtensions::Collections::StepContext.add_to_context(:import_file, &method(:create_import_file))
|
28
|
+
::Middleman::CoreExtensions::Collections::StepContext.add_to_context(:import_path, &method(:create_import_path))
|
29
|
+
end
|
30
|
+
|
31
|
+
# Import an external file into `source`
|
32
|
+
# @param [String] from The original path.
|
33
|
+
# @param [String] to The new path.
|
34
|
+
# @return [void]
|
35
|
+
Contract String, String => Any
|
36
|
+
def create_import_file(from, to)
|
37
|
+
@import_file_configs << create_anonymous_import_file(from, to)
|
38
|
+
@app.sitemap.rebuild_resource_list!(:added_import_file)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Import an external file into `source`
|
42
|
+
# @param [String] from The original path.
|
43
|
+
# @param [String] to The new path.
|
44
|
+
# @return [ImportFileDescriptor]
|
45
|
+
Contract String, String => ImportFileDescriptor
|
46
|
+
def create_anonymous_import_file(from, to)
|
47
|
+
ImportFileDescriptor.new(
|
48
|
+
File.expand_path(from, @app.root),
|
49
|
+
::Middleman::Util.normalize_path(to)
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Import an external glob into `source`
|
54
|
+
# @param [String] from The original path.
|
55
|
+
# @param [Proc] block Renaming method
|
56
|
+
# @return [void]
|
57
|
+
Contract String, Maybe[Proc] => Any
|
58
|
+
def create_import_path(from, &block)
|
59
|
+
rename_proc = block_given? ? block : proc { |path| path }
|
60
|
+
@import_path_configs << create_anonymous_import_path(from, rename_proc)
|
61
|
+
@app.sitemap.rebuild_resource_list!(:added_import_path)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Import an external glob into `source`
|
65
|
+
# @param [String] from The original path.
|
66
|
+
# @param [Proc] block Renaming method
|
67
|
+
# @return [ImportPathDescriptor]
|
68
|
+
Contract String, Proc => ImportPathDescriptor
|
69
|
+
def create_anonymous_import_path(from, block)
|
70
|
+
ImportPathDescriptor.new(
|
71
|
+
from,
|
72
|
+
block
|
73
|
+
)
|
74
|
+
end
|
75
|
+
|
76
|
+
Contract IsA['Middleman::SourceFile'] => Bool
|
77
|
+
def ignored?(file)
|
78
|
+
@app.config[:ignored_sitemap_matchers].any? { |_, fn| fn.call(file, @app) }
|
79
|
+
end
|
80
|
+
|
81
|
+
# Update the main sitemap resource list
|
82
|
+
# @return Array<Middleman::Sitemap::Resource>
|
83
|
+
Contract ResourceList => ResourceList
|
84
|
+
def manipulate_resource_list(resources)
|
85
|
+
resources + @import_file_configs.map { |c|
|
86
|
+
::Middleman::Sitemap::Resource.new(
|
87
|
+
@app.sitemap,
|
88
|
+
c[:to],
|
89
|
+
c[:from]
|
90
|
+
)
|
91
|
+
} + @import_path_configs.flat_map { |c|
|
92
|
+
::Middleman::Util.glob_directory(File.join(c[:from], '**/*'))
|
93
|
+
.reject { |path| File.directory?(path) }
|
94
|
+
.map do |path|
|
95
|
+
target_path = Pathname(path).relative_path_from(Pathname(c[:from]).parent).to_s
|
96
|
+
|
97
|
+
::Middleman::Sitemap::Resource.new(
|
98
|
+
@app.sitemap,
|
99
|
+
c[:renameProc].call(target_path, path),
|
100
|
+
path
|
101
|
+
)
|
102
|
+
end
|
103
|
+
}
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'middleman-core/sitemap/resource'
|
2
|
+
require 'middleman-core/core_extensions/collections/step_context'
|
3
|
+
|
4
|
+
module Middleman
|
5
|
+
module Sitemap
|
6
|
+
module Extensions
|
7
|
+
# Manages the list of proxy configurations and manipulates the sitemap
|
8
|
+
# to include new resources based on those configurations
|
9
|
+
class MoveFile < Extension
|
10
|
+
MoveFileDescriptor = Struct.new(:from, :to)
|
11
|
+
|
12
|
+
self.resource_list_manipulator_priority = 101
|
13
|
+
|
14
|
+
# Expose `create_move_file` to config as `move_file`
|
15
|
+
expose_to_config move_file: :create_move_file
|
16
|
+
|
17
|
+
def initialize(app, config={}, &block)
|
18
|
+
super
|
19
|
+
|
20
|
+
@move_configs = Set.new
|
21
|
+
end
|
22
|
+
|
23
|
+
def after_configuration
|
24
|
+
::Middleman::CoreExtensions::Collections::StepContext.add_to_context(:move_file, &method(:create_move_file))
|
25
|
+
end
|
26
|
+
|
27
|
+
# Setup a move from one path to another
|
28
|
+
# @param [String] from The original path.
|
29
|
+
# @param [String] to The new path.
|
30
|
+
# @return [void]
|
31
|
+
Contract String, String => Any
|
32
|
+
def create_move_file(from, to)
|
33
|
+
@move_configs << create_anonymous_move(from, to)
|
34
|
+
@app.sitemap.rebuild_resource_list!(:added_move_file)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Setup a move from one path to another
|
38
|
+
# @param [String] from The original path.
|
39
|
+
# @param [String] to The new path.
|
40
|
+
# @return [MoveFileDescriptor]
|
41
|
+
Contract String, String => MoveFileDescriptor
|
42
|
+
def create_anonymous_move(from, to)
|
43
|
+
MoveFileDescriptor.new(
|
44
|
+
::Middleman::Util.normalize_path(from),
|
45
|
+
::Middleman::Util.normalize_path(to)
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Update the main sitemap resource list
|
50
|
+
# @return Array<Middleman::Sitemap::Resource>
|
51
|
+
Contract ResourceList => ResourceList
|
52
|
+
def manipulate_resource_list(resources)
|
53
|
+
resources.each do |r|
|
54
|
+
matches = @move_configs.select do |c|
|
55
|
+
c.from == r.path || c.from == r.destination_path
|
56
|
+
end
|
57
|
+
|
58
|
+
if c = matches.last
|
59
|
+
r.destination_path = c.to
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
resources
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -86,8 +86,8 @@ module Middleman
|
|
86
86
|
end
|
87
87
|
|
88
88
|
class Resource
|
89
|
-
def proxy_to(
|
90
|
-
throw
|
89
|
+
def proxy_to(_path)
|
90
|
+
throw 'Resource#proxy_to has been removed. Use ProxyResource class instead.'
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
@@ -141,6 +141,11 @@ module Middleman
|
|
141
141
|
|
142
142
|
target_resource.content_type
|
143
143
|
end
|
144
|
+
|
145
|
+
def to_s
|
146
|
+
"#<#{self.class} path=#{@path} target=#{@target}>"
|
147
|
+
end
|
148
|
+
alias_method :inspect, :to_s
|
144
149
|
end
|
145
150
|
end
|
146
151
|
end
|
@@ -48,9 +48,7 @@ module Middleman
|
|
48
48
|
@app = @store.app
|
49
49
|
@path = path
|
50
50
|
|
51
|
-
if source && source.is_a?(String)
|
52
|
-
source = Pathname(source)
|
53
|
-
end
|
51
|
+
source = Pathname(source) if source && source.is_a?(String)
|
54
52
|
|
55
53
|
if source && source.is_a?(Pathname)
|
56
54
|
@file_descriptor = ::Middleman::SourceFile.new(source.relative_path_from(@app.source_dir), source, @app.source_dir, Set.new([:source]))
|
@@ -135,9 +133,7 @@ module Middleman
|
|
135
133
|
locs[:current_path] ||= destination_path
|
136
134
|
|
137
135
|
# Certain output file types don't use layouts
|
138
|
-
|
139
|
-
opts[:layout] = false if %w(.js .json .css .txt).include?(ext)
|
140
|
-
end
|
136
|
+
opts[:layout] = false if !opts.key?(:layout) && ext != '.html'
|
141
137
|
|
142
138
|
renderer = ::Middleman::TemplateRenderer.new(@app, file_descriptor[:full_path].to_s)
|
143
139
|
renderer.render(locs, opts)
|
@@ -196,7 +192,7 @@ module Middleman
|
|
196
192
|
end
|
197
193
|
|
198
194
|
def to_s
|
199
|
-
"
|
195
|
+
"#<#{self.class} path=#{@path}>"
|
200
196
|
end
|
201
197
|
alias_method :inspect, :to_s # Ruby 2.0 calls inspect for NoMethodError instead of to_s
|
202
198
|
end
|
@@ -15,6 +15,12 @@ Middleman::Extensions.register :sitemap_ondisk, auto_activate: :before_configura
|
|
15
15
|
Middleman::Sitemap::Extensions::OnDisk
|
16
16
|
end
|
17
17
|
|
18
|
+
# Files on Disk (outside the project root)
|
19
|
+
Middleman::Extensions.register :sitemap_import, auto_activate: :before_configuration do
|
20
|
+
require 'middleman-core/sitemap/extensions/import'
|
21
|
+
Middleman::Sitemap::Extensions::Import
|
22
|
+
end
|
23
|
+
|
18
24
|
# Endpoints
|
19
25
|
Middleman::Extensions.register :sitemap_endpoint, auto_activate: :before_configuration do
|
20
26
|
require 'middleman-core/sitemap/extensions/request_endpoints'
|
@@ -33,6 +39,12 @@ Middleman::Extensions.register :sitemap_redirects, auto_activate: :before_config
|
|
33
39
|
Middleman::Sitemap::Extensions::Redirects
|
34
40
|
end
|
35
41
|
|
42
|
+
# Move Files
|
43
|
+
Middleman::Extensions.register :sitemap_move_files, auto_activate: :before_configuration do
|
44
|
+
require 'middleman-core/sitemap/extensions/move_file'
|
45
|
+
Middleman::Sitemap::Extensions::MoveFile
|
46
|
+
end
|
47
|
+
|
36
48
|
require 'middleman-core/contracts'
|
37
49
|
|
38
50
|
module Middleman
|
@@ -63,7 +75,7 @@ module Middleman
|
|
63
75
|
@resources = []
|
64
76
|
@update_count = 0
|
65
77
|
|
66
|
-
@resource_list_manipulators = ::Hamster.
|
78
|
+
@resource_list_manipulators = ::Hamster::Vector.empty
|
67
79
|
@needs_sitemap_rebuild = true
|
68
80
|
|
69
81
|
@lock = Monitor.new
|
@@ -174,7 +186,7 @@ module Middleman
|
|
174
186
|
Contract String => String
|
175
187
|
def extensionless_path(file)
|
176
188
|
path = file.dup
|
177
|
-
remove_templating_extensions(path)
|
189
|
+
::Middleman::Util.remove_templating_extensions(path)
|
178
190
|
end
|
179
191
|
|
180
192
|
# Actually update the resource list, assuming anything has called
|
@@ -187,23 +199,24 @@ module Middleman
|
|
187
199
|
|
188
200
|
@app.logger.debug '== Rebuilding resource list'
|
189
201
|
|
190
|
-
@resources =
|
202
|
+
@resources = []
|
203
|
+
|
204
|
+
@resource_list_manipulators.each do |m|
|
191
205
|
@app.logger.debug "== Running manipulator: #{m[:name]}"
|
192
|
-
|
206
|
+
@resources = m[:manipulator].send(m[:custom_name] || :manipulate_resource_list, @resources)
|
193
207
|
|
194
208
|
# Reset lookup cache
|
195
209
|
reset_lookup_cache!
|
196
210
|
|
197
211
|
# Rebuild cache
|
198
|
-
|
212
|
+
@resources.each do |resource|
|
199
213
|
@_lookup_by_path[resource.path] = resource
|
200
214
|
@_lookup_by_destination_path[resource.destination_path] = resource
|
201
215
|
end
|
202
216
|
|
203
|
-
|
217
|
+
invalidate_resources_not_ignored_cache!
|
204
218
|
end
|
205
219
|
|
206
|
-
invalidate_resources_not_ignored_cache!
|
207
220
|
@update_count += 1
|
208
221
|
end
|
209
222
|
end
|
@@ -211,20 +224,10 @@ module Middleman
|
|
211
224
|
private
|
212
225
|
|
213
226
|
def reset_lookup_cache!
|
214
|
-
@lock.synchronize
|
227
|
+
@lock.synchronize do
|
215
228
|
@_lookup_by_path = {}
|
216
229
|
@_lookup_by_destination_path = {}
|
217
|
-
|
218
|
-
end
|
219
|
-
|
220
|
-
# Removes the templating extensions, while keeping the others
|
221
|
-
# @param [String] path
|
222
|
-
# @return [String]
|
223
|
-
Contract String => String
|
224
|
-
def remove_templating_extensions(path)
|
225
|
-
# Strip templating extensions as long as Tilt knows them
|
226
|
-
path = path.sub(File.extname(path), '') while ::Tilt[path]
|
227
|
-
path
|
230
|
+
end
|
228
231
|
end
|
229
232
|
|
230
233
|
# Remove the locale token from the end of the path
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'hamster'
|
2
2
|
require 'middleman-core/contracts'
|
3
|
-
require 'backports/2.0.0/enumerable/lazy'
|
4
3
|
|
5
4
|
module Middleman
|
6
5
|
# The standard "record" that contains information about a file on disk.
|
@@ -48,10 +47,10 @@ module Middleman
|
|
48
47
|
@options = options
|
49
48
|
|
50
49
|
# Set of procs wanting to be notified of changes
|
51
|
-
@on_change_callbacks = ::Hamster.
|
50
|
+
@on_change_callbacks = ::Hamster::Vector.empty
|
52
51
|
|
53
52
|
# Global ignores
|
54
|
-
@ignores = ::Hamster.
|
53
|
+
@ignores = ::Hamster::Hash.empty
|
55
54
|
|
56
55
|
# Whether we're "running", which means we're in a stable
|
57
56
|
# watch state after all initialization and config.
|
@@ -1,23 +1,19 @@
|
|
1
1
|
# Watcher Library
|
2
2
|
require 'listen'
|
3
3
|
require 'middleman-core/contracts'
|
4
|
-
require 'middleman-core/contracts'
|
5
|
-
require 'backports/2.0.0/enumerable/lazy'
|
6
4
|
|
7
5
|
# Monkey patch Listen silencer so `only` works on directories too
|
8
6
|
module Listen
|
9
7
|
class Silencer
|
10
8
|
# TODO: switch type and path places - and verify
|
11
|
-
def silenced?(relative_path,
|
9
|
+
def silenced?(relative_path, _type)
|
12
10
|
path = relative_path.to_s
|
13
11
|
|
14
12
|
# if only_patterns && type == :file
|
15
13
|
# return true unless only_patterns.any? { |pattern| path =~ pattern }
|
16
14
|
# end
|
17
15
|
|
18
|
-
if only_patterns
|
19
|
-
return !only_patterns.any? { |pattern| path =~ pattern }
|
20
|
-
end
|
16
|
+
return !only_patterns.any? { |pattern| path =~ pattern } if only_patterns
|
21
17
|
|
22
18
|
ignore_patterns.any? { |pattern| path =~ pattern }
|
23
19
|
end
|
@@ -125,6 +121,8 @@ module Middleman
|
|
125
121
|
# @return [Middleman::SourceFile, nil]
|
126
122
|
Contract Or[String, Pathname], Maybe[Bool] => Maybe[IsA['Middleman::SourceFile']]
|
127
123
|
def find(path, glob=false)
|
124
|
+
path = path.to_s.encode!('UTF-8', 'UTF-8-MAC') if RUBY_PLATFORM =~ /darwin/
|
125
|
+
|
128
126
|
p = Pathname(path)
|
129
127
|
|
130
128
|
return nil if p.absolute? && !p.to_s.start_with?(@directory.to_s)
|
@@ -163,7 +161,7 @@ module Middleman
|
|
163
161
|
@listener = ::Listen.to(@directory.to_s, config, &method(:on_listener_change))
|
164
162
|
|
165
163
|
@listener.ignore(/^\.sass-cache/)
|
166
|
-
@listener.only(@only) unless @only.empty?
|
164
|
+
# @listener.only(@only) unless @only.empty?
|
167
165
|
|
168
166
|
@listener.start
|
169
167
|
end
|
@@ -184,14 +182,8 @@ module Middleman
|
|
184
182
|
# @return [void]
|
185
183
|
Contract Any
|
186
184
|
def poll_once!
|
187
|
-
|
188
|
-
|
189
|
-
updated = []
|
190
|
-
|
191
|
-
::Middleman::Util.all_files_under(@directory.to_s).each do |filepath|
|
192
|
-
removed.delete(filepath)
|
193
|
-
updated << filepath
|
194
|
-
end
|
185
|
+
updated = ::Middleman::Util.all_files_under(@directory.to_s)
|
186
|
+
removed = @files.keys.reject { |p| updated.include?(p) }
|
195
187
|
|
196
188
|
update(updated, removed)
|
197
189
|
|
@@ -234,14 +226,21 @@ module Middleman
|
|
234
226
|
Contract ArrayOf[Pathname], ArrayOf[Pathname] => Any
|
235
227
|
def update(updated_paths, removed_paths)
|
236
228
|
valid_updates = updated_paths
|
237
|
-
.
|
238
|
-
.map(&method(:path_to_source_file))
|
229
|
+
.map { |p| ::Middleman::Util.path_to_source_file(p, @directory, @type, @options.fetch(:destination_dir, false)) }
|
239
230
|
.select(&method(:valid?))
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
231
|
+
|
232
|
+
valid_updates.each do |f|
|
233
|
+
add_file_to_cache(f)
|
234
|
+
logger.debug "== Change (#{f[:types].inspect}): #{f[:relative_path]}"
|
235
|
+
end
|
236
|
+
|
237
|
+
related_updates = ::Middleman::Util.find_related_files(app, (updated_paths + removed_paths)).select(&method(:valid?))
|
238
|
+
|
239
|
+
related_updates.each do |f|
|
240
|
+
logger.debug "== Possible Change (#{f[:types].inspect}): #{f[:relative_path]}"
|
241
|
+
end
|
242
|
+
|
243
|
+
valid_updates |= related_updates
|
245
244
|
|
246
245
|
valid_removes = removed_paths
|
247
246
|
.lazy
|
@@ -291,20 +290,5 @@ module Middleman
|
|
291
290
|
@only.any? { |reg| reg.match(file[:relative_path].to_s) }
|
292
291
|
end
|
293
292
|
end
|
294
|
-
|
295
|
-
# Convert a path to a file resprentation.
|
296
|
-
#
|
297
|
-
# @param [Pathname] path The path.
|
298
|
-
# @return [Middleman::SourceFile]
|
299
|
-
Contract Pathname => IsA['Middleman::SourceFile']
|
300
|
-
def path_to_source_file(path)
|
301
|
-
types = Set.new([@type])
|
302
|
-
|
303
|
-
relative_path = path.relative_path_from(@directory)
|
304
|
-
destination_dir = @options.fetch(:destination_dir, false)
|
305
|
-
relative_path = File.join(destination_dir, relative_path) if destination_dir
|
306
|
-
|
307
|
-
::Middleman::SourceFile.new(Pathname(relative_path), path, @directory, types)
|
308
|
-
end
|
309
293
|
end
|
310
294
|
end
|