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,245 @@
|
|
1
|
+
# Using Tilt for templating
|
2
|
+
require "tilt"
|
3
|
+
|
4
|
+
# Use ActiveSupport JSON
|
5
|
+
require "active_support/json"
|
6
|
+
require "active_support/core_ext/integer/inflections"
|
7
|
+
require "active_support/core_ext/float/rounding"
|
8
|
+
|
9
|
+
# Simple callback library
|
10
|
+
require "middleman-core/vendor/hooks-0.2.0/lib/hooks"
|
11
|
+
|
12
|
+
require "middleman-core/sitemap"
|
13
|
+
|
14
|
+
require "middleman-core/core_extensions"
|
15
|
+
|
16
|
+
# Core Middleman Class
|
17
|
+
module Middleman
|
18
|
+
class Application
|
19
|
+
# Uses callbacks
|
20
|
+
include Hooks
|
21
|
+
|
22
|
+
# Before request hook
|
23
|
+
define_hook :before
|
24
|
+
|
25
|
+
# Ready (all loading and parsing of extensions complete) hook
|
26
|
+
define_hook :ready
|
27
|
+
|
28
|
+
class << self
|
29
|
+
|
30
|
+
# Mix-in helper methods. Accepts either a list of Modules
|
31
|
+
# and/or a block to be evaluated
|
32
|
+
# @return [void]
|
33
|
+
def helpers(*extensions, &block)
|
34
|
+
class_eval(&block) if block_given?
|
35
|
+
include(*extensions) if extensions.any?
|
36
|
+
end
|
37
|
+
|
38
|
+
# Access class-wide defaults
|
39
|
+
#
|
40
|
+
# @private
|
41
|
+
# @return [Hash] Hash of default values
|
42
|
+
def defaults
|
43
|
+
@defaults ||= {}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Set class-wide defaults
|
47
|
+
#
|
48
|
+
# @param [Symbol] key Unique key name
|
49
|
+
# @param value Default value
|
50
|
+
# @return [void]
|
51
|
+
def set(key, value=nil, &block)
|
52
|
+
@defaults ||= {}
|
53
|
+
@defaults[key] = value
|
54
|
+
|
55
|
+
@inst.set(key, value, &block) if @inst
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
delegate :helpers, :to => :"self.class"
|
60
|
+
|
61
|
+
# Set attributes (global variables)
|
62
|
+
#
|
63
|
+
# @param [Symbol] key Name of the attribue
|
64
|
+
# @param value Attribute value
|
65
|
+
# @return [void]
|
66
|
+
def set(key, value=nil, &block)
|
67
|
+
setter = "#{key}=".to_sym
|
68
|
+
self.class.send(:attr_accessor, key) if !respond_to?(setter)
|
69
|
+
value = block if block_given?
|
70
|
+
send(setter, value)
|
71
|
+
end
|
72
|
+
|
73
|
+
# Root project directory (overwritten in middleman build/server)
|
74
|
+
# @return [String]
|
75
|
+
set :root, ENV["MM_ROOT"] || Dir.pwd
|
76
|
+
|
77
|
+
# Pathname-addressed root
|
78
|
+
def root_path
|
79
|
+
@_root_path ||= Pathname.new(root)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Name of the source directory
|
83
|
+
# @return [String]
|
84
|
+
set :source, "source"
|
85
|
+
|
86
|
+
# Middleman environment. Defaults to :development, set to :build by the build process
|
87
|
+
# @return [String]
|
88
|
+
set :environment, (ENV['MM_ENV'] && ENV['MM_ENV'].to_sym) || :development
|
89
|
+
|
90
|
+
# Which file should be used for directory indexes
|
91
|
+
# @return [String]
|
92
|
+
set :index_file, "index.html"
|
93
|
+
|
94
|
+
# Whether to strip the index file name off links to directory indexes
|
95
|
+
# @return [Boolean]
|
96
|
+
set :strip_index_file, true
|
97
|
+
|
98
|
+
# Whether to include a trailing slash when stripping the index file
|
99
|
+
# @return [Boolean]
|
100
|
+
set :trailing_slash, true
|
101
|
+
|
102
|
+
# Location of javascripts within source.
|
103
|
+
# @return [String]
|
104
|
+
set :js_dir, "javascripts"
|
105
|
+
|
106
|
+
# Location of stylesheets within source. Used by Compass.
|
107
|
+
# @return [String]
|
108
|
+
set :css_dir, "stylesheets"
|
109
|
+
|
110
|
+
# Location of images within source. Used by HTML helpers and Compass.
|
111
|
+
# @return [String]
|
112
|
+
set :images_dir, "images"
|
113
|
+
|
114
|
+
# Location of fonts within source. Used by Compass.
|
115
|
+
# @return [String]
|
116
|
+
set :fonts_dir, "fonts"
|
117
|
+
|
118
|
+
# Where to build output files
|
119
|
+
# @return [String]
|
120
|
+
set :build_dir, "build"
|
121
|
+
|
122
|
+
# Default prefix for building paths. Used by HTML helpers and Compass.
|
123
|
+
# @return [String]
|
124
|
+
set :http_prefix, "/"
|
125
|
+
|
126
|
+
# Default string encoding for templates and output.
|
127
|
+
# @return [String]
|
128
|
+
set :encoding, "utf-8"
|
129
|
+
|
130
|
+
# Whether to catch and display exceptions
|
131
|
+
# @return [Boolean]
|
132
|
+
set :show_exceptions, true
|
133
|
+
|
134
|
+
# Default layout name
|
135
|
+
# @return [String, Symbold]
|
136
|
+
set :layout, :_auto_layout
|
137
|
+
|
138
|
+
# Activate custom features and extensions
|
139
|
+
include Middleman::CoreExtensions::Extensions
|
140
|
+
|
141
|
+
# Manage Ruby string encodings
|
142
|
+
include Middleman::CoreExtensions::RubyEncoding
|
143
|
+
|
144
|
+
# Basic Rack Request Handling
|
145
|
+
include Middleman::CoreExtensions::Request
|
146
|
+
|
147
|
+
# Handle exceptions
|
148
|
+
register Middleman::CoreExtensions::ShowExceptions
|
149
|
+
|
150
|
+
# Add Builder Callbacks
|
151
|
+
register Middleman::CoreExtensions::Builder
|
152
|
+
|
153
|
+
# Add Watcher Callbacks
|
154
|
+
register Middleman::CoreExtensions::FileWatcher
|
155
|
+
|
156
|
+
# Activate Data package
|
157
|
+
register Middleman::CoreExtensions::Data
|
158
|
+
|
159
|
+
# Setup custom rendering
|
160
|
+
register Middleman::CoreExtensions::Rendering
|
161
|
+
|
162
|
+
# Parse YAML from templates. Must be before sitemap so sitemap
|
163
|
+
# extensions see updated frontmatter!
|
164
|
+
register Middleman::CoreExtensions::FrontMatter
|
165
|
+
|
166
|
+
# Sitemap
|
167
|
+
register Middleman::Sitemap
|
168
|
+
|
169
|
+
# Setup external helpers
|
170
|
+
register Middleman::CoreExtensions::ExternalHelpers
|
171
|
+
|
172
|
+
# with_layout and page routing
|
173
|
+
register Middleman::CoreExtensions::Routing
|
174
|
+
|
175
|
+
# Initialize the Middleman project
|
176
|
+
def initialize(&block)
|
177
|
+
# Clear the static class cache
|
178
|
+
cache.clear
|
179
|
+
|
180
|
+
# Setup the default values from calls to set before initialization
|
181
|
+
self.class.superclass.defaults.each { |k,v| set(k,v) }
|
182
|
+
|
183
|
+
# Evaluate a passed block if given
|
184
|
+
instance_exec(&block) if block_given?
|
185
|
+
|
186
|
+
# Build expanded source path once paths have been parsed
|
187
|
+
path = root.dup
|
188
|
+
source_path = ENV["MM_SOURCE"] || self.source
|
189
|
+
path = File.join(root, source_path) unless source_path.empty?
|
190
|
+
set :source_dir, path
|
191
|
+
|
192
|
+
super
|
193
|
+
end
|
194
|
+
|
195
|
+
# Shared cache instance
|
196
|
+
#
|
197
|
+
# @private
|
198
|
+
# @return [Middleman::Util::Cache] The cache
|
199
|
+
def self.cache
|
200
|
+
@_cache ||= ::Middleman::Util::Cache.new
|
201
|
+
end
|
202
|
+
delegate :cache, :to => :"self.class"
|
203
|
+
|
204
|
+
# Whether we're in development mode
|
205
|
+
# @return [Boolean] If we're in dev mode
|
206
|
+
def development?; environment == :development; end
|
207
|
+
|
208
|
+
# Whether we're in build mode
|
209
|
+
# @return [Boolean] If we're in build mode
|
210
|
+
def build?; environment == :build; end
|
211
|
+
|
212
|
+
# Backwards compatibilty with old Sinatra template interface
|
213
|
+
#
|
214
|
+
# @return [Middleman::Application]
|
215
|
+
def settings
|
216
|
+
self
|
217
|
+
end
|
218
|
+
|
219
|
+
delegate :logger, :instrument, :to => ::Middleman::Util
|
220
|
+
|
221
|
+
# Work around this bug: http://bugs.ruby-lang.org/issues/4521
|
222
|
+
# where Ruby will call to_s/inspect while printing exception
|
223
|
+
# messages, which can take a long time (minutes at full CPU)
|
224
|
+
# if the object is huge or has cyclic references, like this.
|
225
|
+
def to_s
|
226
|
+
"#<Middleman::Application>"
|
227
|
+
end
|
228
|
+
|
229
|
+
# Expand a path to include the index file if it's a directory
|
230
|
+
#
|
231
|
+
# @private
|
232
|
+
# @param [String] path Request path
|
233
|
+
# @return [String] Path with index file if necessary
|
234
|
+
def full_path(path)
|
235
|
+
cache.fetch(:full_path, path) do
|
236
|
+
parts = path ? path.split('/') : []
|
237
|
+
if parts.last.nil? || parts.last.split('.').length == 1
|
238
|
+
path = File.join(path, index_file)
|
239
|
+
end
|
240
|
+
"/" + path.sub(%r{^/}, '')
|
241
|
+
end
|
242
|
+
end
|
243
|
+
|
244
|
+
end
|
245
|
+
end
|
@@ -0,0 +1,286 @@
|
|
1
|
+
require "middleman-core"
|
2
|
+
|
3
|
+
# CLI Module
|
4
|
+
module Middleman::Cli
|
5
|
+
|
6
|
+
# The CLI Build class
|
7
|
+
class Build < Thor
|
8
|
+
include Thor::Actions
|
9
|
+
|
10
|
+
attr_reader :debugging
|
11
|
+
|
12
|
+
check_unknown_options!
|
13
|
+
|
14
|
+
namespace :build
|
15
|
+
|
16
|
+
desc "build [options]", "Builds the static site for deployment"
|
17
|
+
method_option :clean,
|
18
|
+
:type => :boolean,
|
19
|
+
:aliases => "-c",
|
20
|
+
:default => false,
|
21
|
+
:desc => 'Removes orphaned files or directories from build'
|
22
|
+
method_option :glob,
|
23
|
+
:type => :string,
|
24
|
+
:aliases => "-g",
|
25
|
+
:default => nil,
|
26
|
+
:desc => 'Build a subset of the project'
|
27
|
+
method_option :verbose,
|
28
|
+
:type => :boolean,
|
29
|
+
:default => false,
|
30
|
+
:desc => 'Print debug messages'
|
31
|
+
method_option :instrument,
|
32
|
+
:type => :string,
|
33
|
+
:default => false,
|
34
|
+
:desc => 'Print instrument messages'
|
35
|
+
method_option :profile,
|
36
|
+
:type => :boolean,
|
37
|
+
:default => false,
|
38
|
+
:desc => 'Generate profiling report for the build'
|
39
|
+
|
40
|
+
# Core build Thor command
|
41
|
+
# @return [void]
|
42
|
+
def build
|
43
|
+
if !ENV["MM_ROOT"]
|
44
|
+
raise Thor::Error, "Error: Could not find a Middleman project config, perhaps you are in the wrong folder?"
|
45
|
+
end
|
46
|
+
|
47
|
+
# Use Rack::Test for inspecting a running server for output
|
48
|
+
require "rack"
|
49
|
+
require "rack/test"
|
50
|
+
|
51
|
+
require 'find'
|
52
|
+
|
53
|
+
@debugging = Middleman::Cli::Base.respond_to?(:debugging) && Middleman::Cli::Base.debugging
|
54
|
+
@had_errors = false
|
55
|
+
|
56
|
+
self.class.shared_instance(options["verbose"], options["instrument"])
|
57
|
+
|
58
|
+
self.class.shared_rack
|
59
|
+
|
60
|
+
opts = {}
|
61
|
+
opts[:glob] = options["glob"] if options.has_key?("glob")
|
62
|
+
opts[:clean] = options["clean"] if options.has_key?("clean")
|
63
|
+
|
64
|
+
action GlobAction.new(self, opts)
|
65
|
+
|
66
|
+
if @had_errors && !@debugging
|
67
|
+
self.shell.say "There were errors during this build, re-run with --verbose to see the full exception."
|
68
|
+
end
|
69
|
+
|
70
|
+
exit(1) if @had_errors
|
71
|
+
|
72
|
+
self.class.shared_instance.run_hook :after_build, self
|
73
|
+
end
|
74
|
+
|
75
|
+
# Static methods
|
76
|
+
class << self
|
77
|
+
def exit_on_failure?
|
78
|
+
true
|
79
|
+
end
|
80
|
+
|
81
|
+
# Middleman::Application singleton
|
82
|
+
#
|
83
|
+
# @return [Middleman::Application]
|
84
|
+
def shared_instance(verbose=false, instrument=false)
|
85
|
+
@_shared_instance ||= ::Middleman::Application.server.inst do
|
86
|
+
set :environment, :build
|
87
|
+
logger(verbose ? 0 : 1, instrument)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
# Middleman::Application class singleton
|
92
|
+
#
|
93
|
+
# @return [Middleman::Application]
|
94
|
+
def shared_server
|
95
|
+
@_shared_server ||= shared_instance.class
|
96
|
+
end
|
97
|
+
|
98
|
+
# Rack::Test::Session singleton
|
99
|
+
#
|
100
|
+
# @return [Rack::Test::Session]
|
101
|
+
def shared_rack
|
102
|
+
@_shared_rack ||= begin
|
103
|
+
mock = ::Rack::MockSession.new(shared_server.to_rack_app)
|
104
|
+
::Rack::Test::Session.new(mock)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
# Set the root path to the Middleman::Application's root
|
109
|
+
def source_root
|
110
|
+
shared_instance.root
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
no_tasks {
|
115
|
+
# Render a resource to a file.
|
116
|
+
#
|
117
|
+
# @param [Middleman::Sitemap::Resource] resource
|
118
|
+
# @return [String] The full path of the file that was written
|
119
|
+
def render_to_file(resource)
|
120
|
+
build_dir = self.class.shared_instance.build_dir
|
121
|
+
output_file = File.join(build_dir, resource.destination_path)
|
122
|
+
|
123
|
+
begin
|
124
|
+
response = self.class.shared_rack.get(URI.escape(resource.destination_path))
|
125
|
+
|
126
|
+
if response.status == 200
|
127
|
+
create_file(output_file, response.body)
|
128
|
+
else
|
129
|
+
handle_error(output_file, response.body)
|
130
|
+
end
|
131
|
+
rescue => e
|
132
|
+
handle_error(output_file, "#{e}\n#{e.backtrace.join("\n")}", e)
|
133
|
+
end
|
134
|
+
|
135
|
+
output_file
|
136
|
+
end
|
137
|
+
|
138
|
+
def handle_error(file_name, response, e=Thor::Error.new(response))
|
139
|
+
@had_errors = true
|
140
|
+
|
141
|
+
say_status :error, file_name, :red
|
142
|
+
if self.debugging
|
143
|
+
raise e
|
144
|
+
exit(1)
|
145
|
+
elsif options["verbose"]
|
146
|
+
self.shell.error(response)
|
147
|
+
end
|
148
|
+
end
|
149
|
+
}
|
150
|
+
end
|
151
|
+
|
152
|
+
# A Thor Action, modular code, which does the majority of the work.
|
153
|
+
class GlobAction < ::Thor::Actions::EmptyDirectory
|
154
|
+
attr_reader :source
|
155
|
+
attr_reader :logger
|
156
|
+
|
157
|
+
# Setup the action
|
158
|
+
#
|
159
|
+
# @param [Middleman::Cli::Build] base
|
160
|
+
# @param [Hash] config
|
161
|
+
def initialize(base, config={})
|
162
|
+
@app = base.class.shared_instance
|
163
|
+
source = @app.source
|
164
|
+
@destination = @app.build_dir
|
165
|
+
|
166
|
+
@source = File.expand_path(base.find_in_source_paths(source.to_s))
|
167
|
+
|
168
|
+
@logger = Middleman::Cli::Build.shared_instance.logger
|
169
|
+
|
170
|
+
super(base, @destination, config)
|
171
|
+
end
|
172
|
+
|
173
|
+
# Execute the action
|
174
|
+
# @return [void]
|
175
|
+
def invoke!
|
176
|
+
queue_current_paths if cleaning?
|
177
|
+
execute!
|
178
|
+
clean! if cleaning?
|
179
|
+
end
|
180
|
+
|
181
|
+
protected
|
182
|
+
|
183
|
+
# Remove files which were not built in this cycle
|
184
|
+
# @return [void]
|
185
|
+
def clean!
|
186
|
+
files = @cleaning_queue.select { |q| q.file? }
|
187
|
+
directories = @cleaning_queue.select { |q| q.directory? }
|
188
|
+
|
189
|
+
files.each do |f|
|
190
|
+
base.remove_file f, :force => true
|
191
|
+
end
|
192
|
+
|
193
|
+
directories = directories.sort_by {|d| d.to_s.length }.reverse!
|
194
|
+
|
195
|
+
directories.each do |d|
|
196
|
+
base.remove_file d, :force => true if directory_empty? d
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
# Whether we should clean the build
|
201
|
+
# @return [Boolean]
|
202
|
+
def cleaning?
|
203
|
+
@config.has_key?(:clean) && @config[:clean]
|
204
|
+
end
|
205
|
+
|
206
|
+
# Whether the given directory is empty
|
207
|
+
# @param [String] directory
|
208
|
+
# @return [Boolean]
|
209
|
+
def directory_empty?(directory)
|
210
|
+
directory.children.empty?
|
211
|
+
end
|
212
|
+
|
213
|
+
# Get a list of all the paths in the destination folder and save them
|
214
|
+
# for comparison against the files we build in this cycle
|
215
|
+
# @return [void]
|
216
|
+
def queue_current_paths
|
217
|
+
@cleaning_queue = []
|
218
|
+
return unless File.exist?(@destination)
|
219
|
+
|
220
|
+
paths = ::Middleman::Util.all_files_under(@destination)
|
221
|
+
@cleaning_queue += paths.select do |path|
|
222
|
+
!path.to_s.match(/\/\./) || path.to_s.match(/\.htaccess/)
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
226
|
+
# Actually build the app
|
227
|
+
# @return [void]
|
228
|
+
def execute!
|
229
|
+
# Sort order, images, fonts, js/css and finally everything else.
|
230
|
+
sort_order = %w(.png .jpeg .jpg .gif .bmp .svg .svgz .ico .woff .otf .ttf .eot .js .css)
|
231
|
+
|
232
|
+
# Pre-request CSS to give Compass a chance to build sprites
|
233
|
+
logger.debug "== Prerendering CSS"
|
234
|
+
|
235
|
+
@app.sitemap.resources.select do |resource|
|
236
|
+
resource.ext == ".css"
|
237
|
+
end.each do |resource|
|
238
|
+
Middleman::Cli::Build.shared_rack.get(URI.escape(resource.destination_path))
|
239
|
+
end
|
240
|
+
|
241
|
+
logger.debug "== Checking for Compass sprites"
|
242
|
+
|
243
|
+
# Double-check for compass sprites
|
244
|
+
@app.files.find_new_files((Pathname(@app.source_dir) + @app.images_dir).relative_path_from(@app.root_path))
|
245
|
+
|
246
|
+
# Sort paths to be built by the above order. This is primarily so Compass can
|
247
|
+
# find files in the build folder when it needs to generate sprites for the
|
248
|
+
# css files
|
249
|
+
|
250
|
+
logger.debug "== Building files"
|
251
|
+
|
252
|
+
resources = @app.sitemap.resources.sort_by do |r|
|
253
|
+
sort_order.index(r.ext) || 100
|
254
|
+
end
|
255
|
+
|
256
|
+
# Loop over all the paths and build them.
|
257
|
+
resources.each do |resource|
|
258
|
+
next if @config[:glob] && !File.fnmatch(@config[:glob], resource.destination_path)
|
259
|
+
|
260
|
+
output_path = base.render_to_file(resource)
|
261
|
+
|
262
|
+
if cleaning?
|
263
|
+
pn = Pathname(output_path)
|
264
|
+
@cleaning_queue.delete(pn.realpath) if pn.exist?
|
265
|
+
end
|
266
|
+
end
|
267
|
+
|
268
|
+
::Middleman::Profiling.report("build")
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
# Alias "b" to "build"
|
273
|
+
Base.map({ "b" => "build" })
|
274
|
+
end
|
275
|
+
|
276
|
+
# Quiet down create file
|
277
|
+
class ::Thor::Actions::CreateFile
|
278
|
+
def on_conflict_behavior(&block)
|
279
|
+
if identical?
|
280
|
+
say_status :identical, :blue
|
281
|
+
else
|
282
|
+
say_status :update, :yellow
|
283
|
+
block.call unless pretend?
|
284
|
+
end
|
285
|
+
end
|
286
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# CLI Module
|
2
|
+
module Middleman::Cli
|
3
|
+
|
4
|
+
# A initializing Bundler
|
5
|
+
class Bundle < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
check_unknown_options!
|
8
|
+
|
9
|
+
namespace :bundle
|
10
|
+
|
11
|
+
desc "bundle", "Setup initial bundle", :hide => true
|
12
|
+
|
13
|
+
# The setup task
|
14
|
+
def bundle
|
15
|
+
run('bundle install --without development test')#, :capture => true)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
# A upgrading Bundler
|
20
|
+
class Upgrade < Thor
|
21
|
+
include Thor::Actions
|
22
|
+
check_unknown_options!
|
23
|
+
|
24
|
+
namespace :upgrade
|
25
|
+
|
26
|
+
desc "upgrade", "Upgrade installed bundle"
|
27
|
+
|
28
|
+
# The upgrade task
|
29
|
+
def upgrade
|
30
|
+
inside(ENV["MM_ROOT"]) do
|
31
|
+
run('bundle update')#, :capture => true)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Map "u" to "upgrade"
|
37
|
+
Base.map({
|
38
|
+
"u" => "upgrade"
|
39
|
+
})
|
40
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# CLI Module
|
2
|
+
module Middleman::Cli
|
3
|
+
|
4
|
+
# A thor task for creating new projects
|
5
|
+
class Extension < Thor
|
6
|
+
include Thor::Actions
|
7
|
+
|
8
|
+
check_unknown_options!
|
9
|
+
|
10
|
+
namespace :extension
|
11
|
+
|
12
|
+
# Required path for the new project to be generated
|
13
|
+
argument :name, :type => :string
|
14
|
+
|
15
|
+
# Template files are relative to this file
|
16
|
+
# @return [String]
|
17
|
+
def self.source_root
|
18
|
+
File.join(File.dirname(__FILE__), "..", "templates", "extension")
|
19
|
+
end
|
20
|
+
|
21
|
+
desc "extension [options]", "Create Middleman extension scaffold NAME"
|
22
|
+
|
23
|
+
# The extension task
|
24
|
+
# @param [String] name
|
25
|
+
def extension
|
26
|
+
generate_gitignore!
|
27
|
+
template "Rakefile", File.join(name, "Rakefile")
|
28
|
+
template "gemspec", File.join(name, "#{name}.gemspec")
|
29
|
+
template "Gemfile", File.join(name, "Gemfile")
|
30
|
+
template "lib/middleman_extension.rb", File.join(name, "lib", "middleman_extension.rb")
|
31
|
+
template "lib/lib.rb", File.join(name, "lib", "#{name}.rb")
|
32
|
+
template "features/support/env.rb", File.join(name, "features", "support", "env.rb")
|
33
|
+
empty_directory File.join(name, "fixtures")
|
34
|
+
end
|
35
|
+
|
36
|
+
# Output a .gitignore file
|
37
|
+
class_option :git, :type => :boolean, :default => true
|
38
|
+
|
39
|
+
no_tasks {
|
40
|
+
# Write a .gitignore file for project
|
41
|
+
# @return [void]
|
42
|
+
def generate_gitignore!
|
43
|
+
return unless options[:git]
|
44
|
+
copy_file "gitignore", File.join(name, ".gitignore")
|
45
|
+
end
|
46
|
+
}
|
47
|
+
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require "middleman-core/templates"
|
2
|
+
|
3
|
+
# CLI Module
|
4
|
+
module Middleman::Cli
|
5
|
+
|
6
|
+
# A thor task for creating new projects
|
7
|
+
class Init < Thor
|
8
|
+
check_unknown_options!
|
9
|
+
|
10
|
+
namespace :init
|
11
|
+
|
12
|
+
desc "init NAME [options]", "Create new project NAME"
|
13
|
+
available_templates = ::Middleman::Templates.registered.keys.join(", ")
|
14
|
+
method_option "template",
|
15
|
+
:aliases => "-T",
|
16
|
+
:default => "default",
|
17
|
+
:desc => "Use a project template: #{available_templates}"
|
18
|
+
method_option "css_dir",
|
19
|
+
# :default => "stylesheets",
|
20
|
+
:desc => 'The path to the css files'
|
21
|
+
method_option "js_dir",
|
22
|
+
# :default => "javascripts",
|
23
|
+
:desc => 'The path to the javascript files'
|
24
|
+
method_option "images_dir",
|
25
|
+
# :default => "images",
|
26
|
+
:desc => 'The path to the image files'
|
27
|
+
method_option "rack",
|
28
|
+
:type => :boolean,
|
29
|
+
:default => false,
|
30
|
+
:desc => 'Include a config.ru file'
|
31
|
+
method_option "bundler",
|
32
|
+
:type => :boolean,
|
33
|
+
:default => false,
|
34
|
+
:desc => 'Create a Gemfile and use Bundler to manage gems'
|
35
|
+
# The init task
|
36
|
+
# @param [String] name
|
37
|
+
def init(name)
|
38
|
+
key = options[:template].to_sym
|
39
|
+
unless ::Middleman::Templates.registered.has_key?(key)
|
40
|
+
raise Thor::Error.new "Unknown project template '#{key}'"
|
41
|
+
end
|
42
|
+
|
43
|
+
thor_group = ::Middleman::Templates.registered[key]
|
44
|
+
thor_group.new([name], options).invoke_all
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.exit_on_failure?
|
49
|
+
true
|
50
|
+
end
|
51
|
+
|
52
|
+
# Map "i", "new" and "n" to "init"
|
53
|
+
Base.map({
|
54
|
+
"i" => "init",
|
55
|
+
"new" => "init",
|
56
|
+
"n" => "init"
|
57
|
+
})
|
58
|
+
end
|