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,51 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<!--
|
3
|
+
Copyright 2009 Google Inc.
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
-->
|
17
|
+
|
18
|
+
<html>
|
19
|
+
<head>
|
20
|
+
<title>Database wrapper api</title>
|
21
|
+
<script type="text/javascript" src="../jsunit/app/jsUnitCore.js"></script>
|
22
|
+
<script type="text/javascript" src="jsmock.js"></script>
|
23
|
+
<script type="text/javascript" src="global_functions.js"></script>
|
24
|
+
<script type="text/javascript" src="dbwrapperapi.js"></script>
|
25
|
+
</head>
|
26
|
+
<body>
|
27
|
+
<script type='text/javascript'>
|
28
|
+
|
29
|
+
function subStatementTest(stm) {
|
30
|
+
assertEquals('statement not set correctly', 'bar', stm.sql);
|
31
|
+
assertEquals('first param not set correctly', 1, stm.params[0]);
|
32
|
+
assertEquals('second param not set correctly', 2, stm.params[1]);
|
33
|
+
}
|
34
|
+
|
35
|
+
function testConstructStatement() {
|
36
|
+
var stm = new google.wspl.Statement('foo');
|
37
|
+
assertEquals('statement not set correctly', 'foo', stm.sql);
|
38
|
+
|
39
|
+
var stm = new google.wspl.Statement('bar', [1,2]);
|
40
|
+
subStatementTest(stm);
|
41
|
+
}
|
42
|
+
|
43
|
+
function testConstructStatementFromTemplate() {
|
44
|
+
var temp = new google.wspl.Statement('bar');
|
45
|
+
var stm = temp.createStatement([1,2]);
|
46
|
+
subStatementTest(stm);
|
47
|
+
}
|
48
|
+
|
49
|
+
</script>
|
50
|
+
</body>
|
51
|
+
</html>
|
@@ -0,0 +1,71 @@
|
|
1
|
+
/*
|
2
|
+
Copyright 2009 Google Inc.
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
/**
|
18
|
+
* @fileoverview A Gears implementation of dbwrapperapi ResultSet.
|
19
|
+
*/
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Creates a Gears ResultSet object.
|
23
|
+
* @see google.wspl.ResultSet#ResultSet
|
24
|
+
*
|
25
|
+
* @constructor
|
26
|
+
* @extends google.wspl.ResultSet
|
27
|
+
* @param {!Array.<Object>} resultArray An array of hash objects where the
|
28
|
+
* column names in the query are used as members of the objects.
|
29
|
+
*/
|
30
|
+
google.wspl.gears.ResultSet = function(resultArray) {
|
31
|
+
google.wspl.ResultSet.call(this);
|
32
|
+
|
33
|
+
/**
|
34
|
+
* The result set as an array of hash objects.
|
35
|
+
* @type {!Array.<Object>}
|
36
|
+
* @private
|
37
|
+
*/
|
38
|
+
this.resultArray_ = resultArray;
|
39
|
+
};
|
40
|
+
google.inherits(google.wspl.gears.ResultSet, google.wspl.ResultSet);
|
41
|
+
|
42
|
+
/**
|
43
|
+
* The current record in the result set.
|
44
|
+
* @type {number}
|
45
|
+
* @private
|
46
|
+
*/
|
47
|
+
google.wspl.gears.ResultSet.prototype.current_ = 0;
|
48
|
+
|
49
|
+
/**
|
50
|
+
* @see google.wspl.ResultSet#isValidRow
|
51
|
+
* @inheritDoc
|
52
|
+
*/
|
53
|
+
google.wspl.gears.ResultSet.prototype.isValidRow = function() {
|
54
|
+
return this.current_ < this.resultArray_.length;
|
55
|
+
};
|
56
|
+
|
57
|
+
/**
|
58
|
+
* @see google.wspl.ResultSet#next
|
59
|
+
* @inheritDoc
|
60
|
+
*/
|
61
|
+
google.wspl.gears.ResultSet.prototype.next = function() {
|
62
|
+
this.current_++;
|
63
|
+
};
|
64
|
+
|
65
|
+
/**
|
66
|
+
* @see google.wspl.ResultSet#getRow
|
67
|
+
* @inheritDoc
|
68
|
+
*/
|
69
|
+
google.wspl.gears.ResultSet.prototype.getRow = function() {
|
70
|
+
return this.resultArray_[this.current_];
|
71
|
+
};
|
@@ -0,0 +1,86 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<!--
|
3
|
+
Copyright 2009 Google Inc.
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
-->
|
17
|
+
|
18
|
+
<html>
|
19
|
+
<head>
|
20
|
+
<title>Gears resultset tests</title>
|
21
|
+
<script type="text/javascript" src="../jsunit/app/jsUnitCore.js"></script>
|
22
|
+
<script type="text/javascript" src="jsmock.js"></script>
|
23
|
+
<script type="text/javascript" src="global_functions.js"></script>
|
24
|
+
<script type="text/javascript" src="dbwrapperapi.js"></script>
|
25
|
+
<script type="text/javascript" src="gears_resultset.js"></script>
|
26
|
+
</head>
|
27
|
+
<body>
|
28
|
+
<script type='text/javascript'>
|
29
|
+
|
30
|
+
var resultArray;
|
31
|
+
|
32
|
+
function setUp() {
|
33
|
+
var obj1 = {
|
34
|
+
field1: 'a',
|
35
|
+
field2: 2,
|
36
|
+
field3: 'c'
|
37
|
+
};
|
38
|
+
|
39
|
+
var obj2 = {
|
40
|
+
field1: 'd',
|
41
|
+
field2: 4,
|
42
|
+
field3: 'f'
|
43
|
+
};
|
44
|
+
|
45
|
+
var obj3 = {
|
46
|
+
field1: 'g',
|
47
|
+
field2: 6,
|
48
|
+
field3: 'i'
|
49
|
+
};
|
50
|
+
|
51
|
+
resultArray = [obj1, obj2, obj3];
|
52
|
+
}
|
53
|
+
|
54
|
+
function testResultSetNext() {
|
55
|
+
var result = new google.wspl.gears.ResultSet(resultArray);
|
56
|
+
assertEquals('incorrect value for current', 0, result.current_);
|
57
|
+
result.next();
|
58
|
+
assertEquals('incorrect value for current', 1, result.current_);
|
59
|
+
result.next();
|
60
|
+
assertEquals('incorrect value for current', 2, result.current_);
|
61
|
+
}
|
62
|
+
|
63
|
+
function testResultSetIsValidRow() {
|
64
|
+
var result = new google.wspl.gears.ResultSet(resultArray);
|
65
|
+
assertTrue('incorrect return from isValidRow', result.isValidRow());
|
66
|
+
result.next();
|
67
|
+
assertTrue('incorrect return from isValidRow', result.isValidRow());
|
68
|
+
result.next();
|
69
|
+
assertTrue('incorrect return from isValidRow', result.isValidRow());
|
70
|
+
result.next();
|
71
|
+
assertFalse('incorrect return from isValidRow', result.isValidRow());
|
72
|
+
}
|
73
|
+
|
74
|
+
function testResultSetGetRow() {
|
75
|
+
var result = new google.wspl.gears.ResultSet(resultArray);
|
76
|
+
result.next();
|
77
|
+
|
78
|
+
var row = result.getRow();
|
79
|
+
assertEquals('first field is not valid', 'd', row.field1);
|
80
|
+
assertEquals('first field is not valid', 4, row.field2);
|
81
|
+
assertEquals('first field is not valid', 'f', row.field3);
|
82
|
+
}
|
83
|
+
|
84
|
+
</script>
|
85
|
+
</body>
|
86
|
+
</html>
|
@@ -0,0 +1,196 @@
|
|
1
|
+
/*
|
2
|
+
Copyright 2009 Google Inc.
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
/**
|
18
|
+
* @fileoverview A Gears implementation of dbwrapperapi Transaction.
|
19
|
+
*/
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Creates a Gears Transaction object.
|
23
|
+
* @see google.wspl.ResultSet#ResultSet
|
24
|
+
*
|
25
|
+
* @constructor
|
26
|
+
* @extends google.wspl.Transaction
|
27
|
+
*
|
28
|
+
* @param {number} id The unique id for this transaction
|
29
|
+
* @param {google.wspl.gears.Database} db The Gears implementation of the
|
30
|
+
* dbwrapperapi database
|
31
|
+
*/
|
32
|
+
google.wspl.gears.Transaction = function(id, db) {
|
33
|
+
google.wspl.Transaction.call(this);
|
34
|
+
|
35
|
+
/**
|
36
|
+
* The unique id for this transaction.
|
37
|
+
* @type {number}
|
38
|
+
* @private
|
39
|
+
*/
|
40
|
+
this.id_ = id;
|
41
|
+
|
42
|
+
/**
|
43
|
+
* The Gears implementation of the dbwrapperapi database.
|
44
|
+
* @type {google.wspl.gears.Database}
|
45
|
+
* @private
|
46
|
+
*/
|
47
|
+
this.db_ = db;
|
48
|
+
|
49
|
+
/**
|
50
|
+
* A map of statements, callback, and current statement.
|
51
|
+
* @type {Object}
|
52
|
+
* @private
|
53
|
+
*/
|
54
|
+
this.activeExecutes_ = {};
|
55
|
+
};
|
56
|
+
google.inherits(google.wspl.gears.Transaction, google.wspl.Transaction);
|
57
|
+
|
58
|
+
/**
|
59
|
+
* The number of active executes.
|
60
|
+
* @type {number}
|
61
|
+
* @private
|
62
|
+
*/
|
63
|
+
google.wspl.gears.Transaction.prototype.numActiveExecutes_ = 0;
|
64
|
+
|
65
|
+
/**
|
66
|
+
* The id for the next call to execute. Incremented after use.
|
67
|
+
* @type {number}
|
68
|
+
* @private
|
69
|
+
*/
|
70
|
+
google.wspl.gears.Transaction.prototype.nextCallbackId_ = 1;
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Whether the transaction should be rolled back or not. This property is set
|
74
|
+
* to true when a statement fails.
|
75
|
+
* @type {boolean}
|
76
|
+
* @private
|
77
|
+
*/
|
78
|
+
google.wspl.gears.Transaction.prototype.needsRollback_ = false;
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Begins a new transaction with the Gears database. Commits the transaction if
|
82
|
+
* all calls to executeAll for this transaction have finished receiving
|
83
|
+
* callbacks. Rolls the transaction back if a statement failed.
|
84
|
+
*
|
85
|
+
* @see google.wspl.Transaction#executeAll
|
86
|
+
* @inheritDoc
|
87
|
+
*/
|
88
|
+
google.wspl.gears.Transaction.prototype.executeAll = function(statements,
|
89
|
+
opt_callback) {
|
90
|
+
if (statements.length == 0) {
|
91
|
+
throw Error('Possibly silly attempt to execute empty statement list.');
|
92
|
+
}
|
93
|
+
if (this.numActiveExecutes_ == 0) {
|
94
|
+
this.db_.doBegin(this.id_);
|
95
|
+
}
|
96
|
+
|
97
|
+
this.numActiveExecutes_++;
|
98
|
+
var callbackId = this.nextCallbackId_++;
|
99
|
+
|
100
|
+
var callback = opt_callback || {
|
101
|
+
onSuccess : function() {},
|
102
|
+
onFailure : function() {}
|
103
|
+
};
|
104
|
+
|
105
|
+
this.activeExecutes_[callbackId] = {
|
106
|
+
statements: statements,
|
107
|
+
currentStatement: 0,
|
108
|
+
callback: callback
|
109
|
+
};
|
110
|
+
|
111
|
+
this.db_.doExecute(statements, callbackId, this.id_);
|
112
|
+
};
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Invokes onSuccess on the specified callback.
|
116
|
+
*
|
117
|
+
* @param {google.wspl.ResultSet} result The result of a successful statement
|
118
|
+
* @param {number} callbackId The callback to invoke
|
119
|
+
*/
|
120
|
+
google.wspl.gears.Transaction.prototype.success = function(result,
|
121
|
+
callbackId) {
|
122
|
+
if (!this.needsRollback_) {
|
123
|
+
var activeExecute = this.activeExecutes_[callbackId];
|
124
|
+
activeExecute.callback.onSuccess(this, result);
|
125
|
+
}
|
126
|
+
this.endStatement_(callbackId);
|
127
|
+
};
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Invokes onFailure on the specified callback.
|
131
|
+
*
|
132
|
+
* @param {Error} error The error of an unsuccessful statement
|
133
|
+
* @param {number} callbackId The callback to invoke
|
134
|
+
*/
|
135
|
+
google.wspl.gears.Transaction.prototype.failure = function(error,
|
136
|
+
callbackId) {
|
137
|
+
if (!this.needsRollback_) {
|
138
|
+
this.needsRollback_ = true;
|
139
|
+
var activeExecute = this.activeExecutes_[callbackId];
|
140
|
+
activeExecute.callback.onFailure(error);
|
141
|
+
}
|
142
|
+
this.endStatement_(callbackId);
|
143
|
+
};
|
144
|
+
|
145
|
+
/**
|
146
|
+
* Handles clean up for the end of a single execution.
|
147
|
+
*
|
148
|
+
* @param {number} callbackId The callback to clean up.
|
149
|
+
* @private
|
150
|
+
*/
|
151
|
+
google.wspl.gears.Transaction.prototype.endStatement_ = function(callbackId) {
|
152
|
+
var activeExecute = this.activeExecutes_[callbackId];
|
153
|
+
var statements = activeExecute.statements;
|
154
|
+
var currentStatement = ++activeExecute.currentStatement;
|
155
|
+
|
156
|
+
if (currentStatement == statements.length) {
|
157
|
+
this.endExecute_(callbackId);
|
158
|
+
}
|
159
|
+
};
|
160
|
+
|
161
|
+
/**
|
162
|
+
* Handles clean up for the end of a call to executeAll. Performs a commit or
|
163
|
+
* rollback if this is the last active execute to clean up.
|
164
|
+
*
|
165
|
+
* @param {number} callbackId The callback to clean up
|
166
|
+
* @private
|
167
|
+
*/
|
168
|
+
google.wspl.gears.Transaction.prototype.endExecute_ = function(callbackId) {
|
169
|
+
delete this.activeExecutes_[callbackId];
|
170
|
+
this.numActiveExecutes_--;
|
171
|
+
if (!this.isExecuting()) {
|
172
|
+
this.endTransaction_();
|
173
|
+
}
|
174
|
+
};
|
175
|
+
|
176
|
+
/**
|
177
|
+
* Instructs the worker to commit the transaction or roll it back if a failure
|
178
|
+
* occurred and a rollback is required.
|
179
|
+
*
|
180
|
+
* @private
|
181
|
+
*/
|
182
|
+
google.wspl.gears.Transaction.prototype.endTransaction_ = function() {
|
183
|
+
if (this.needsRollback_) {
|
184
|
+
this.db_.doRollback(this.id_);
|
185
|
+
} else {
|
186
|
+
this.db_.doCommit(this.id_);
|
187
|
+
}
|
188
|
+
};
|
189
|
+
|
190
|
+
/**
|
191
|
+
* @return {boolean} True if the transaction has statements executing, false
|
192
|
+
* otherwise.
|
193
|
+
*/
|
194
|
+
google.wspl.gears.Transaction.prototype.isExecuting = function() {
|
195
|
+
return this.numActiveExecutes_ > 0;
|
196
|
+
};
|
@@ -0,0 +1,221 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<!--
|
3
|
+
Copyright 2009 Google Inc.
|
4
|
+
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
you may not use this file except in compliance with the License.
|
7
|
+
You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
-->
|
17
|
+
|
18
|
+
<html>
|
19
|
+
<head>
|
20
|
+
<title>Gears transaction tests</title>
|
21
|
+
<script type="text/javascript" src="../jsunit/app/jsUnitCore.js"></script>
|
22
|
+
<script type="text/javascript" src="jsmock.js"></script>
|
23
|
+
<script type="text/javascript" src="global_functions.js"></script>
|
24
|
+
<script type="text/javascript" src="dbwrapperapi.js"></script>
|
25
|
+
<script type="text/javascript" src="gears_resultset.js"></script>
|
26
|
+
<script type="text/javascript" src="gears_transaction.js"></script>
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type='text/javascript'>
|
30
|
+
|
31
|
+
var mockControl;
|
32
|
+
var callbackMock;
|
33
|
+
var dbMock;
|
34
|
+
|
35
|
+
function setUp() {
|
36
|
+
mockControl = new MockControl();
|
37
|
+
callbackMock = mockControl.createMock({
|
38
|
+
onSuccess: function(){},
|
39
|
+
onFailure: function(){}
|
40
|
+
});
|
41
|
+
dbMock = mockControl.createMock({
|
42
|
+
doBegin: function(){},
|
43
|
+
doCommit: function(){},
|
44
|
+
doRollback: function(){},
|
45
|
+
doExecute: function(){}
|
46
|
+
});
|
47
|
+
}
|
48
|
+
|
49
|
+
function testConstructTransaction() {
|
50
|
+
var trans = new google.wspl.gears.Transaction(10, 'foo');
|
51
|
+
assertEquals('foo', trans.db_);
|
52
|
+
assertEquals(10, trans.id_);
|
53
|
+
}
|
54
|
+
|
55
|
+
function testExecuteAll_noStatements() {
|
56
|
+
var trans = new google.wspl.gears.Transaction(27, dbMock);
|
57
|
+
|
58
|
+
try {
|
59
|
+
trans.executeAll([], callbackMock);
|
60
|
+
fail('Should never get here');
|
61
|
+
} catch(e) {
|
62
|
+
if (e.isJsUnitException) {
|
63
|
+
throw e;
|
64
|
+
}
|
65
|
+
assertEquals('did not exception fault on empty statement list',
|
66
|
+
'Error: Possibly silly attempt to execute empty statement list.',
|
67
|
+
e.toString());
|
68
|
+
}
|
69
|
+
mockControl.verify();
|
70
|
+
}
|
71
|
+
|
72
|
+
function testExecuteAll_noCallback() {
|
73
|
+
var stat1 = new google.wspl.Statement('stat1');
|
74
|
+
var stat2 = new google.wspl.Statement('stat2', [1]);
|
75
|
+
var stat3 = new google.wspl.Statement('stat3', [2, 3]);
|
76
|
+
var transactionId = 27;
|
77
|
+
var callbackId = 1;
|
78
|
+
var trans = new google.wspl.gears.Transaction(transactionId, dbMock);
|
79
|
+
|
80
|
+
dbMock.expects().doBegin(transactionId);
|
81
|
+
dbMock.expects().doExecute([stat1, stat2, stat3], callbackId, transactionId);
|
82
|
+
dbMock.expects().doCommit(transactionId);
|
83
|
+
|
84
|
+
trans.executeAll([stat1, stat2, stat3]);
|
85
|
+
trans.success('resultset1', callbackId);
|
86
|
+
trans.success('resultset2', callbackId);
|
87
|
+
trans.success('resultset3', callbackId);
|
88
|
+
}
|
89
|
+
|
90
|
+
function testExecuteAll_success() {
|
91
|
+
var stat1 = new google.wspl.Statement('stat1');
|
92
|
+
var stat2 = new google.wspl.Statement('stat2', [1]);
|
93
|
+
var stat3 = new google.wspl.Statement('stat3', [2, 3]);
|
94
|
+
var transactionId = 27;
|
95
|
+
var callbackId = 1;
|
96
|
+
var trans = new google.wspl.gears.Transaction(transactionId, dbMock);
|
97
|
+
|
98
|
+
dbMock.expects().doBegin(transactionId);
|
99
|
+
dbMock.expects().doExecute([stat1, stat2, stat3], callbackId, transactionId);
|
100
|
+
callbackMock.expect().onSuccess(trans, 'resultset1');
|
101
|
+
callbackMock.expect().onSuccess(trans, 'resultset2');
|
102
|
+
callbackMock.expect().onSuccess(trans, 'resultset3');
|
103
|
+
dbMock.expects().doCommit(transactionId);
|
104
|
+
|
105
|
+
trans.executeAll([stat1, stat2, stat3], callbackMock);
|
106
|
+
trans.success('resultset1', callbackId);
|
107
|
+
trans.success('resultset2', callbackId);
|
108
|
+
trans.success('resultset3', callbackId);
|
109
|
+
|
110
|
+
mockControl.verify();
|
111
|
+
}
|
112
|
+
|
113
|
+
function testExecuteAll_failure() {
|
114
|
+
var stat1 = new google.wspl.Statement('stat1');
|
115
|
+
var stat2 = new google.wspl.Statement('stat2', [1]);
|
116
|
+
var stat3 = new google.wspl.Statement('stat3', [2, 3]);
|
117
|
+
var stat4 = new google.wspl.Statement('stat4', [4, 5]);
|
118
|
+
var transactionId = 27;
|
119
|
+
var callbackId = 1;
|
120
|
+
var trans = new google.wspl.gears.Transaction(transactionId, dbMock);
|
121
|
+
|
122
|
+
dbMock.expects().doBegin(transactionId);
|
123
|
+
dbMock.expects().doExecute([stat1, stat2, stat3, stat4], callbackId,
|
124
|
+
transactionId);
|
125
|
+
|
126
|
+
callbackMock.expect().onSuccess(trans, 'resultset1');
|
127
|
+
callbackMock.expect().onFailure('sql error');
|
128
|
+
dbMock.expects().doRollback(transactionId);
|
129
|
+
|
130
|
+
trans.executeAll([stat1, stat2, stat3, stat4], callbackMock);
|
131
|
+
trans.success('resultset1', callbackId);
|
132
|
+
trans.failure('sql error', callbackId);
|
133
|
+
|
134
|
+
// These should do nothing.
|
135
|
+
trans.success('resultset3', callbackId);
|
136
|
+
trans.failure('sql error', callbackId);
|
137
|
+
|
138
|
+
mockControl.verify();
|
139
|
+
}
|
140
|
+
|
141
|
+
function testExecuteAll_multipleCalls() {
|
142
|
+
var stat1 = new google.wspl.Statement('stat1');
|
143
|
+
var stat2 = new google.wspl.Statement('stat2', [1]);
|
144
|
+
var stat3 = new google.wspl.Statement('stat3', [2, 3]);
|
145
|
+
var stat4 = new google.wspl.Statement('stat4', [4, 5]);
|
146
|
+
var transactionId = 27;
|
147
|
+
var callbackId_1 = 1;
|
148
|
+
var callbackId_2 = 2;
|
149
|
+
var callbackId_3 = 3;
|
150
|
+
var trans = new google.wspl.gears.Transaction(transactionId, dbMock);
|
151
|
+
|
152
|
+
dbMock.expects().doBegin(transactionId);
|
153
|
+
dbMock.expects().doExecute([stat1, stat2], callbackId_1, transactionId);
|
154
|
+
dbMock.expects().doExecute([stat3], callbackId_2, transactionId);
|
155
|
+
callbackMock.expects().onSuccess(trans, 'resultset1').andStub(function() {
|
156
|
+
trans.executeAll([stat4], callbackMock);
|
157
|
+
});
|
158
|
+
dbMock.expects().doExecute([stat4], callbackId_3, transactionId);
|
159
|
+
callbackMock.expects().onSuccess(trans, 'resultset2').andStub(function() {});
|
160
|
+
callbackMock.expects().onSuccess(trans, 'resultset3');
|
161
|
+
callbackMock.expects().onSuccess(trans, 'resultset4');
|
162
|
+
dbMock.expects().doCommit(transactionId);
|
163
|
+
|
164
|
+
trans.executeAll([stat1, stat2], callbackMock);
|
165
|
+
trans.executeAll([stat3], callbackMock);
|
166
|
+
trans.success('resultset1', callbackId_1);
|
167
|
+
trans.success('resultset2', callbackId_1);
|
168
|
+
trans.success('resultset3', callbackId_2);
|
169
|
+
trans.success('resultset4', callbackId_3);
|
170
|
+
|
171
|
+
mockControl.verify();
|
172
|
+
}
|
173
|
+
|
174
|
+
function testOnSuccess() {
|
175
|
+
var transactionId = 27;
|
176
|
+
var callbackId = 3;
|
177
|
+
var trans = new google.wspl.gears.Transaction(transactionId, dbMock);
|
178
|
+
|
179
|
+
callbackMock.expects().onSuccess(trans, 'result2');
|
180
|
+
callbackMock.expects().onSuccess(trans, 'result3');
|
181
|
+
dbMock.expects().doCommit(transactionId);
|
182
|
+
|
183
|
+
trans.numActiveExecutes_ = 1;
|
184
|
+
trans.activeExecutes_[callbackId] = {
|
185
|
+
statements: ['s1', 's2', 's3'],
|
186
|
+
currentStatement: 1,
|
187
|
+
callback: callbackMock
|
188
|
+
};
|
189
|
+
trans.success('result2', callbackId);
|
190
|
+
trans.success('result3', callbackId);
|
191
|
+
assertUndefined('activeExecute not removed',
|
192
|
+
trans.activeExecutes_[callbackId]);
|
193
|
+
mockControl.verify();
|
194
|
+
}
|
195
|
+
|
196
|
+
function testOnFailure() {
|
197
|
+
var transactionId = 27;
|
198
|
+
var callbackId = 5;
|
199
|
+
callbackMock.expects().onFailure(TypeOf.isA(Error)).andStub(function() {
|
200
|
+
assertEquals('error not returned', 'error', arguments[0].message);
|
201
|
+
});
|
202
|
+
dbMock.expects().doRollback(transactionId);
|
203
|
+
var trans = new google.wspl.gears.Transaction(transactionId, dbMock);
|
204
|
+
|
205
|
+
trans.numActiveExecutes_ = 1;
|
206
|
+
trans.activeExecutes_[callbackId] = {
|
207
|
+
statements: ['s1', 's2', 's3'],
|
208
|
+
currentStatement: 1,
|
209
|
+
callback: callbackMock
|
210
|
+
};
|
211
|
+
|
212
|
+
trans.failure(Error('error'), callbackId);
|
213
|
+
trans.success('result3', callbackId);
|
214
|
+
assertUndefined('activeExecute not removed',
|
215
|
+
trans.activeExecutes_[callbackId]);
|
216
|
+
mockControl.verify();
|
217
|
+
}
|
218
|
+
|
219
|
+
</script>
|
220
|
+
</body>
|
221
|
+
</html>
|