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,73 @@
|
|
1
|
+
# CLI Module
|
2
|
+
module Middleman::Cli
|
3
|
+
|
4
|
+
# Server thor task
|
5
|
+
class Server < Thor
|
6
|
+
check_unknown_options!
|
7
|
+
|
8
|
+
namespace :server
|
9
|
+
|
10
|
+
desc "server [options]", "Start the preview server"
|
11
|
+
method_option :environment,
|
12
|
+
:aliases => "-e",
|
13
|
+
:default => ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development',
|
14
|
+
:desc => "The environment Middleman will run under"
|
15
|
+
method_option :host,
|
16
|
+
:type => :string,
|
17
|
+
:aliases => "-h",
|
18
|
+
:default => "0.0.0.0",
|
19
|
+
:desc => "Bind to HOST address"
|
20
|
+
method_option :port,
|
21
|
+
:aliases => "-p",
|
22
|
+
:default => "4567",
|
23
|
+
:desc => "The port Middleman will listen on"
|
24
|
+
method_option :verbose,
|
25
|
+
:type => :boolean,
|
26
|
+
:default => false,
|
27
|
+
:desc => 'Print debug messages'
|
28
|
+
method_option :instrument,
|
29
|
+
:type => :string,
|
30
|
+
:default => false,
|
31
|
+
:desc => 'Print instrument messages'
|
32
|
+
method_option "disable-watcher",
|
33
|
+
:type => :boolean,
|
34
|
+
:default => false,
|
35
|
+
:desc => 'Disable the file change and delete watcher process'
|
36
|
+
method_option :profile,
|
37
|
+
:type => :boolean,
|
38
|
+
:default => false,
|
39
|
+
:desc => 'Generate profiling report for server startup'
|
40
|
+
|
41
|
+
# Start the server
|
42
|
+
def server
|
43
|
+
require "middleman-core"
|
44
|
+
require "middleman-core/preview_server"
|
45
|
+
|
46
|
+
if !ENV["MM_ROOT"]
|
47
|
+
puts "== Could not find a Middleman project config.rb"
|
48
|
+
puts "== Treating directory as a static site to be served"
|
49
|
+
ENV["MM_ROOT"] = Dir.pwd
|
50
|
+
ENV["MM_SOURCE"] = ""
|
51
|
+
end
|
52
|
+
|
53
|
+
params = {
|
54
|
+
:port => options["port"],
|
55
|
+
:host => options["host"],
|
56
|
+
:environment => options["environment"],
|
57
|
+
:debug => options["verbose"],
|
58
|
+
:instrumenting => options["instrument"],
|
59
|
+
:"disable-watcher" => options["disable-watcher"]
|
60
|
+
}
|
61
|
+
|
62
|
+
puts "== The Middleman is loading"
|
63
|
+
::Middleman::PreviewServer.start(params)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.exit_on_failure?
|
68
|
+
true
|
69
|
+
end
|
70
|
+
|
71
|
+
# Map "s" to "server"
|
72
|
+
Base.map({ "s" => "server" })
|
73
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# Require thor since that's what the who CLI is built around
|
2
|
+
require 'thor'
|
3
|
+
require "thor/group"
|
4
|
+
|
5
|
+
# CLI Module
|
6
|
+
module Middleman
|
7
|
+
|
8
|
+
module Cli
|
9
|
+
|
10
|
+
# The base task from which everything else etends
|
11
|
+
class Base < Thor
|
12
|
+
class << self
|
13
|
+
def start(*args)
|
14
|
+
# Change flag to a module
|
15
|
+
ARGV.unshift("help") if ARGV.delete("--help")
|
16
|
+
|
17
|
+
# Default command is server
|
18
|
+
if ARGV[0] != "help" && (ARGV.length < 1 || ARGV.first.include?("-"))
|
19
|
+
ARGV.unshift("server")
|
20
|
+
end
|
21
|
+
|
22
|
+
super
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
desc "version", "Show version"
|
27
|
+
def version
|
28
|
+
require 'middleman-core/version'
|
29
|
+
say "Middleman #{Middleman::VERSION}"
|
30
|
+
end
|
31
|
+
|
32
|
+
# Override the Thor help method to find help for subtasks
|
33
|
+
# @param [Symbol, String, nil] meth
|
34
|
+
# @param [Boolean] subcommand
|
35
|
+
# @return [void]
|
36
|
+
def help(meth = nil, subcommand = false)
|
37
|
+
if meth && !self.respond_to?(meth)
|
38
|
+
klass, task = Thor::Util.find_class_and_task_by_namespace("#{meth}:#{meth}")
|
39
|
+
klass.start(["-h", task].compact, :shell => self.shell)
|
40
|
+
else
|
41
|
+
list = []
|
42
|
+
Thor::Util.thor_classes_in(Middleman::Cli).each do |klass|
|
43
|
+
list += klass.printable_tasks(false)
|
44
|
+
end
|
45
|
+
list.sort!{ |a,b| a[0] <=> b[0] }
|
46
|
+
|
47
|
+
shell.say "Tasks:"
|
48
|
+
shell.print_table(list, :ident => 2, :truncate => true)
|
49
|
+
shell.say
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
# Intercept missing methods and search subtasks for them
|
54
|
+
# @param [Symbol] meth
|
55
|
+
def method_missing(meth, *args)
|
56
|
+
meth = meth.to_s
|
57
|
+
|
58
|
+
if self.class.map.has_key?(meth)
|
59
|
+
meth = self.class.map[meth]
|
60
|
+
end
|
61
|
+
|
62
|
+
klass, task = Thor::Util.find_class_and_task_by_namespace("#{meth}:#{meth}")
|
63
|
+
|
64
|
+
if klass.nil?
|
65
|
+
tasks_dir = File.join(Dir.pwd, "tasks")
|
66
|
+
|
67
|
+
if File.exists?(tasks_dir)
|
68
|
+
Dir[File.join(tasks_dir, "**/*_task.rb")].each { |f| require f }
|
69
|
+
klass, task = Thor::Util.find_class_and_task_by_namespace("#{meth}:#{meth}")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
if klass.nil?
|
74
|
+
super
|
75
|
+
else
|
76
|
+
args.unshift(task) if task
|
77
|
+
klass.start(args, :shell => self.shell)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# Include the core CLI items
|
85
|
+
require "middleman-core/cli/init"
|
86
|
+
require "middleman-core/cli/bundler"
|
87
|
+
require "middleman-core/cli/extension"
|
88
|
+
require "middleman-core/cli/server"
|
89
|
+
require "middleman-core/cli/build"
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Middleman
|
2
|
+
module CoreExtensions
|
3
|
+
|
4
|
+
# Convenience methods to allow config.rb to talk to the Builder
|
5
|
+
module Builder
|
6
|
+
|
7
|
+
# Extension registered
|
8
|
+
class << self
|
9
|
+
# @private
|
10
|
+
def registered(app)
|
11
|
+
app.define_hook :after_build
|
12
|
+
end
|
13
|
+
alias :included :registered
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,180 @@
|
|
1
|
+
module Middleman
|
2
|
+
module CoreExtensions
|
3
|
+
|
4
|
+
# The data extension parses YAML and JSON files in the data/ directory
|
5
|
+
# and makes them available to config.rb, templates and extensions
|
6
|
+
module Data
|
7
|
+
|
8
|
+
# Extension registered
|
9
|
+
class << self
|
10
|
+
# @private
|
11
|
+
def registered(app)
|
12
|
+
# Data formats
|
13
|
+
require "yaml"
|
14
|
+
require "active_support/json"
|
15
|
+
|
16
|
+
app.set :data_dir, "data"
|
17
|
+
app.send :include, InstanceMethods
|
18
|
+
end
|
19
|
+
alias :included :registered
|
20
|
+
end
|
21
|
+
|
22
|
+
# Instance methods
|
23
|
+
module InstanceMethods
|
24
|
+
# Setup data files before anything else so they are available when
|
25
|
+
# parsing config.rb
|
26
|
+
def initialize
|
27
|
+
self.files.changed DataStore.matcher do |file|
|
28
|
+
self.data.touch_file(file) if file.match(%r{^#{self.data_dir}\/})
|
29
|
+
end
|
30
|
+
|
31
|
+
self.files.deleted DataStore.matcher do |file|
|
32
|
+
self.data.remove_file(file) if file.match(%r{^#{self.data_dir}\/})
|
33
|
+
end
|
34
|
+
|
35
|
+
super
|
36
|
+
end
|
37
|
+
|
38
|
+
# The data object
|
39
|
+
#
|
40
|
+
# @return [DataStore]
|
41
|
+
def data
|
42
|
+
@_data ||= DataStore.new(self)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# The core logic behind the data extension.
|
47
|
+
class DataStore
|
48
|
+
|
49
|
+
# Static methods
|
50
|
+
class << self
|
51
|
+
|
52
|
+
# The regex which tells Middleman which files are for data
|
53
|
+
#
|
54
|
+
# @return [Regexp]
|
55
|
+
def matcher
|
56
|
+
%r{[\w-]+\.(yml|yaml|json)$}
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# Store static data hash
|
61
|
+
#
|
62
|
+
# @param [Symbol] name Name of the data, used for namespacing
|
63
|
+
# @param [Hash] content The content for this data
|
64
|
+
# @return [void]
|
65
|
+
def store(name=nil, content=nil)
|
66
|
+
@_local_sources ||= {}
|
67
|
+
@_local_sources[name.to_s] = content unless name.nil? || content.nil?
|
68
|
+
@_local_sources
|
69
|
+
end
|
70
|
+
|
71
|
+
# Store callback-based data
|
72
|
+
#
|
73
|
+
# @param [Symbol] name Name of the data, used for namespacing
|
74
|
+
# @param [Proc] proc The callback which will return data
|
75
|
+
# @return [void]
|
76
|
+
def callbacks(name=nil, proc=nil)
|
77
|
+
@_callback_sources ||= {}
|
78
|
+
@_callback_sources[name.to_s] = proc unless name.nil? || proc.nil?
|
79
|
+
@_callback_sources
|
80
|
+
end
|
81
|
+
|
82
|
+
# Setup data store
|
83
|
+
#
|
84
|
+
# @param [Middleman::Application] app The current instance of Middleman
|
85
|
+
def initialize(app)
|
86
|
+
@app = app
|
87
|
+
@local_data = {}
|
88
|
+
end
|
89
|
+
|
90
|
+
# Update the internal cache for a given file path
|
91
|
+
#
|
92
|
+
# @param [String] file The file to be re-parsed
|
93
|
+
# @return [void]
|
94
|
+
def touch_file(file)
|
95
|
+
file = File.expand_path(file, @app.root)
|
96
|
+
extension = File.extname(file)
|
97
|
+
basename = File.basename(file, extension)
|
98
|
+
|
99
|
+
if %w(.yaml .yml).include?(extension)
|
100
|
+
data = YAML.load_file(file)
|
101
|
+
elsif extension == ".json"
|
102
|
+
data = ActiveSupport::JSON.decode(File.read(file))
|
103
|
+
else
|
104
|
+
return
|
105
|
+
end
|
106
|
+
|
107
|
+
@local_data[basename] = ::Middleman::Util.recursively_enhance(data)
|
108
|
+
end
|
109
|
+
|
110
|
+
# Remove a given file from the internal cache
|
111
|
+
#
|
112
|
+
# @param [String] file The file to be cleared
|
113
|
+
# @return [void]
|
114
|
+
def remove_file(file)
|
115
|
+
extension = File.extname(file)
|
116
|
+
basename = File.basename(file, extension)
|
117
|
+
@local_data.delete(basename) if @local_data.has_key?(basename)
|
118
|
+
end
|
119
|
+
|
120
|
+
# Get a hash hash from either internal static data or a callback
|
121
|
+
#
|
122
|
+
# @param [String, Symbol] path The name of the data namespace
|
123
|
+
# @return [Hash, nil]
|
124
|
+
def data_for_path(path)
|
125
|
+
response = nil
|
126
|
+
|
127
|
+
@@local_sources ||= {}
|
128
|
+
@@callback_sources ||= {}
|
129
|
+
|
130
|
+
if self.store.has_key?(path.to_s)
|
131
|
+
response = self.store[path.to_s]
|
132
|
+
elsif self.callbacks.has_key?(path.to_s)
|
133
|
+
response = self.callbacks[path.to_s].call()
|
134
|
+
end
|
135
|
+
|
136
|
+
response
|
137
|
+
end
|
138
|
+
|
139
|
+
# "Magically" find namespaces of data if they exist
|
140
|
+
#
|
141
|
+
# @param [String] path The namespace to search for
|
142
|
+
# @return [Hash, nil]
|
143
|
+
def method_missing(path)
|
144
|
+
if @local_data.has_key?(path.to_s)
|
145
|
+
return @local_data[path.to_s]
|
146
|
+
else
|
147
|
+
result = data_for_path(path)
|
148
|
+
|
149
|
+
if result
|
150
|
+
return ::Middleman::Util.recursively_enhance(result)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
super
|
155
|
+
end
|
156
|
+
|
157
|
+
# Convert all the data into a static hash
|
158
|
+
#
|
159
|
+
# @return [Hash]
|
160
|
+
def to_h
|
161
|
+
data = {}
|
162
|
+
|
163
|
+
self.store.each do |k, v|
|
164
|
+
data[k] = data_for_path(k)
|
165
|
+
end
|
166
|
+
|
167
|
+
self.callbacks.each do |k, v|
|
168
|
+
data[k] = data_for_path(k)
|
169
|
+
end
|
170
|
+
|
171
|
+
(@local_data || {}).each do |k, v|
|
172
|
+
data[k] = v
|
173
|
+
end
|
174
|
+
|
175
|
+
data
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
@@ -0,0 +1,161 @@
|
|
1
|
+
# Middleman provides an extension API which allows you to hook into the
|
2
|
+
# lifecycle of a page request, or static build, and manipulate the output.
|
3
|
+
# Internal to Middleman, these extensions are called "features," but we use
|
4
|
+
# the exact same API as is made available to the public.
|
5
|
+
#
|
6
|
+
# A Middleman extension looks like this:
|
7
|
+
#
|
8
|
+
# module MyExtension
|
9
|
+
# class << self
|
10
|
+
# def registered(app)
|
11
|
+
# # My Code
|
12
|
+
# end
|
13
|
+
# end
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# In your `config.rb`, you must load your extension (if it is not defined in
|
17
|
+
# that file) and call `activate`.
|
18
|
+
#
|
19
|
+
# require "my_extension"
|
20
|
+
# activate MyExtension
|
21
|
+
#
|
22
|
+
# This will call the `registered` method in your extension and provide you
|
23
|
+
# with the `app` parameter which is a Middleman::Application context. From here
|
24
|
+
# you can choose to respond to requests for certain paths or simply attach
|
25
|
+
# Rack middleware to the stack.
|
26
|
+
#
|
27
|
+
# The built-in features cover a wide range of functions. Some provide helper
|
28
|
+
# methods to use in your views. Some modify the output on-the-fly. And some
|
29
|
+
# apply computationally-intensive changes to your final build files.
|
30
|
+
|
31
|
+
# Namespace extensions module
|
32
|
+
module Middleman
|
33
|
+
module CoreExtensions
|
34
|
+
module Extensions
|
35
|
+
|
36
|
+
# Register extension
|
37
|
+
class << self
|
38
|
+
# @private
|
39
|
+
def registered(app)
|
40
|
+
# Using for version parsing
|
41
|
+
require "rubygems"
|
42
|
+
|
43
|
+
app.define_hook :after_configuration
|
44
|
+
app.define_hook :before_configuration
|
45
|
+
app.define_hook :build_config
|
46
|
+
app.define_hook :development_config
|
47
|
+
|
48
|
+
if ENV["AUTOLOAD_SPROCKETS"]
|
49
|
+
app.set :autoload_sprockets, (ENV["AUTOLOAD_SPROCKETS"] == "true")
|
50
|
+
else
|
51
|
+
app.set :autoload_sprockets, true
|
52
|
+
end
|
53
|
+
|
54
|
+
app.extend ClassMethods
|
55
|
+
app.send :include, InstanceMethods
|
56
|
+
app.delegate :configure, :to => :"self.class"
|
57
|
+
end
|
58
|
+
alias :included :registered
|
59
|
+
end
|
60
|
+
|
61
|
+
# Class methods
|
62
|
+
module ClassMethods
|
63
|
+
# Add a callback to run in a specific environment
|
64
|
+
#
|
65
|
+
# @param [String, Symbol] env The environment to run in
|
66
|
+
# @return [void]
|
67
|
+
def configure(env, &block)
|
68
|
+
send("#{env}_config", &block)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Alias `extensions` to access registered extensions
|
72
|
+
#
|
73
|
+
# @return [Array<Module>]
|
74
|
+
def extensions
|
75
|
+
@extensions ||= []
|
76
|
+
end
|
77
|
+
|
78
|
+
# Register a new extension
|
79
|
+
#
|
80
|
+
# @param [Module] extension Extension modules to register
|
81
|
+
# @param [Hash] options Per-extension options hash
|
82
|
+
# @return [void]
|
83
|
+
def register(extension, options={}, &block)
|
84
|
+
@extensions ||= []
|
85
|
+
@extensions += [extension]
|
86
|
+
|
87
|
+
extend extension
|
88
|
+
if extension.respond_to?(:registered)
|
89
|
+
if extension.method(:registered).arity === 1
|
90
|
+
extension.registered(self, &block)
|
91
|
+
else
|
92
|
+
extension.registered(self, options, &block)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Instance methods
|
99
|
+
module InstanceMethods
|
100
|
+
# This method is available in the project's `config.rb`.
|
101
|
+
# It takes a underscore-separated symbol, finds the appropriate
|
102
|
+
# feature module and includes it.
|
103
|
+
#
|
104
|
+
# activate :lorem
|
105
|
+
#
|
106
|
+
# @param [Symbol, Module] ext Which extension to activate
|
107
|
+
# @return [void]
|
108
|
+
def activate(ext, options={}, &block)
|
109
|
+
ext_module = if ext.is_a?(Module)
|
110
|
+
ext
|
111
|
+
else
|
112
|
+
::Middleman::Extensions.load(ext.to_sym)
|
113
|
+
end
|
114
|
+
|
115
|
+
if ext_module.nil?
|
116
|
+
logger.warning "== Unknown Extension: #{ext}"
|
117
|
+
else
|
118
|
+
logger.debug "== Activating: #{ext}"
|
119
|
+
self.class.register(ext_module, options, &block)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
# Load features before starting server
|
124
|
+
def initialize
|
125
|
+
super
|
126
|
+
|
127
|
+
self.class.inst = self
|
128
|
+
run_hook :before_configuration
|
129
|
+
|
130
|
+
# Search the root of the project for required files
|
131
|
+
$LOAD_PATH.unshift(root)
|
132
|
+
|
133
|
+
# Check for and evaluate local configuration
|
134
|
+
local_config = File.join(root, "config.rb")
|
135
|
+
if File.exists? local_config
|
136
|
+
logger.debug "== Reading: Local config"
|
137
|
+
instance_eval File.read(local_config), local_config, 1
|
138
|
+
end
|
139
|
+
|
140
|
+
if autoload_sprockets
|
141
|
+
begin
|
142
|
+
require "middleman-sprockets"
|
143
|
+
activate(:sprockets)
|
144
|
+
rescue LoadError
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
run_hook :build_config if build?
|
149
|
+
run_hook :development_config if development?
|
150
|
+
|
151
|
+
run_hook :after_configuration
|
152
|
+
|
153
|
+
logger.debug "Loaded extensions:"
|
154
|
+
self.class.extensions.each do |ext|
|
155
|
+
logger.debug "== Extension: #{ext}"
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Load helpers in helpers/
|
2
|
+
module Middleman
|
3
|
+
module CoreExtensions
|
4
|
+
module ExternalHelpers
|
5
|
+
|
6
|
+
# Setup extension
|
7
|
+
class << self
|
8
|
+
|
9
|
+
# once registered
|
10
|
+
def registered(app)
|
11
|
+
# Setup a default helpers paths
|
12
|
+
app.set :helpers_dir, "helpers"
|
13
|
+
app.set :helpers_filename_glob, "**{,/*/**}/*.rb"
|
14
|
+
app.set :helpers_filename_to_module_name_proc, Proc.new { |filename|
|
15
|
+
basename = File.basename(filename, File.extname(filename))
|
16
|
+
basename.camelcase
|
17
|
+
}
|
18
|
+
|
19
|
+
# After config
|
20
|
+
app.after_configuration do
|
21
|
+
helpers_path = File.expand_path(helpers_dir, root)
|
22
|
+
next unless File.exists?(helpers_path)
|
23
|
+
|
24
|
+
Dir[File.join(helpers_path, helpers_filename_glob)].each do |filename|
|
25
|
+
module_name = helpers_filename_to_module_name_proc.call(filename)
|
26
|
+
next unless module_name
|
27
|
+
|
28
|
+
require filename
|
29
|
+
next unless Object.const_defined?(module_name.to_sym)
|
30
|
+
|
31
|
+
helpers Object.const_get(module_name.to_sym)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
alias :included :registered
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|