middleman-core 3.4.1 → 4.0.0.alpha.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{fixtures/asciidoc-app/config.rb → .gemtest} +0 -0
- data/.yardopts +2 -6
- data/Rakefile +5 -1
- data/features/asset_hash.feature +32 -61
- data/features/asset_host.feature +11 -23
- data/features/builder.feature +2 -0
- data/features/cache_buster.feature +1 -1
- data/features/chained_templates.feature +2 -92
- data/features/clean_build.feature +0 -18
- data/features/cli_init.feature +17 -111
- data/features/content_type.feature +2 -5
- data/features/custom_layouts.feature +24 -20
- data/features/data.feature +0 -28
- data/features/directory_index.feature +9 -9
- data/features/front-matter-neighbor.feature +0 -32
- data/features/front-matter.feature +0 -17
- data/features/helpers_content_tag.feature +2 -2
- data/features/helpers_form_tag.feature +4 -4
- data/features/helpers_link_to.feature +11 -29
- data/features/helpers_url_for.feature +11 -11
- data/features/i18n_builder.feature +5 -5
- data/features/i18n_preview.feature +8 -8
- data/features/markdown_kramdown.feature +1 -1
- data/features/markdown_kramdown_in_haml.feature +1 -2
- data/features/markdown_redcarpet.feature +23 -23
- data/features/minify_css.feature +9 -75
- data/features/minify_javascript.feature +12 -65
- data/features/mount_rack.feature +2 -4
- data/features/multiple-sources.feature +27 -0
- data/features/proxy_pages.feature +0 -10
- data/features/redirects.feature +6 -7
- data/features/relative_assets.feature +21 -66
- data/features/slim.feature +11 -7
- data/features/stylus.feature +1 -1
- data/features/support/env.rb +4 -4
- data/fixtures/asset-hash-app/config.rb +0 -2
- data/fixtures/asset-hash-app/source/index.html.erb +1 -1
- data/fixtures/asset-hash-host-app/config.rb +1 -3
- data/fixtures/asset-host-app/source/asset_host.html.erb +20 -1
- data/fixtures/asset-host-app/source/stylesheets/asset_host.css.sass +47 -2
- data/fixtures/auto-css-app/config.rb +8 -10
- data/fixtures/auto-js-app/config.rb +8 -10
- data/fixtures/basic-data-app/config.rb +2 -4
- data/fixtures/cache-buster-app/source/stylesheets/relative_assets.css.sass +0 -1
- data/fixtures/cache-buster-app/source/stylesheets/site.css.sass +3 -1
- data/fixtures/capture-html-app/config.rb +3 -5
- data/fixtures/clean-app/config-complications.rb +4 -6
- data/fixtures/clean-app/config.rb +4 -6
- data/fixtures/content-for-app/config.rb +3 -5
- data/fixtures/custom-layout-app/config.rb +1 -1
- data/fixtures/data-app/config.rb +1 -1
- data/fixtures/dynamic-pages-app/config.rb +20 -42
- data/fixtures/dynamic-pages-app/source/real/index.html.erb +3 -3
- data/fixtures/ember-cli-app/config.rb +5 -0
- data/fixtures/{compass-sprites-app/config.rb → ember-cli-app/source/javascripts/file.js} +0 -0
- data/fixtures/ember-cli-app/test-app/.bowerrc +3 -0
- data/fixtures/ember-cli-app/test-app/.gitignore +17 -0
- data/fixtures/ember-cli-app/test-app/.jshintrc +32 -0
- data/fixtures/ember-cli-app/test-app/Brocfile.js +20 -0
- data/fixtures/ember-cli-app/test-app/README.md +25 -0
- data/fixtures/ember-cli-app/test-app/app/app.js +14 -0
- data/fixtures/{implied-extensions-app/config.rb → ember-cli-app/test-app/app/components/.gitkeep} +0 -0
- data/fixtures/{javascript-app/config.rb → ember-cli-app/test-app/app/controllers/.gitkeep} +0 -0
- data/fixtures/{more-implied-extensions-app/config.rb → ember-cli-app/test-app/app/helpers/.gitkeep} +0 -0
- data/fixtures/ember-cli-app/test-app/app/index.html +26 -0
- data/fixtures/{partial-chained_templates-app/config.rb → ember-cli-app/test-app/app/models/.gitkeep} +0 -0
- data/fixtures/ember-cli-app/test-app/app/router.js +10 -0
- data/fixtures/{preview-server-app/config-empty.rb → ember-cli-app/test-app/app/routes/.gitkeep} +0 -0
- data/fixtures/{request-app/config.rb → ember-cli-app/test-app/app/styles/.gitkeep} +0 -0
- data/fixtures/ember-cli-app/test-app/app/styles/app.css +3 -0
- data/fixtures/{traversal-app/source/.htaccess → ember-cli-app/test-app/app/templates/.gitkeep} +0 -0
- data/fixtures/ember-cli-app/test-app/app/templates/application.hbs +3 -0
- data/{lib/middleman-core/templates/html5/source/img/.gitignore → fixtures/ember-cli-app/test-app/app/templates/components/.gitkeep} +0 -0
- data/{lib/middleman-core/templates/mobile/source/js/script.js → fixtures/ember-cli-app/test-app/app/views/.gitkeep} +0 -0
- data/fixtures/ember-cli-app/test-app/bower.json +16 -0
- data/fixtures/ember-cli-app/test-app/config/environment.js +38 -0
- data/fixtures/ember-cli-app/test-app/package.json +31 -0
- data/fixtures/ember-cli-app/test-app/public/.gitkeep +0 -0
- data/fixtures/ember-cli-app/test-app/testem.json +6 -0
- data/fixtures/ember-cli-app/test-app/tests/.jshintrc +73 -0
- data/fixtures/ember-cli-app/test-app/tests/helpers/resolver.js +9 -0
- data/fixtures/ember-cli-app/test-app/tests/helpers/start-app.js +30 -0
- data/fixtures/ember-cli-app/test-app/tests/index.html +50 -0
- data/fixtures/ember-cli-app/test-app/tests/test-helper.js +6 -0
- data/fixtures/ember-cli-app/test-app/tests/unit/.gitkeep +0 -0
- data/fixtures/env-app/config.rb +0 -0
- data/fixtures/env-app/environments/development.rb +1 -0
- data/fixtures/env-app/environments/production.rb +2 -0
- data/fixtures/env-app/source/index.html.erb +3 -0
- data/fixtures/env-app/source/stylesheets/site.css.scss +3 -0
- data/fixtures/external-helpers/config.rb +1 -1
- data/fixtures/feature-params-app/config.rb +10 -6
- data/fixtures/feature-params-app/source/index.html.erb +2 -3
- data/fixtures/fonts-app/source/stylesheets/fonts.css.scss +6 -0
- data/fixtures/frontmatter-neighbor-app/config.rb +30 -0
- data/fixtures/frontmatter-settings-app/config.rb +2 -2
- data/fixtures/frontmatter-settings-neighbor-app/config.rb +33 -3
- data/fixtures/generator-test/config.rb +5 -10
- data/fixtures/glob-app/config.rb +1 -1
- data/fixtures/i18n-force-locale/config.rb +2 -4
- data/fixtures/i18n-force-locale/source/{index.haml → index.html.haml} +0 -0
- data/fixtures/i18n-test-app/source/localizable/{one.en.md → one.en.html.md} +0 -0
- data/fixtures/i18n-test-app/source/localizable/{one.es.md → one.es.html.md} +0 -0
- data/fixtures/indexable-app/config.rb +2 -2
- data/fixtures/indexable-app/source/evil spaces.html +1 -1
- data/fixtures/large-build-app/config.rb +1 -5
- data/fixtures/large-build-app/source/spaces in file.html.erb +1 -1
- data/fixtures/manual-layout-override/config.rb +1 -1
- data/fixtures/markdown-app/config.rb +1 -1
- data/fixtures/markdown-frontmatter-options-app/config.rb +1 -1
- data/fixtures/minify-css-app/source/stylesheets/site.css.sass +3 -1
- data/fixtures/more-frontmatter-settings-app/config.rb +1 -1
- data/fixtures/more-markdown-app/source/{with_layout.markdown → with_layout.html.markdown} +0 -0
- data/fixtures/more-markdown-app/source/{with_layout_erb.markdown.erb → with_layout_erb.html.markdown.erb} +0 -0
- data/fixtures/more-traversal-app/config.rb +4 -4
- data/fixtures/more-traversal-app/source/layout.erb +1 -1
- data/fixtures/multiple-data-sources-app/config.rb +3 -0
- data/fixtures/multiple-data-sources-app/data/data.yml +1 -0
- data/fixtures/multiple-data-sources-app/data/two.yml +1 -0
- data/fixtures/multiple-data-sources-app/data0/one.yml +1 -0
- data/fixtures/multiple-data-sources-app/data1/data1.yml +1 -0
- data/fixtures/multiple-data-sources-app/data1/one.yml +1 -0
- data/fixtures/multiple-data-sources-app/data2/data2.yml +1 -0
- data/fixtures/multiple-data-sources-app/data2/two.yml +1 -0
- data/fixtures/multiple-data-sources-app/source/index.html.erb +10 -0
- data/fixtures/multiple-sources-app/config.rb +3 -0
- data/fixtures/multiple-sources-app/source/index.html.erb +1 -0
- data/fixtures/multiple-sources-app/source/override-in-two.html.erb +1 -0
- data/fixtures/multiple-sources-app/source0/override-in-one.html.erb +1 -0
- data/fixtures/multiple-sources-app/source1/index1.html.erb +1 -0
- data/fixtures/multiple-sources-app/source1/override-in-one.html.erb +1 -0
- data/fixtures/multiple-sources-app/source2/index2.html.erb +1 -0
- data/fixtures/multiple-sources-app/source2/override-in-two.html.erb +1 -0
- data/fixtures/padrino-helpers-app/source/former_padrino_test.html.erb +3 -3
- data/fixtures/page-classes-app/config.rb +2 -4
- data/fixtures/page-classes-app/source/2-starts-with-numeric-custom.html.erb +1 -1
- data/fixtures/page-helper-layout-block-app/config.rb +1 -1
- data/fixtures/partials-app/source/locals.html.erb +1 -1
- data/fixtures/partials-app/source/shared/{snippet.erb → _snippet.html.erb} +0 -0
- data/fixtures/partials-app/source/sub/index.html.erb +1 -1
- data/fixtures/passthrough-app/source/stylesheets/site.css.sass +5 -1
- data/fixtures/proxy-pages-app/config.rb +12 -15
- data/fixtures/relative-app/source/stylesheets/relative_assets.css.sass +1 -2
- data/fixtures/relative-assets-app/source/javascripts/application.js +8 -0
- data/fixtures/relative-assets-app/source/relative_image.html.erb +0 -1
- data/fixtures/relative-assets-app/source/stylesheets/relative_assets.css.sass +1 -2
- data/fixtures/scss-app/source/stylesheets/site_scss.css.scss +3 -1
- data/fixtures/stylus-preview-app/source/content.html.erb +4 -0
- data/fixtures/traversal-app/config.rb +4 -4
- data/fixtures/traversal-app/source/layout.erb +1 -1
- data/fixtures/v4-extension-callbacks/config.rb +21 -5
- data/fixtures/wildcard-app/config.rb +1 -1
- data/fixtures/wildcard-directory-index-app/config.rb +1 -1
- data/lib/middleman-core.rb +5 -2
- data/lib/middleman-core/application.rb +212 -131
- data/lib/middleman-core/builder.rb +255 -0
- data/lib/middleman-core/config_context.rb +103 -0
- data/lib/middleman-core/configuration.rb +15 -92
- data/lib/middleman-core/contracts.rb +149 -0
- data/lib/middleman-core/core_extensions.rb +86 -45
- data/lib/middleman-core/core_extensions/data.rb +82 -72
- data/lib/{middleman-more → middleman-core}/core_extensions/default_helpers.rb +34 -140
- data/lib/middleman-core/core_extensions/external_helpers.rb +23 -27
- data/lib/middleman-core/core_extensions/file_watcher.rb +59 -169
- data/lib/middleman-core/core_extensions/front_matter.rb +72 -131
- data/lib/middleman-core/core_extensions/i18n.rb +186 -0
- data/lib/middleman-core/core_extensions/rendering.rb +45 -533
- data/lib/middleman-core/core_extensions/routing.rb +53 -51
- data/lib/middleman-core/core_extensions/show_exceptions.rb +11 -18
- data/lib/middleman-core/extension.rb +183 -56
- data/lib/middleman-core/extension_manager.rb +80 -0
- data/lib/middleman-core/extensions.rb +96 -67
- data/lib/middleman-core/extensions/asset_hash.rb +92 -0
- data/lib/middleman-core/extensions/asset_host.rb +37 -0
- data/lib/{middleman-more → middleman-core}/extensions/automatic_alt_tags.rb +6 -5
- data/lib/{middleman-more → middleman-core}/extensions/automatic_image_sizes.rb +9 -13
- data/lib/middleman-core/extensions/cache_buster.rb +27 -0
- data/lib/{middleman-more → middleman-core}/extensions/directory_indexes.rb +9 -7
- data/lib/middleman-core/extensions/external_pipeline.rb +37 -0
- data/lib/{middleman-more → middleman-core}/extensions/gzip.rb +10 -3
- data/lib/{middleman-more → middleman-core}/extensions/lorem.rb +2 -2
- data/lib/middleman-core/extensions/minify_css.rb +86 -0
- data/lib/middleman-core/extensions/minify_javascript.rb +93 -0
- data/lib/middleman-core/extensions/relative_assets.rb +38 -0
- data/lib/middleman-core/file_renderer.rb +139 -0
- data/lib/middleman-core/load_paths.rb +21 -28
- data/lib/middleman-core/meta_pages.rb +9 -9
- data/lib/middleman-core/meta_pages/sitemap_resource.rb +3 -6
- data/lib/middleman-core/meta_pages/sitemap_tree.rb +1 -1
- data/lib/middleman-core/middleware/inline_url_rewriter.rb +96 -0
- data/lib/middleman-core/preview_server.rb +65 -196
- data/lib/middleman-core/profiling.rb +14 -15
- data/lib/middleman-core/rack.rb +138 -0
- data/lib/middleman-core/renderers/coffee_script.rb +10 -13
- data/lib/middleman-core/renderers/erb.rb +3 -15
- data/lib/middleman-core/renderers/haml.rb +33 -18
- data/lib/middleman-core/renderers/kramdown.rb +6 -4
- data/lib/middleman-core/renderers/less.rb +12 -18
- data/lib/middleman-core/renderers/liquid.rb +22 -18
- data/lib/middleman-core/renderers/markdown.rb +36 -49
- data/lib/middleman-core/renderers/redcarpet.rb +11 -4
- data/lib/middleman-core/renderers/sass.rb +36 -27
- data/lib/middleman-core/renderers/sass_functions.rb +116 -0
- data/lib/middleman-core/renderers/slim.rb +19 -26
- data/lib/middleman-core/renderers/stylus.rb +4 -14
- data/lib/middleman-core/sitemap/extensions/ignores.rb +35 -73
- data/lib/middleman-core/sitemap/extensions/on_disk.rb +29 -48
- data/lib/middleman-core/sitemap/extensions/proxies.rb +111 -133
- data/lib/middleman-core/sitemap/extensions/redirects.rb +68 -102
- data/lib/middleman-core/sitemap/extensions/request_endpoints.rb +59 -83
- data/lib/middleman-core/sitemap/extensions/traversal.rb +14 -15
- data/lib/middleman-core/sitemap/resource.rb +99 -71
- data/lib/middleman-core/sitemap/store.rb +79 -132
- data/lib/middleman-core/sources.rb +310 -0
- data/lib/middleman-core/sources/source_watcher.rb +268 -0
- data/lib/middleman-core/step_definitions.rb +2 -3
- data/lib/middleman-core/step_definitions/builder_steps.rb +15 -13
- data/lib/middleman-core/step_definitions/middleman_steps.rb +2 -18
- data/lib/middleman-core/step_definitions/server_steps.rb +43 -77
- data/lib/middleman-core/template_context.rb +181 -0
- data/lib/middleman-core/template_renderer.rb +213 -0
- data/lib/middleman-core/util.rb +319 -241
- data/lib/middleman-core/util/hash_with_indifferent_access.rb +103 -0
- data/lib/middleman-core/version.rb +1 -1
- data/lib/middleman/rack.rb +0 -1
- data/middleman-core.gemspec +36 -28
- data/spec/middleman-core/path_match_spec.rb +37 -0
- data/spec/spec_helper.rb +2 -25
- metadata +237 -454
- data/bin/middleman +0 -18
- data/cucumber.yml +0 -2
- data/features/asciidoc.feature +0 -155
- data/features/cli/preview_server-hook.feature +0 -17
- data/features/cli/preview_server.feature +0 -532
- data/features/compass-sprites.feature +0 -6
- data/features/console.feature +0 -10
- data/features/current_page_request_path_backwards.feature +0 -6
- data/features/fonts.feature +0 -15
- data/features/i18n_link_to.feature +0 -209
- data/features/image_srcset_paths.feature +0 -7
- data/features/implied_extensions.feature +0 -69
- data/features/instance_vars.feature +0 -9
- data/features/javascript-testing.feature +0 -18
- data/features/more-implied_extensions.feature +0 -44
- data/features/partials_dir.feature +0 -30
- data/features/queryable.feature +0 -35
- data/features/request_params.feature +0 -6
- data/features/static_server.feature +0 -6
- data/features/step_definitions/page_layout_steps.rb +0 -15
- data/features/step_definitions/queryable_steps.rb +0 -212
- data/features/support/preserve_mime_types.rb +0 -7
- data/features/v3_extensions.feature +0 -20
- data/features/working_directory.feature +0 -33
- data/fixtures/asciidoc-app/source/_include.adoc +0 -1
- data/fixtures/asciidoc-app/source/code.adoc +0 -3
- data/fixtures/asciidoc-app/source/custom-attribute.adoc +0 -3
- data/fixtures/asciidoc-app/source/gallery.adoc +0 -1
- data/fixtures/asciidoc-app/source/hello-no-layout.adoc +0 -2
- data/fixtures/asciidoc-app/source/hello-with-front-matter.adoc +0 -5
- data/fixtures/asciidoc-app/source/hello-with-layout.adoc +0 -2
- data/fixtures/asciidoc-app/source/hello-with-title.adoc +0 -5
- data/fixtures/asciidoc-app/source/hello.adoc +0 -4
- data/fixtures/asciidoc-app/source/images/tiger.gif +0 -0
- data/fixtures/asciidoc-app/source/layouts/default.erb +0 -9
- data/fixtures/asciidoc-app/source/master.adoc +0 -3
- data/fixtures/asset-hash-app/source/api.json.erb +0 -1
- data/fixtures/asset-hash-app/source/fonts/fontawesome-webfont.woff +0 -0
- data/fixtures/asset-hash-app/source/fonts/fontawesome-webfont.woff2 +0 -0
- data/fixtures/asset-hash-app/source/images/200px.jpg +0 -0
- data/fixtures/asset-hash-app/source/images/300px.jpg +0 -0
- data/fixtures/asset-hash-app/source/slim.html.slim +0 -8
- data/fixtures/asset-hash-app/source/stylesheets/uses_fonts.css +0 -4
- data/fixtures/asset-hash-app/source/subdir/api.json.erb +0 -1
- data/fixtures/chained-app/source/test.erb.combobreaker.str.erb +0 -8
- data/fixtures/clean-app/config-hidden-dir-after.rb +0 -5
- data/fixtures/clean-app/config-hidden-dir-before.rb +0 -1
- data/fixtures/compass-sprites-app/source/images/icon/arrow_down.png +0 -0
- data/fixtures/compass-sprites-app/source/images/icon/arrow_left.png +0 -0
- data/fixtures/compass-sprites-app/source/images/icon/arrow_right.png +0 -0
- data/fixtures/compass-sprites-app/source/images/icon/arrow_up.png +0 -0
- data/fixtures/compass-sprites-app/source/stylesheets/site.css.scss +0 -3
- data/fixtures/content-type-app/source/index.php +0 -1
- data/fixtures/current-page-app/config.rb +0 -3
- data/fixtures/current-page-app/source/request-path.html.erb +0 -1
- data/fixtures/default-partials-dir-app/source/_partial.html.erb +0 -1
- data/fixtures/default-partials-dir-app/source/index.html.erb +0 -2
- data/fixtures/fonts-app/source/stylesheets/fonts.css.sass +0 -5
- data/fixtures/frontmatter-app/source/front-matter-auto.erb +0 -6
- data/fixtures/frontmatter-app/source/front-matter-pandoc.html.md.erb +0 -13
- data/fixtures/frontmatter-app/source/json-front-matter-auto.erb +0 -6
- data/fixtures/frontmatter-neighbor-app/source/front-matter-auto.erb +0 -1
- data/fixtures/frontmatter-neighbor-app/source/front-matter-auto.erb.frontmatter +0 -4
- data/fixtures/frontmatter-neighbor-app/source/json-front-matter-auto.erb +0 -1
- data/fixtures/frontmatter-neighbor-app/source/json-front-matter-auto.erb.frontmatter +0 -4
- data/fixtures/image-srcset-paths-app/image-srcset-paths.html.erb +0 -1
- data/fixtures/image-srcset-paths-app/images/blank.gif +0 -0
- data/fixtures/implied-extensions-app/source/index.erb +0 -1
- data/fixtures/instance-vars-app/config.rb +0 -7
- data/fixtures/instance-vars-app/source/content.html.erb +0 -2
- data/fixtures/instance-vars-app/source/layout.erb +0 -1
- data/fixtures/javascript-app/source/index.html +0 -17
- data/fixtures/minify-css-app/source/inline-css.php +0 -8
- data/fixtures/minify-css-app/source/stylesheets/site.xcss.sass +0 -5
- data/fixtures/minify-js-app/source/inline-js.php +0 -22
- data/fixtures/minify-js-app/source/javascripts/js_test.xjs +0 -8
- data/fixtures/more-implied-extensions-app/source/javascripts/app.coffee +0 -1
- data/fixtures/more-implied-extensions-app/source/layouts/layout.erb +0 -3
- data/fixtures/more-implied-extensions-app/source/stylesheets/style.scss +0 -3
- data/fixtures/more-implied-extensions-app/source/stylesheets/style2.sass +0 -3
- data/fixtures/more-implied-extensions-app/source/test.haml +0 -4
- data/fixtures/more-implied-extensions-app/source/test2.markdown +0 -3
- data/fixtures/more-implied-extensions-app/source/test3.slim +0 -3
- data/fixtures/more-implied-extensions-app/source/test4.liquid +0 -1
- data/fixtures/partials-dir-app/source/index.html.erb +0 -2
- data/fixtures/partials-dir-app/source/nested/partials/_partial.html.erb +0 -1
- data/fixtures/partials-dir-app/source/partials/_partial.html.erb +0 -1
- data/fixtures/plain-app/index.html +0 -1
- data/fixtures/preview-server-app/bin/dns_server.rb +0 -33
- data/fixtures/preview-server-app/config-complications.rb +0 -11
- data/fixtures/preview-server-app/config.rb +0 -11
- data/fixtures/preview-server-app/source/index.html.erb +0 -1
- data/fixtures/preview-server-app/source/layout.erb +0 -9
- data/fixtures/preview-server-app/source/layouts/custom.erb +0 -8
- data/fixtures/preview-server-app/source/real.html +0 -1
- data/fixtures/preview-server-app/source/real/index.html.erb +0 -5
- data/fixtures/preview-server-app/source/should_be_ignored.html +0 -1
- data/fixtures/preview-server-app/source/should_be_ignored2.html +0 -1
- data/fixtures/preview-server-app/source/should_be_ignored3.html +0 -1
- data/fixtures/preview-server-app/source/static.html +0 -1
- data/fixtures/preview-server-hook-app/config.rb +0 -19
- data/fixtures/preview-server-hook-app/source/index.html.erb +0 -9
- data/fixtures/proxy-pages-app/source/real/index-ivars.html.erb +0 -6
- data/fixtures/relative-assets-app/source/absolute_image_relative_css.html.erb +0 -9
- data/fixtures/relative-assets-app/source/javascripts/app.js +0 -3
- data/fixtures/relative-assets-app/source/relative_image_absolute_css.html.erb +0 -9
- data/fixtures/request-app/source/index.html.erb +0 -3
- data/fixtures/stylus-preview-app/source/layout.erb +0 -1
- data/lib/middleman-core/cli.rb +0 -88
- data/lib/middleman-core/cli/build.rb +0 -300
- data/lib/middleman-core/cli/bundler.rb +0 -39
- data/lib/middleman-core/cli/console.rb +0 -52
- data/lib/middleman-core/cli/extension.rb +0 -47
- data/lib/middleman-core/cli/init.rb +0 -71
- data/lib/middleman-core/cli/server.rb +0 -99
- data/lib/middleman-core/core_extensions/data/file_loader.rb +0 -71
- data/lib/middleman-core/core_extensions/extensions.rb +0 -197
- data/lib/middleman-core/core_extensions/request.rb +0 -312
- data/lib/middleman-core/dns_resolver.rb +0 -73
- data/lib/middleman-core/dns_resolver/basic_network_resolver.rb +0 -52
- data/lib/middleman-core/dns_resolver/hosts_resolver.rb +0 -63
- data/lib/middleman-core/dns_resolver/local_link_resolver.rb +0 -44
- data/lib/middleman-core/dns_resolver/network_resolver.rb +0 -42
- data/lib/middleman-core/preview_server/checks.rb +0 -81
- data/lib/middleman-core/preview_server/information.rb +0 -273
- data/lib/middleman-core/preview_server/network_interface_inventory.rb +0 -65
- data/lib/middleman-core/preview_server/server_hostname.rb +0 -39
- data/lib/middleman-core/preview_server/server_information.rb +0 -153
- data/lib/middleman-core/preview_server/server_information_callback_proxy.rb +0 -35
- data/lib/middleman-core/preview_server/server_information_validator.rb +0 -18
- data/lib/middleman-core/preview_server/server_ip_address.rb +0 -55
- data/lib/middleman-core/preview_server/server_url.rb +0 -63
- data/lib/middleman-core/preview_server/tcp_port_prober.rb +0 -29
- data/lib/middleman-core/renderers/asciidoc.rb +0 -58
- data/lib/middleman-core/sitemap.rb +0 -76
- data/lib/middleman-core/sitemap/extensions/content_type.rb +0 -16
- data/lib/middleman-core/sitemap/queryable.rb +0 -151
- data/lib/middleman-core/step_definitions/commandline_steps.rb +0 -88
- data/lib/middleman-core/templates.rb +0 -101
- data/lib/middleman-core/templates/default.rb +0 -37
- 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 +0 -10
- data/lib/middleman-core/templates/default/source/javascripts/all.js +0 -1
- data/lib/middleman-core/templates/default/source/layouts/layout.erb +0 -19
- data/lib/middleman-core/templates/default/source/stylesheets/all.css +0 -55
- data/lib/middleman-core/templates/default/source/stylesheets/normalize.css +0 -375
- data/lib/middleman-core/templates/empty.rb +0 -22
- data/lib/middleman-core/templates/empty/Gemfile.tt +0 -6
- data/lib/middleman-core/templates/extension/Gemfile +0 -18
- data/lib/middleman-core/templates/extension/Rakefile +0 -14
- data/lib/middleman-core/templates/extension/features/support/env.rb +0 -4
- data/lib/middleman-core/templates/extension/gemspec +0 -24
- data/lib/middleman-core/templates/extension/gitignore +0 -5
- data/lib/middleman-core/templates/extension/lib/lib.rb +0 -38
- data/lib/middleman-core/templates/extension/lib/middleman_extension.rb +0 -1
- data/lib/middleman-core/templates/html5.rb +0 -29
- data/lib/middleman-core/templates/html5/source/.htaccess +0 -542
- data/lib/middleman-core/templates/html5/source/404.html +0 -157
- data/lib/middleman-core/templates/html5/source/LICENSE.md +0 -19
- data/lib/middleman-core/templates/html5/source/README.md +0 -63
- 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-144x144-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 +0 -15
- data/lib/middleman-core/templates/html5/source/css/main.css +0 -298
- data/lib/middleman-core/templates/html5/source/css/normalize.css +0 -504
- data/lib/middleman-core/templates/html5/source/favicon.ico +0 -0
- data/lib/middleman-core/templates/html5/source/humans.txt +0 -15
- data/lib/middleman-core/templates/html5/source/index.html.erb +0 -6
- data/lib/middleman-core/templates/html5/source/js/main.js +0 -1
- data/lib/middleman-core/templates/html5/source/js/plugins.js +0 -14
- data/lib/middleman-core/templates/html5/source/js/vendor/jquery-1.8.0.min.js +0 -2
- data/lib/middleman-core/templates/html5/source/js/vendor/modernizr-2.6.1.min.js +0 -4
- data/lib/middleman-core/templates/html5/source/layouts/layout.erb +0 -40
- data/lib/middleman-core/templates/html5/source/robots.txt +0 -3
- data/lib/middleman-core/templates/local.rb +0 -27
- data/lib/middleman-core/templates/mobile.rb +0 -24
- data/lib/middleman-core/templates/mobile/source/404.html +0 -37
- data/lib/middleman-core/templates/mobile/source/README.markdown +0 -21
- data/lib/middleman-core/templates/mobile/source/crossdomain.xml +0 -25
- data/lib/middleman-core/templates/mobile/source/css/style.css +0 -315
- data/lib/middleman-core/templates/mobile/source/humans.txt +0 -43
- 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 +0 -92
- data/lib/middleman-core/templates/mobile/source/js/libs/modernizr-custom.js +0 -14
- data/lib/middleman-core/templates/mobile/source/js/libs/respond.min.js +0 -7
- data/lib/middleman-core/templates/mobile/source/js/mylibs/helper.js +0 -171
- data/lib/middleman-core/templates/mobile/source/js/plugins.js +0 -20
- data/lib/middleman-core/templates/mobile/source/robots.txt +0 -4
- data/lib/middleman-core/templates/mobile/source/sitemap.xml +0 -9
- data/lib/middleman-core/templates/mobile/source/test/index.html +0 -31
- data/lib/middleman-core/templates/mobile/source/test/qunit/qunit.css +0 -148
- data/lib/middleman-core/templates/mobile/source/test/qunit/qunit.js +0 -1265
- data/lib/middleman-core/templates/mobile/source/test/tests.js +0 -21
- 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 +0 -31
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/aspx/aspx2.snippet +0 -2
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/aspx/ga.aspx +0 -195
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/aspx/sample.aspx +0 -44
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/jsp/ga.jsp +0 -225
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/jsp/jsp1.snippet +0 -35
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/jsp/jsp2.snippet +0 -2
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/jsp/sample.jsp +0 -51
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/php/ga.php +0 -176
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/php/php1.snippet +0 -30
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/php/php2.snippet +0 -4
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/php/sample.php +0 -44
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/pl/ga.pl +0 -195
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/pl/perl1.snippet +0 -27
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/pl/perl2.snippet +0 -1
- data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/pl/sample.pl +0 -38
- data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/COPYING +0 -202
- data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/bookmark_bubble.js +0 -559
- data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/example/example.html +0 -43
- data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/example/example.js +0 -57
- 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 +0 -33
- 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 +0 -27
- data/lib/middleman-core/templates/mobile/source/tools/wspl/databasefactory.js +0 -45
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbworker.js +0 -324
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbworker_test.html +0 -393
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbworkerstarter.js +0 -32
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapper_gears.js +0 -595
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapper_gears_test.html +0 -404
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapper_html5.js +0 -203
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapper_html5_test.html +0 -468
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapperapi.js +0 -202
- data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapperapi_test.html +0 -51
- data/lib/middleman-core/templates/mobile/source/tools/wspl/gears_resultset.js +0 -71
- data/lib/middleman-core/templates/mobile/source/tools/wspl/gears_resultset_test.html +0 -86
- data/lib/middleman-core/templates/mobile/source/tools/wspl/gears_transaction.js +0 -196
- data/lib/middleman-core/templates/mobile/source/tools/wspl/gears_transaction_test.html +0 -221
- data/lib/middleman-core/templates/mobile/source/tools/wspl/gearsutils.js +0 -94
- data/lib/middleman-core/templates/mobile/source/tools/wspl/gearsutils_test.html +0 -84
- data/lib/middleman-core/templates/mobile/source/tools/wspl/global_functions.js +0 -72
- data/lib/middleman-core/templates/mobile/source/tools/wspl/simplenotes/index.html +0 -347
- data/lib/middleman-core/templates/mobile/source/tools/wspl/simplenotes/simplenotes.js +0 -503
- data/lib/middleman-core/templates/mobile/source/tools/wspl/simplenotes/styles.css +0 -66
- data/lib/middleman-core/templates/mobile/source/tools/wspl/simplenotes/template.js +0 -75
- data/lib/middleman-core/templates/shared/Gemfile.tt +0 -14
- data/lib/middleman-core/templates/shared/config.ru +0 -3
- data/lib/middleman-core/templates/shared/config.tt +0 -87
- data/lib/middleman-core/templates/shared/gitignore +0 -21
- data/lib/middleman-more/core_extensions/compass.rb +0 -75
- data/lib/middleman-more/core_extensions/i18n.rb +0 -312
- data/lib/middleman-more/extensions/asset_hash.rb +0 -128
- data/lib/middleman-more/extensions/asset_host.rb +0 -50
- data/lib/middleman-more/extensions/cache_buster.rb +0 -55
- data/lib/middleman-more/extensions/minify_css.rb +0 -112
- data/lib/middleman-more/extensions/minify_javascript.rb +0 -120
- data/lib/middleman-more/extensions/relative_assets.rb +0 -24
- data/lib/middleman-more/templates/smacss.rb +0 -29
- data/lib/middleman-more/templates/smacss/source/_footer.haml +0 -1
- data/lib/middleman-more/templates/smacss/source/index.html.haml +0 -1
- data/lib/middleman-more/templates/smacss/source/layouts/layout.haml +0 -13
- data/lib/middleman-more/templates/smacss/source/stylesheets/base/README.markdown +0 -11
- data/lib/middleman-more/templates/smacss/source/stylesheets/base/base.scss +0 -1
- data/lib/middleman-more/templates/smacss/source/stylesheets/base/normalize.scss +0 -375
- data/lib/middleman-more/templates/smacss/source/stylesheets/layout/README.markdown +0 -9
- data/lib/middleman-more/templates/smacss/source/stylesheets/modules/README.markdown +0 -9
- data/lib/middleman-more/templates/smacss/source/stylesheets/states/README.markdown +0 -12
- data/lib/middleman-more/templates/smacss/source/stylesheets/style.css.scss +0 -12
- data/lib/vendored-middleman-deps/fastimage.rb +0 -287
- data/spec/middleman-core/dns_resolver_spec.rb +0 -118
- data/spec/middleman-core/preview_server/server_hostname_spec.rb +0 -39
- data/spec/middleman-core/preview_server/server_ip_address_spec.rb +0 -43
@@ -1,468 +0,0 @@
|
|
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 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="dbwrapper_html5.js"></script>
|
26
|
-
</head>
|
27
|
-
<body>
|
28
|
-
<script type='text/javascript'>
|
29
|
-
|
30
|
-
var mockControl;
|
31
|
-
var html5Tx;
|
32
|
-
var callbackMock;
|
33
|
-
var html5Window;
|
34
|
-
var html5Db;
|
35
|
-
var populateMock;
|
36
|
-
|
37
|
-
function setUp() {
|
38
|
-
mockControl = new MockControl();
|
39
|
-
html5Tx = mockControl.createMock({executeSql: function(){}});
|
40
|
-
callbackMock = mockControl.createMock({onSuccess: function(){},
|
41
|
-
onFailure: function(){}});
|
42
|
-
html5Window = mockControl.createMock({openDatabase: function(){}});
|
43
|
-
html5Db = mockControl.createMock({transaction: function(){}});
|
44
|
-
populateMock = mockControl.createMock({populate: function(){}});
|
45
|
-
|
46
|
-
dbTx = mockControl.createMock({execute: function(){}, executeAll:
|
47
|
-
function(){}});
|
48
|
-
dbRows = mockControl.createMock({item: function(){}});
|
49
|
-
}
|
50
|
-
|
51
|
-
function testConstructTransaction() {
|
52
|
-
var trans = new google.wspl.html5.Transaction('foo');
|
53
|
-
assertEquals('transaction instance not set correctly', 'foo', trans.tx_);
|
54
|
-
}
|
55
|
-
|
56
|
-
function testTransactionExecuteAll() {
|
57
|
-
var trans = new google.wspl.html5.Transaction(html5Tx);
|
58
|
-
|
59
|
-
try {
|
60
|
-
trans.executeAll([], callbackMock);
|
61
|
-
fail('Should never get here');
|
62
|
-
} catch(e) {
|
63
|
-
assertEquals(
|
64
|
-
'did not exception fault on empty statement list',
|
65
|
-
'Error: Possibly silly attempt to execute empty statement list.',
|
66
|
-
e.toString());
|
67
|
-
}
|
68
|
-
mockControl.verify();
|
69
|
-
}
|
70
|
-
|
71
|
-
/*
|
72
|
-
The sequence of digits at the end of the test names indicate as boolean
|
73
|
-
variables the success or failure of each statement.
|
74
|
-
*/
|
75
|
-
function testTransactionExecuteAll_1() {
|
76
|
-
var stat1 = new google.wspl.Statement('stat1');
|
77
|
-
|
78
|
-
var trans = new google.wspl.html5.Transaction(html5Tx);
|
79
|
-
|
80
|
-
var successCallback = null;
|
81
|
-
var failureCallback = null;
|
82
|
-
html5Tx.expects().executeSql('stat1', TypeOf.isA(Array),
|
83
|
-
TypeOf.isA(Function), TypeOf.isA(Function)).andStub(function() {
|
84
|
-
successCallback = arguments[2];
|
85
|
-
});
|
86
|
-
|
87
|
-
callbackMock.expects().onSuccess(trans,
|
88
|
-
TypeOf.isA(google.wspl.html5.ResultSet)).andStub(function() {
|
89
|
-
assertEquals('result not returned', 'resultset', arguments[1].result_)});
|
90
|
-
|
91
|
-
trans.executeAll([stat1], callbackMock);
|
92
|
-
successCallback(html5Tx, 'resultset');
|
93
|
-
mockControl.verify();
|
94
|
-
}
|
95
|
-
|
96
|
-
function testTransactionExecuteAll_11() {
|
97
|
-
var stat1 = new google.wspl.Statement('stat1');
|
98
|
-
var stat2 = new google.wspl.Statement('stat2', [1]);
|
99
|
-
|
100
|
-
var trans = new google.wspl.html5.Transaction(html5Tx);
|
101
|
-
|
102
|
-
var successCallback1 = null;
|
103
|
-
var successCallback2 = null;
|
104
|
-
var failureCallback = null;
|
105
|
-
|
106
|
-
html5Tx.expects().executeSql('stat1', TypeOf.isA(Array),
|
107
|
-
TypeOf.isA(Function), TypeOf.isA(Function)).andStub(function() {
|
108
|
-
successCallback1 = arguments[2];
|
109
|
-
});
|
110
|
-
|
111
|
-
html5Tx.expects().executeSql('stat2', TypeOf.isA(Array),
|
112
|
-
TypeOf.isA(Function), TypeOf.isA(Function)).andStub(function() {
|
113
|
-
successCallback2 = arguments[2];
|
114
|
-
var params = arguments[1];
|
115
|
-
assertEquals('incorrect params to sql', 1, params[0]);
|
116
|
-
});
|
117
|
-
|
118
|
-
callbackMock.expects().onSuccess(trans,
|
119
|
-
TypeOf.isA(google.wspl.html5.ResultSet)).andStub(function() {
|
120
|
-
assertEquals('result not returned', 'resultset1', arguments[1].result_)});
|
121
|
-
|
122
|
-
callbackMock.expects().onSuccess(trans,
|
123
|
-
TypeOf.isA(google.wspl.html5.ResultSet)).andStub(function() {
|
124
|
-
assertEquals('result not returned', 'resultset2', arguments[1].result_)});
|
125
|
-
|
126
|
-
trans.executeAll([stat1, stat2], callbackMock);
|
127
|
-
successCallback1(html5Tx, 'resultset1');
|
128
|
-
successCallback2(html5Tx, 'resultset2');
|
129
|
-
mockControl.verify();
|
130
|
-
}
|
131
|
-
|
132
|
-
function testTransactionExecuteAll_111() {
|
133
|
-
var stat1 = new google.wspl.Statement('stat1');
|
134
|
-
var stat2 = new google.wspl.Statement('stat2', [1]);
|
135
|
-
var stat3 = new google.wspl.Statement('stat3', [2, 3]);
|
136
|
-
|
137
|
-
var trans = new google.wspl.html5.Transaction(html5Tx);
|
138
|
-
|
139
|
-
var successCallback1 = null;
|
140
|
-
var successCallback2 = null;
|
141
|
-
var successCallback3 = null;
|
142
|
-
var failureCallback = null;
|
143
|
-
|
144
|
-
html5Tx.expects().executeSql('stat1', TypeOf.isA(Array),
|
145
|
-
TypeOf.isA(Function), TypeOf.isA(Function)).andStub(function() {
|
146
|
-
successCallback1 = arguments[2];
|
147
|
-
});
|
148
|
-
|
149
|
-
html5Tx.expects().executeSql('stat2', TypeOf.isA(Array),
|
150
|
-
TypeOf.isA(Function), TypeOf.isA(Function)).andStub(function() {
|
151
|
-
successCallback2 = arguments[2];
|
152
|
-
var params = arguments[1];
|
153
|
-
assertEquals('incorrect params to sql', 1, params[0]);
|
154
|
-
});
|
155
|
-
|
156
|
-
html5Tx.expects().executeSql('stat3', TypeOf.isA(Array),
|
157
|
-
TypeOf.isA(Function), TypeOf.isA(Function)).andStub(function() {
|
158
|
-
successCallback3 = arguments[2];
|
159
|
-
var params = arguments[1];
|
160
|
-
assertEquals('incorrect params to sql', 2, params[0]);
|
161
|
-
assertEquals('incorrect params to sql', 3, params[1]);
|
162
|
-
});
|
163
|
-
|
164
|
-
callbackMock.expects().onSuccess(trans,
|
165
|
-
TypeOf.isA(google.wspl.html5.ResultSet)).andStub(function() {
|
166
|
-
assertEquals('result not returned', 'resultset1', arguments[1].result_)});
|
167
|
-
|
168
|
-
callbackMock.expects().onSuccess(trans,
|
169
|
-
TypeOf.isA(google.wspl.html5.ResultSet)).andStub(function() {
|
170
|
-
assertEquals('result not returned', 'resultset2', arguments[1].result_)});
|
171
|
-
|
172
|
-
callbackMock.expects().onSuccess(trans,
|
173
|
-
TypeOf.isA(google.wspl.html5.ResultSet)).andStub(function() {
|
174
|
-
assertEquals('result not returned', 'resultset3', arguments[1].result_)});
|
175
|
-
|
176
|
-
trans.executeAll([stat1, stat2, stat3], callbackMock);
|
177
|
-
successCallback1(html5Tx, 'resultset1');
|
178
|
-
successCallback2(html5Tx, 'resultset2');
|
179
|
-
successCallback3(html5Tx, 'resultset3');
|
180
|
-
mockControl.verify();
|
181
|
-
}
|
182
|
-
|
183
|
-
function testTransactionExecuteAll_noCallback_111() {
|
184
|
-
var stat1 = new google.wspl.Statement('stat1');
|
185
|
-
var stat2 = new google.wspl.Statement('stat2', [1]);
|
186
|
-
var stat3 = new google.wspl.Statement('stat3', [2, 3]);
|
187
|
-
|
188
|
-
var trans = new google.wspl.html5.Transaction(html5Tx);
|
189
|
-
|
190
|
-
var successCallback1 = null;
|
191
|
-
var successCallback2 = null;
|
192
|
-
var successCallback3 = null;
|
193
|
-
var failureCallback = null;
|
194
|
-
|
195
|
-
html5Tx.expects().executeSql('stat1', TypeOf.isA(Array),
|
196
|
-
TypeOf.isA(Function), TypeOf.isA(Function)).andStub(function() {
|
197
|
-
successCallback1 = arguments[2];
|
198
|
-
});
|
199
|
-
|
200
|
-
html5Tx.expects().executeSql('stat2', TypeOf.isA(Array),
|
201
|
-
TypeOf.isA(Function), TypeOf.isA(Function)).andStub(
|
202
|
-
function() { successCallback2 = arguments[2];
|
203
|
-
var params = arguments[1];
|
204
|
-
assertEquals('incorrect params to sql', 1, params[0]);
|
205
|
-
});
|
206
|
-
|
207
|
-
html5Tx.expects().executeSql('stat3', TypeOf.isA(Array),
|
208
|
-
TypeOf.isA(Function), TypeOf.isA(Function)).andStub(
|
209
|
-
function() { successCallback3 = arguments[2];
|
210
|
-
var params = arguments[1];
|
211
|
-
assertEquals('incorrect params to sql', 2, params[0]);
|
212
|
-
assertEquals('incorrect params to sql', 3, params[1]);
|
213
|
-
});
|
214
|
-
|
215
|
-
trans.executeAll([stat1, stat2, stat3]);
|
216
|
-
successCallback1(html5Tx, 'resultset1');
|
217
|
-
successCallback2(html5Tx, 'resultset2');
|
218
|
-
successCallback3(html5Tx, 'resultset3');
|
219
|
-
mockControl.verify();
|
220
|
-
}
|
221
|
-
|
222
|
-
function testTransactionExecuteAll_110() {
|
223
|
-
var stat1 = new google.wspl.Statement('stat1');
|
224
|
-
var stat2 = new google.wspl.Statement('stat2', [1]);
|
225
|
-
var stat3 = new google.wspl.Statement('stat3', [2, 3]);
|
226
|
-
|
227
|
-
var trans = new google.wspl.html5.Transaction(html5Tx);
|
228
|
-
|
229
|
-
var successCallback1 = null;
|
230
|
-
var successCallback2 = null;
|
231
|
-
var successCallback3 = null;
|
232
|
-
var failureCallback3 = null;
|
233
|
-
|
234
|
-
html5Tx.expects().executeSql('stat1', TypeOf.isA(Array),
|
235
|
-
TypeOf.isA(Function), TypeOf.isA(Function)).andStub(function() {
|
236
|
-
successCallback1 = arguments[2];
|
237
|
-
});
|
238
|
-
|
239
|
-
html5Tx.expects().executeSql('stat2', TypeOf.isA(Array),
|
240
|
-
TypeOf.isA(Function), TypeOf.isA(Function)).andStub(function() {
|
241
|
-
successCallback2 = arguments[2];
|
242
|
-
var params = arguments[1];
|
243
|
-
assertEquals('incorrect params to sql', 1, params[0]);
|
244
|
-
});
|
245
|
-
|
246
|
-
html5Tx.expects().executeSql('stat3', TypeOf.isA(Array),
|
247
|
-
TypeOf.isA(Function), TypeOf.isA(Function)).andStub(function() {
|
248
|
-
successCallback3 = arguments[2];
|
249
|
-
failureCallback3 = arguments[3];
|
250
|
-
var params = arguments[1];
|
251
|
-
assertEquals('incorrect params to sql', 2, params[0]);
|
252
|
-
assertEquals('incorrect params to sql', 3, params[1]);
|
253
|
-
});
|
254
|
-
|
255
|
-
callbackMock.expects().onSuccess(trans,
|
256
|
-
TypeOf.isA(google.wspl.html5.ResultSet)).andStub(function() {
|
257
|
-
assertEquals('result not returned', 'resultset1', arguments[1].result_)});
|
258
|
-
|
259
|
-
callbackMock.expects().onSuccess(trans,
|
260
|
-
TypeOf.isA(google.wspl.html5.ResultSet)).andStub(function() {
|
261
|
-
assertEquals('result not returned', 'resultset2', arguments[1].result_)});
|
262
|
-
|
263
|
-
callbackMock.expects().onFailure('error3');
|
264
|
-
|
265
|
-
trans.executeAll([stat1, stat2, stat3], callbackMock);
|
266
|
-
successCallback1(html5Tx, 'resultset1');
|
267
|
-
successCallback2(html5Tx, 'resultset2');
|
268
|
-
assertTrue('failure case callback not terminating transaction',
|
269
|
-
failureCallback3(html5Tx, 'error3'));
|
270
|
-
mockControl.verify();
|
271
|
-
}
|
272
|
-
|
273
|
-
function testTransactionExecute_nocallback() {
|
274
|
-
var stat1 = new google.wspl.Statement('stat1');
|
275
|
-
|
276
|
-
var trans = new google.wspl.html5.Transaction(html5Tx);
|
277
|
-
|
278
|
-
var successCallback = null;
|
279
|
-
var failureCallback = null;
|
280
|
-
html5Tx.expects().executeSql('stat1', TypeOf.isA(Array),
|
281
|
-
TypeOf.isA(Function), TypeOf.isA(Function)).andStub(function() {
|
282
|
-
successCallback = arguments[2];
|
283
|
-
});
|
284
|
-
|
285
|
-
trans.execute(stat1);
|
286
|
-
successCallback(html5Tx, 'resultset');
|
287
|
-
mockControl.verify();
|
288
|
-
}
|
289
|
-
|
290
|
-
function buildDatabase() {
|
291
|
-
html5Window.expects().openDatabase('name', '', 'name',
|
292
|
-
google.wspl.LARGEST_SUPPORTED_DATABASE).
|
293
|
-
andReturn(html5Db);
|
294
|
-
return new google.wspl.html5.Database('name', html5Window);
|
295
|
-
}
|
296
|
-
|
297
|
-
function testConstructDatabase() {
|
298
|
-
var db = buildDatabase();
|
299
|
-
mockControl.verify();
|
300
|
-
assertEquals('did not set db_ correctly', db.db_, html5Db);
|
301
|
-
}
|
302
|
-
|
303
|
-
function testConstructDatabase_null() {
|
304
|
-
html5Window.expects().openDatabase('name', '', 'name',
|
305
|
-
google.wspl.LARGEST_SUPPORTED_DATABASE).
|
306
|
-
andReturn(null);
|
307
|
-
try {
|
308
|
-
var db = google.wspl.html5.Database('name', html5Window);
|
309
|
-
fail('Should never get here');
|
310
|
-
} catch (e) {
|
311
|
-
if (e.isJsUnitException) {
|
312
|
-
throw e;
|
313
|
-
}
|
314
|
-
}
|
315
|
-
mockControl.verify();
|
316
|
-
}
|
317
|
-
|
318
|
-
function testConstructDatabase_undefined() {
|
319
|
-
html5Window.expects().openDatabase('name', '', 'name',
|
320
|
-
google.wspl.LARGEST_SUPPORTED_DATABASE).
|
321
|
-
andReturn(undefined);
|
322
|
-
try {
|
323
|
-
var db = google.wspl.html5.Database('name', html5Window);
|
324
|
-
fail('Should never get here');
|
325
|
-
} catch (e) {
|
326
|
-
if (e.isJsUnitException) {
|
327
|
-
throw e;
|
328
|
-
}
|
329
|
-
}
|
330
|
-
mockControl.verify();
|
331
|
-
}
|
332
|
-
|
333
|
-
function createTransactionCore() {
|
334
|
-
var db = buildDatabase();
|
335
|
-
var fun1 = null;
|
336
|
-
var failure = null;
|
337
|
-
var success = null;
|
338
|
-
html5Db.expects().transaction(TypeOf.isA(Function), TypeOf.isA(Function),
|
339
|
-
TypeOf.isA(Function)).andStub(function() {
|
340
|
-
fun1 = arguments[0];
|
341
|
-
failure = arguments[1];
|
342
|
-
success = arguments[2];
|
343
|
-
});
|
344
|
-
|
345
|
-
var tx = null;
|
346
|
-
var populateMock = function(txa) {
|
347
|
-
tx = txa;
|
348
|
-
};
|
349
|
-
|
350
|
-
db.createTransaction(populateMock, callbackMock);
|
351
|
-
fun1('transactionTest');
|
352
|
-
|
353
|
-
assertEquals('transaction not saved', 'transactionTest', tx.tx_);
|
354
|
-
assertEquals('did not set db_ correctly', db.db_, html5Db);
|
355
|
-
|
356
|
-
return {failure: failure, success: success};
|
357
|
-
}
|
358
|
-
|
359
|
-
function testCreateTransaction_success() {
|
360
|
-
cbs = createTransactionCore();
|
361
|
-
callbackMock.expects().onSuccess();
|
362
|
-
cbs.success('success');
|
363
|
-
mockControl.verify();
|
364
|
-
}
|
365
|
-
|
366
|
-
function testCreateTransaction_failure() {
|
367
|
-
cbs = createTransactionCore();
|
368
|
-
callbackMock.expects().onFailure('error');
|
369
|
-
cbs.failure('error');
|
370
|
-
mockControl.verify();
|
371
|
-
}
|
372
|
-
|
373
|
-
function testCreateTransaction_onlyPopulate() {
|
374
|
-
cbs = createTransactionCore();
|
375
|
-
mockControl.verify();
|
376
|
-
}
|
377
|
-
|
378
|
-
function testDatabaseExecute_nocallback() {
|
379
|
-
var db = buildDatabase();
|
380
|
-
|
381
|
-
dbTx.expects().execute('statementText', null);
|
382
|
-
db.execute('statementText');
|
383
|
-
}
|
384
|
-
|
385
|
-
function testDatabaseExecute_nocallback() {
|
386
|
-
var db = buildDatabase();
|
387
|
-
|
388
|
-
dbTx.expects().execute('statementText', null);
|
389
|
-
db.execute('statementText');
|
390
|
-
}
|
391
|
-
|
392
|
-
function testDatabaseExecuteAll() {
|
393
|
-
var db = buildDatabase();
|
394
|
-
dbTx.expects().executeAll(TypeOf.isA(Array));
|
395
|
-
}
|
396
|
-
|
397
|
-
function testResultSetNext() {
|
398
|
-
var res = {rows: {length: 4}};
|
399
|
-
var result = new google.wspl.html5.ResultSet(res);
|
400
|
-
|
401
|
-
for (var i = 0; i < 4; i++) {
|
402
|
-
assertTrue('expected valid row', result.isValidRow());
|
403
|
-
result.next();
|
404
|
-
}
|
405
|
-
assertFalse('expected invalid row', result.isValidRow());
|
406
|
-
}
|
407
|
-
|
408
|
-
function testResultSetIsValidRow() {
|
409
|
-
var res = {rows: {length: 0}};
|
410
|
-
var result = new google.wspl.html5.ResultSet(res);
|
411
|
-
|
412
|
-
assertFalse('expected invalid row', result.isValidRow());
|
413
|
-
res.rows.length = 1;
|
414
|
-
assertTrue('expected valid row', result.isValidRow());
|
415
|
-
result.next();
|
416
|
-
assertFalse('expected invalid row', result.isValidRow());
|
417
|
-
}
|
418
|
-
|
419
|
-
function testResultSetGetRow() {
|
420
|
-
var res = {rows: {
|
421
|
-
length: 3,
|
422
|
-
item: function(index) {
|
423
|
-
assertEquals('expected index of 1', 1, index);
|
424
|
-
return {h0: 'value0', h1: 'value1', h2: 'value2'};
|
425
|
-
}
|
426
|
-
}};
|
427
|
-
|
428
|
-
var result = new google.wspl.html5.ResultSet(res);
|
429
|
-
result.next();
|
430
|
-
var row = result.getRow();
|
431
|
-
assertEquals('first field is not valid', 'value0', row.h0);
|
432
|
-
assertEquals('first field is not valid', 'value1', row.h1);
|
433
|
-
assertEquals('first field is not valid', 'value2', row.h2);
|
434
|
-
}
|
435
|
-
|
436
|
-
function testHasInflightTransactions() {
|
437
|
-
var fakeTime = 1000;
|
438
|
-
var db = buildDatabase();
|
439
|
-
var dummyPopulate = function() {};
|
440
|
-
db.getCurrentTime = function() {return fakeTime;};
|
441
|
-
|
442
|
-
// Create a transaction, make sure it's kept track of.
|
443
|
-
var transId = db.sequenceNum_;
|
444
|
-
db.createTransaction(dummyPopulate);
|
445
|
-
assertEquals('There should be an inflight request.',
|
446
|
-
fakeTime, db.inflightTransactions_[transId]);
|
447
|
-
|
448
|
-
// Haven't advanced time, so hasInflightTransactions should return false.
|
449
|
-
assertFalse('Expected hasInflightTransactions=false.',
|
450
|
-
db.hasInflightTransactions(100));
|
451
|
-
|
452
|
-
// Advance time, now hasInflightTransactions should return true.
|
453
|
-
fakeTime += 10000;
|
454
|
-
var faqs = db.hasInflightTransactions(100);
|
455
|
-
assertTrue('Expected hasInflightTransactions=true.',
|
456
|
-
db.hasInflightTransactions(100));
|
457
|
-
|
458
|
-
// Now now have the transaction completed, hasInflightTransactions
|
459
|
-
// should return false.
|
460
|
-
delete db.inflightTransactions_[transId];
|
461
|
-
assertFalse('Expected hasInflightTransactions=false.',
|
462
|
-
db.hasInflightTransactions(100));
|
463
|
-
|
464
|
-
};
|
465
|
-
|
466
|
-
</script>
|
467
|
-
</body>
|
468
|
-
</html>
|