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.
Files changed (507) hide show
  1. checksums.yaml +4 -4
  2. data/{fixtures/asciidoc-app/config.rb → .gemtest} +0 -0
  3. data/.yardopts +2 -6
  4. data/Rakefile +5 -1
  5. data/features/asset_hash.feature +32 -61
  6. data/features/asset_host.feature +11 -23
  7. data/features/builder.feature +2 -0
  8. data/features/cache_buster.feature +1 -1
  9. data/features/chained_templates.feature +2 -92
  10. data/features/clean_build.feature +0 -18
  11. data/features/cli_init.feature +17 -111
  12. data/features/content_type.feature +2 -5
  13. data/features/custom_layouts.feature +24 -20
  14. data/features/data.feature +0 -28
  15. data/features/directory_index.feature +9 -9
  16. data/features/front-matter-neighbor.feature +0 -32
  17. data/features/front-matter.feature +0 -17
  18. data/features/helpers_content_tag.feature +2 -2
  19. data/features/helpers_form_tag.feature +4 -4
  20. data/features/helpers_link_to.feature +11 -29
  21. data/features/helpers_url_for.feature +11 -11
  22. data/features/i18n_builder.feature +5 -5
  23. data/features/i18n_preview.feature +8 -8
  24. data/features/markdown_kramdown.feature +1 -1
  25. data/features/markdown_kramdown_in_haml.feature +1 -2
  26. data/features/markdown_redcarpet.feature +23 -23
  27. data/features/minify_css.feature +9 -75
  28. data/features/minify_javascript.feature +12 -65
  29. data/features/mount_rack.feature +2 -4
  30. data/features/multiple-sources.feature +27 -0
  31. data/features/proxy_pages.feature +0 -10
  32. data/features/redirects.feature +6 -7
  33. data/features/relative_assets.feature +21 -66
  34. data/features/slim.feature +11 -7
  35. data/features/stylus.feature +1 -1
  36. data/features/support/env.rb +4 -4
  37. data/fixtures/asset-hash-app/config.rb +0 -2
  38. data/fixtures/asset-hash-app/source/index.html.erb +1 -1
  39. data/fixtures/asset-hash-host-app/config.rb +1 -3
  40. data/fixtures/asset-host-app/source/asset_host.html.erb +20 -1
  41. data/fixtures/asset-host-app/source/stylesheets/asset_host.css.sass +47 -2
  42. data/fixtures/auto-css-app/config.rb +8 -10
  43. data/fixtures/auto-js-app/config.rb +8 -10
  44. data/fixtures/basic-data-app/config.rb +2 -4
  45. data/fixtures/cache-buster-app/source/stylesheets/relative_assets.css.sass +0 -1
  46. data/fixtures/cache-buster-app/source/stylesheets/site.css.sass +3 -1
  47. data/fixtures/capture-html-app/config.rb +3 -5
  48. data/fixtures/clean-app/config-complications.rb +4 -6
  49. data/fixtures/clean-app/config.rb +4 -6
  50. data/fixtures/content-for-app/config.rb +3 -5
  51. data/fixtures/custom-layout-app/config.rb +1 -1
  52. data/fixtures/data-app/config.rb +1 -1
  53. data/fixtures/dynamic-pages-app/config.rb +20 -42
  54. data/fixtures/dynamic-pages-app/source/real/index.html.erb +3 -3
  55. data/fixtures/ember-cli-app/config.rb +5 -0
  56. data/fixtures/{compass-sprites-app/config.rb → ember-cli-app/source/javascripts/file.js} +0 -0
  57. data/fixtures/ember-cli-app/test-app/.bowerrc +3 -0
  58. data/fixtures/ember-cli-app/test-app/.gitignore +17 -0
  59. data/fixtures/ember-cli-app/test-app/.jshintrc +32 -0
  60. data/fixtures/ember-cli-app/test-app/Brocfile.js +20 -0
  61. data/fixtures/ember-cli-app/test-app/README.md +25 -0
  62. data/fixtures/ember-cli-app/test-app/app/app.js +14 -0
  63. data/fixtures/{implied-extensions-app/config.rb → ember-cli-app/test-app/app/components/.gitkeep} +0 -0
  64. data/fixtures/{javascript-app/config.rb → ember-cli-app/test-app/app/controllers/.gitkeep} +0 -0
  65. data/fixtures/{more-implied-extensions-app/config.rb → ember-cli-app/test-app/app/helpers/.gitkeep} +0 -0
  66. data/fixtures/ember-cli-app/test-app/app/index.html +26 -0
  67. data/fixtures/{partial-chained_templates-app/config.rb → ember-cli-app/test-app/app/models/.gitkeep} +0 -0
  68. data/fixtures/ember-cli-app/test-app/app/router.js +10 -0
  69. data/fixtures/{preview-server-app/config-empty.rb → ember-cli-app/test-app/app/routes/.gitkeep} +0 -0
  70. data/fixtures/{request-app/config.rb → ember-cli-app/test-app/app/styles/.gitkeep} +0 -0
  71. data/fixtures/ember-cli-app/test-app/app/styles/app.css +3 -0
  72. data/fixtures/{traversal-app/source/.htaccess → ember-cli-app/test-app/app/templates/.gitkeep} +0 -0
  73. data/fixtures/ember-cli-app/test-app/app/templates/application.hbs +3 -0
  74. data/{lib/middleman-core/templates/html5/source/img/.gitignore → fixtures/ember-cli-app/test-app/app/templates/components/.gitkeep} +0 -0
  75. data/{lib/middleman-core/templates/mobile/source/js/script.js → fixtures/ember-cli-app/test-app/app/views/.gitkeep} +0 -0
  76. data/fixtures/ember-cli-app/test-app/bower.json +16 -0
  77. data/fixtures/ember-cli-app/test-app/config/environment.js +38 -0
  78. data/fixtures/ember-cli-app/test-app/package.json +31 -0
  79. data/fixtures/ember-cli-app/test-app/public/.gitkeep +0 -0
  80. data/fixtures/ember-cli-app/test-app/testem.json +6 -0
  81. data/fixtures/ember-cli-app/test-app/tests/.jshintrc +73 -0
  82. data/fixtures/ember-cli-app/test-app/tests/helpers/resolver.js +9 -0
  83. data/fixtures/ember-cli-app/test-app/tests/helpers/start-app.js +30 -0
  84. data/fixtures/ember-cli-app/test-app/tests/index.html +50 -0
  85. data/fixtures/ember-cli-app/test-app/tests/test-helper.js +6 -0
  86. data/fixtures/ember-cli-app/test-app/tests/unit/.gitkeep +0 -0
  87. data/fixtures/env-app/config.rb +0 -0
  88. data/fixtures/env-app/environments/development.rb +1 -0
  89. data/fixtures/env-app/environments/production.rb +2 -0
  90. data/fixtures/env-app/source/index.html.erb +3 -0
  91. data/fixtures/env-app/source/stylesheets/site.css.scss +3 -0
  92. data/fixtures/external-helpers/config.rb +1 -1
  93. data/fixtures/feature-params-app/config.rb +10 -6
  94. data/fixtures/feature-params-app/source/index.html.erb +2 -3
  95. data/fixtures/fonts-app/source/stylesheets/fonts.css.scss +6 -0
  96. data/fixtures/frontmatter-neighbor-app/config.rb +30 -0
  97. data/fixtures/frontmatter-settings-app/config.rb +2 -2
  98. data/fixtures/frontmatter-settings-neighbor-app/config.rb +33 -3
  99. data/fixtures/generator-test/config.rb +5 -10
  100. data/fixtures/glob-app/config.rb +1 -1
  101. data/fixtures/i18n-force-locale/config.rb +2 -4
  102. data/fixtures/i18n-force-locale/source/{index.haml → index.html.haml} +0 -0
  103. data/fixtures/i18n-test-app/source/localizable/{one.en.md → one.en.html.md} +0 -0
  104. data/fixtures/i18n-test-app/source/localizable/{one.es.md → one.es.html.md} +0 -0
  105. data/fixtures/indexable-app/config.rb +2 -2
  106. data/fixtures/indexable-app/source/evil spaces.html +1 -1
  107. data/fixtures/large-build-app/config.rb +1 -5
  108. data/fixtures/large-build-app/source/spaces in file.html.erb +1 -1
  109. data/fixtures/manual-layout-override/config.rb +1 -1
  110. data/fixtures/markdown-app/config.rb +1 -1
  111. data/fixtures/markdown-frontmatter-options-app/config.rb +1 -1
  112. data/fixtures/minify-css-app/source/stylesheets/site.css.sass +3 -1
  113. data/fixtures/more-frontmatter-settings-app/config.rb +1 -1
  114. data/fixtures/more-markdown-app/source/{with_layout.markdown → with_layout.html.markdown} +0 -0
  115. data/fixtures/more-markdown-app/source/{with_layout_erb.markdown.erb → with_layout_erb.html.markdown.erb} +0 -0
  116. data/fixtures/more-traversal-app/config.rb +4 -4
  117. data/fixtures/more-traversal-app/source/layout.erb +1 -1
  118. data/fixtures/multiple-data-sources-app/config.rb +3 -0
  119. data/fixtures/multiple-data-sources-app/data/data.yml +1 -0
  120. data/fixtures/multiple-data-sources-app/data/two.yml +1 -0
  121. data/fixtures/multiple-data-sources-app/data0/one.yml +1 -0
  122. data/fixtures/multiple-data-sources-app/data1/data1.yml +1 -0
  123. data/fixtures/multiple-data-sources-app/data1/one.yml +1 -0
  124. data/fixtures/multiple-data-sources-app/data2/data2.yml +1 -0
  125. data/fixtures/multiple-data-sources-app/data2/two.yml +1 -0
  126. data/fixtures/multiple-data-sources-app/source/index.html.erb +10 -0
  127. data/fixtures/multiple-sources-app/config.rb +3 -0
  128. data/fixtures/multiple-sources-app/source/index.html.erb +1 -0
  129. data/fixtures/multiple-sources-app/source/override-in-two.html.erb +1 -0
  130. data/fixtures/multiple-sources-app/source0/override-in-one.html.erb +1 -0
  131. data/fixtures/multiple-sources-app/source1/index1.html.erb +1 -0
  132. data/fixtures/multiple-sources-app/source1/override-in-one.html.erb +1 -0
  133. data/fixtures/multiple-sources-app/source2/index2.html.erb +1 -0
  134. data/fixtures/multiple-sources-app/source2/override-in-two.html.erb +1 -0
  135. data/fixtures/padrino-helpers-app/source/former_padrino_test.html.erb +3 -3
  136. data/fixtures/page-classes-app/config.rb +2 -4
  137. data/fixtures/page-classes-app/source/2-starts-with-numeric-custom.html.erb +1 -1
  138. data/fixtures/page-helper-layout-block-app/config.rb +1 -1
  139. data/fixtures/partials-app/source/locals.html.erb +1 -1
  140. data/fixtures/partials-app/source/shared/{snippet.erb → _snippet.html.erb} +0 -0
  141. data/fixtures/partials-app/source/sub/index.html.erb +1 -1
  142. data/fixtures/passthrough-app/source/stylesheets/site.css.sass +5 -1
  143. data/fixtures/proxy-pages-app/config.rb +12 -15
  144. data/fixtures/relative-app/source/stylesheets/relative_assets.css.sass +1 -2
  145. data/fixtures/relative-assets-app/source/javascripts/application.js +8 -0
  146. data/fixtures/relative-assets-app/source/relative_image.html.erb +0 -1
  147. data/fixtures/relative-assets-app/source/stylesheets/relative_assets.css.sass +1 -2
  148. data/fixtures/scss-app/source/stylesheets/site_scss.css.scss +3 -1
  149. data/fixtures/stylus-preview-app/source/content.html.erb +4 -0
  150. data/fixtures/traversal-app/config.rb +4 -4
  151. data/fixtures/traversal-app/source/layout.erb +1 -1
  152. data/fixtures/v4-extension-callbacks/config.rb +21 -5
  153. data/fixtures/wildcard-app/config.rb +1 -1
  154. data/fixtures/wildcard-directory-index-app/config.rb +1 -1
  155. data/lib/middleman-core.rb +5 -2
  156. data/lib/middleman-core/application.rb +212 -131
  157. data/lib/middleman-core/builder.rb +255 -0
  158. data/lib/middleman-core/config_context.rb +103 -0
  159. data/lib/middleman-core/configuration.rb +15 -92
  160. data/lib/middleman-core/contracts.rb +149 -0
  161. data/lib/middleman-core/core_extensions.rb +86 -45
  162. data/lib/middleman-core/core_extensions/data.rb +82 -72
  163. data/lib/{middleman-more → middleman-core}/core_extensions/default_helpers.rb +34 -140
  164. data/lib/middleman-core/core_extensions/external_helpers.rb +23 -27
  165. data/lib/middleman-core/core_extensions/file_watcher.rb +59 -169
  166. data/lib/middleman-core/core_extensions/front_matter.rb +72 -131
  167. data/lib/middleman-core/core_extensions/i18n.rb +186 -0
  168. data/lib/middleman-core/core_extensions/rendering.rb +45 -533
  169. data/lib/middleman-core/core_extensions/routing.rb +53 -51
  170. data/lib/middleman-core/core_extensions/show_exceptions.rb +11 -18
  171. data/lib/middleman-core/extension.rb +183 -56
  172. data/lib/middleman-core/extension_manager.rb +80 -0
  173. data/lib/middleman-core/extensions.rb +96 -67
  174. data/lib/middleman-core/extensions/asset_hash.rb +92 -0
  175. data/lib/middleman-core/extensions/asset_host.rb +37 -0
  176. data/lib/{middleman-more → middleman-core}/extensions/automatic_alt_tags.rb +6 -5
  177. data/lib/{middleman-more → middleman-core}/extensions/automatic_image_sizes.rb +9 -13
  178. data/lib/middleman-core/extensions/cache_buster.rb +27 -0
  179. data/lib/{middleman-more → middleman-core}/extensions/directory_indexes.rb +9 -7
  180. data/lib/middleman-core/extensions/external_pipeline.rb +37 -0
  181. data/lib/{middleman-more → middleman-core}/extensions/gzip.rb +10 -3
  182. data/lib/{middleman-more → middleman-core}/extensions/lorem.rb +2 -2
  183. data/lib/middleman-core/extensions/minify_css.rb +86 -0
  184. data/lib/middleman-core/extensions/minify_javascript.rb +93 -0
  185. data/lib/middleman-core/extensions/relative_assets.rb +38 -0
  186. data/lib/middleman-core/file_renderer.rb +139 -0
  187. data/lib/middleman-core/load_paths.rb +21 -28
  188. data/lib/middleman-core/meta_pages.rb +9 -9
  189. data/lib/middleman-core/meta_pages/sitemap_resource.rb +3 -6
  190. data/lib/middleman-core/meta_pages/sitemap_tree.rb +1 -1
  191. data/lib/middleman-core/middleware/inline_url_rewriter.rb +96 -0
  192. data/lib/middleman-core/preview_server.rb +65 -196
  193. data/lib/middleman-core/profiling.rb +14 -15
  194. data/lib/middleman-core/rack.rb +138 -0
  195. data/lib/middleman-core/renderers/coffee_script.rb +10 -13
  196. data/lib/middleman-core/renderers/erb.rb +3 -15
  197. data/lib/middleman-core/renderers/haml.rb +33 -18
  198. data/lib/middleman-core/renderers/kramdown.rb +6 -4
  199. data/lib/middleman-core/renderers/less.rb +12 -18
  200. data/lib/middleman-core/renderers/liquid.rb +22 -18
  201. data/lib/middleman-core/renderers/markdown.rb +36 -49
  202. data/lib/middleman-core/renderers/redcarpet.rb +11 -4
  203. data/lib/middleman-core/renderers/sass.rb +36 -27
  204. data/lib/middleman-core/renderers/sass_functions.rb +116 -0
  205. data/lib/middleman-core/renderers/slim.rb +19 -26
  206. data/lib/middleman-core/renderers/stylus.rb +4 -14
  207. data/lib/middleman-core/sitemap/extensions/ignores.rb +35 -73
  208. data/lib/middleman-core/sitemap/extensions/on_disk.rb +29 -48
  209. data/lib/middleman-core/sitemap/extensions/proxies.rb +111 -133
  210. data/lib/middleman-core/sitemap/extensions/redirects.rb +68 -102
  211. data/lib/middleman-core/sitemap/extensions/request_endpoints.rb +59 -83
  212. data/lib/middleman-core/sitemap/extensions/traversal.rb +14 -15
  213. data/lib/middleman-core/sitemap/resource.rb +99 -71
  214. data/lib/middleman-core/sitemap/store.rb +79 -132
  215. data/lib/middleman-core/sources.rb +310 -0
  216. data/lib/middleman-core/sources/source_watcher.rb +268 -0
  217. data/lib/middleman-core/step_definitions.rb +2 -3
  218. data/lib/middleman-core/step_definitions/builder_steps.rb +15 -13
  219. data/lib/middleman-core/step_definitions/middleman_steps.rb +2 -18
  220. data/lib/middleman-core/step_definitions/server_steps.rb +43 -77
  221. data/lib/middleman-core/template_context.rb +181 -0
  222. data/lib/middleman-core/template_renderer.rb +213 -0
  223. data/lib/middleman-core/util.rb +319 -241
  224. data/lib/middleman-core/util/hash_with_indifferent_access.rb +103 -0
  225. data/lib/middleman-core/version.rb +1 -1
  226. data/lib/middleman/rack.rb +0 -1
  227. data/middleman-core.gemspec +36 -28
  228. data/spec/middleman-core/path_match_spec.rb +37 -0
  229. data/spec/spec_helper.rb +2 -25
  230. metadata +237 -454
  231. data/bin/middleman +0 -18
  232. data/cucumber.yml +0 -2
  233. data/features/asciidoc.feature +0 -155
  234. data/features/cli/preview_server-hook.feature +0 -17
  235. data/features/cli/preview_server.feature +0 -532
  236. data/features/compass-sprites.feature +0 -6
  237. data/features/console.feature +0 -10
  238. data/features/current_page_request_path_backwards.feature +0 -6
  239. data/features/fonts.feature +0 -15
  240. data/features/i18n_link_to.feature +0 -209
  241. data/features/image_srcset_paths.feature +0 -7
  242. data/features/implied_extensions.feature +0 -69
  243. data/features/instance_vars.feature +0 -9
  244. data/features/javascript-testing.feature +0 -18
  245. data/features/more-implied_extensions.feature +0 -44
  246. data/features/partials_dir.feature +0 -30
  247. data/features/queryable.feature +0 -35
  248. data/features/request_params.feature +0 -6
  249. data/features/static_server.feature +0 -6
  250. data/features/step_definitions/page_layout_steps.rb +0 -15
  251. data/features/step_definitions/queryable_steps.rb +0 -212
  252. data/features/support/preserve_mime_types.rb +0 -7
  253. data/features/v3_extensions.feature +0 -20
  254. data/features/working_directory.feature +0 -33
  255. data/fixtures/asciidoc-app/source/_include.adoc +0 -1
  256. data/fixtures/asciidoc-app/source/code.adoc +0 -3
  257. data/fixtures/asciidoc-app/source/custom-attribute.adoc +0 -3
  258. data/fixtures/asciidoc-app/source/gallery.adoc +0 -1
  259. data/fixtures/asciidoc-app/source/hello-no-layout.adoc +0 -2
  260. data/fixtures/asciidoc-app/source/hello-with-front-matter.adoc +0 -5
  261. data/fixtures/asciidoc-app/source/hello-with-layout.adoc +0 -2
  262. data/fixtures/asciidoc-app/source/hello-with-title.adoc +0 -5
  263. data/fixtures/asciidoc-app/source/hello.adoc +0 -4
  264. data/fixtures/asciidoc-app/source/images/tiger.gif +0 -0
  265. data/fixtures/asciidoc-app/source/layouts/default.erb +0 -9
  266. data/fixtures/asciidoc-app/source/master.adoc +0 -3
  267. data/fixtures/asset-hash-app/source/api.json.erb +0 -1
  268. data/fixtures/asset-hash-app/source/fonts/fontawesome-webfont.woff +0 -0
  269. data/fixtures/asset-hash-app/source/fonts/fontawesome-webfont.woff2 +0 -0
  270. data/fixtures/asset-hash-app/source/images/200px.jpg +0 -0
  271. data/fixtures/asset-hash-app/source/images/300px.jpg +0 -0
  272. data/fixtures/asset-hash-app/source/slim.html.slim +0 -8
  273. data/fixtures/asset-hash-app/source/stylesheets/uses_fonts.css +0 -4
  274. data/fixtures/asset-hash-app/source/subdir/api.json.erb +0 -1
  275. data/fixtures/chained-app/source/test.erb.combobreaker.str.erb +0 -8
  276. data/fixtures/clean-app/config-hidden-dir-after.rb +0 -5
  277. data/fixtures/clean-app/config-hidden-dir-before.rb +0 -1
  278. data/fixtures/compass-sprites-app/source/images/icon/arrow_down.png +0 -0
  279. data/fixtures/compass-sprites-app/source/images/icon/arrow_left.png +0 -0
  280. data/fixtures/compass-sprites-app/source/images/icon/arrow_right.png +0 -0
  281. data/fixtures/compass-sprites-app/source/images/icon/arrow_up.png +0 -0
  282. data/fixtures/compass-sprites-app/source/stylesheets/site.css.scss +0 -3
  283. data/fixtures/content-type-app/source/index.php +0 -1
  284. data/fixtures/current-page-app/config.rb +0 -3
  285. data/fixtures/current-page-app/source/request-path.html.erb +0 -1
  286. data/fixtures/default-partials-dir-app/source/_partial.html.erb +0 -1
  287. data/fixtures/default-partials-dir-app/source/index.html.erb +0 -2
  288. data/fixtures/fonts-app/source/stylesheets/fonts.css.sass +0 -5
  289. data/fixtures/frontmatter-app/source/front-matter-auto.erb +0 -6
  290. data/fixtures/frontmatter-app/source/front-matter-pandoc.html.md.erb +0 -13
  291. data/fixtures/frontmatter-app/source/json-front-matter-auto.erb +0 -6
  292. data/fixtures/frontmatter-neighbor-app/source/front-matter-auto.erb +0 -1
  293. data/fixtures/frontmatter-neighbor-app/source/front-matter-auto.erb.frontmatter +0 -4
  294. data/fixtures/frontmatter-neighbor-app/source/json-front-matter-auto.erb +0 -1
  295. data/fixtures/frontmatter-neighbor-app/source/json-front-matter-auto.erb.frontmatter +0 -4
  296. data/fixtures/image-srcset-paths-app/image-srcset-paths.html.erb +0 -1
  297. data/fixtures/image-srcset-paths-app/images/blank.gif +0 -0
  298. data/fixtures/implied-extensions-app/source/index.erb +0 -1
  299. data/fixtures/instance-vars-app/config.rb +0 -7
  300. data/fixtures/instance-vars-app/source/content.html.erb +0 -2
  301. data/fixtures/instance-vars-app/source/layout.erb +0 -1
  302. data/fixtures/javascript-app/source/index.html +0 -17
  303. data/fixtures/minify-css-app/source/inline-css.php +0 -8
  304. data/fixtures/minify-css-app/source/stylesheets/site.xcss.sass +0 -5
  305. data/fixtures/minify-js-app/source/inline-js.php +0 -22
  306. data/fixtures/minify-js-app/source/javascripts/js_test.xjs +0 -8
  307. data/fixtures/more-implied-extensions-app/source/javascripts/app.coffee +0 -1
  308. data/fixtures/more-implied-extensions-app/source/layouts/layout.erb +0 -3
  309. data/fixtures/more-implied-extensions-app/source/stylesheets/style.scss +0 -3
  310. data/fixtures/more-implied-extensions-app/source/stylesheets/style2.sass +0 -3
  311. data/fixtures/more-implied-extensions-app/source/test.haml +0 -4
  312. data/fixtures/more-implied-extensions-app/source/test2.markdown +0 -3
  313. data/fixtures/more-implied-extensions-app/source/test3.slim +0 -3
  314. data/fixtures/more-implied-extensions-app/source/test4.liquid +0 -1
  315. data/fixtures/partials-dir-app/source/index.html.erb +0 -2
  316. data/fixtures/partials-dir-app/source/nested/partials/_partial.html.erb +0 -1
  317. data/fixtures/partials-dir-app/source/partials/_partial.html.erb +0 -1
  318. data/fixtures/plain-app/index.html +0 -1
  319. data/fixtures/preview-server-app/bin/dns_server.rb +0 -33
  320. data/fixtures/preview-server-app/config-complications.rb +0 -11
  321. data/fixtures/preview-server-app/config.rb +0 -11
  322. data/fixtures/preview-server-app/source/index.html.erb +0 -1
  323. data/fixtures/preview-server-app/source/layout.erb +0 -9
  324. data/fixtures/preview-server-app/source/layouts/custom.erb +0 -8
  325. data/fixtures/preview-server-app/source/real.html +0 -1
  326. data/fixtures/preview-server-app/source/real/index.html.erb +0 -5
  327. data/fixtures/preview-server-app/source/should_be_ignored.html +0 -1
  328. data/fixtures/preview-server-app/source/should_be_ignored2.html +0 -1
  329. data/fixtures/preview-server-app/source/should_be_ignored3.html +0 -1
  330. data/fixtures/preview-server-app/source/static.html +0 -1
  331. data/fixtures/preview-server-hook-app/config.rb +0 -19
  332. data/fixtures/preview-server-hook-app/source/index.html.erb +0 -9
  333. data/fixtures/proxy-pages-app/source/real/index-ivars.html.erb +0 -6
  334. data/fixtures/relative-assets-app/source/absolute_image_relative_css.html.erb +0 -9
  335. data/fixtures/relative-assets-app/source/javascripts/app.js +0 -3
  336. data/fixtures/relative-assets-app/source/relative_image_absolute_css.html.erb +0 -9
  337. data/fixtures/request-app/source/index.html.erb +0 -3
  338. data/fixtures/stylus-preview-app/source/layout.erb +0 -1
  339. data/lib/middleman-core/cli.rb +0 -88
  340. data/lib/middleman-core/cli/build.rb +0 -300
  341. data/lib/middleman-core/cli/bundler.rb +0 -39
  342. data/lib/middleman-core/cli/console.rb +0 -52
  343. data/lib/middleman-core/cli/extension.rb +0 -47
  344. data/lib/middleman-core/cli/init.rb +0 -71
  345. data/lib/middleman-core/cli/server.rb +0 -99
  346. data/lib/middleman-core/core_extensions/data/file_loader.rb +0 -71
  347. data/lib/middleman-core/core_extensions/extensions.rb +0 -197
  348. data/lib/middleman-core/core_extensions/request.rb +0 -312
  349. data/lib/middleman-core/dns_resolver.rb +0 -73
  350. data/lib/middleman-core/dns_resolver/basic_network_resolver.rb +0 -52
  351. data/lib/middleman-core/dns_resolver/hosts_resolver.rb +0 -63
  352. data/lib/middleman-core/dns_resolver/local_link_resolver.rb +0 -44
  353. data/lib/middleman-core/dns_resolver/network_resolver.rb +0 -42
  354. data/lib/middleman-core/preview_server/checks.rb +0 -81
  355. data/lib/middleman-core/preview_server/information.rb +0 -273
  356. data/lib/middleman-core/preview_server/network_interface_inventory.rb +0 -65
  357. data/lib/middleman-core/preview_server/server_hostname.rb +0 -39
  358. data/lib/middleman-core/preview_server/server_information.rb +0 -153
  359. data/lib/middleman-core/preview_server/server_information_callback_proxy.rb +0 -35
  360. data/lib/middleman-core/preview_server/server_information_validator.rb +0 -18
  361. data/lib/middleman-core/preview_server/server_ip_address.rb +0 -55
  362. data/lib/middleman-core/preview_server/server_url.rb +0 -63
  363. data/lib/middleman-core/preview_server/tcp_port_prober.rb +0 -29
  364. data/lib/middleman-core/renderers/asciidoc.rb +0 -58
  365. data/lib/middleman-core/sitemap.rb +0 -76
  366. data/lib/middleman-core/sitemap/extensions/content_type.rb +0 -16
  367. data/lib/middleman-core/sitemap/queryable.rb +0 -151
  368. data/lib/middleman-core/step_definitions/commandline_steps.rb +0 -88
  369. data/lib/middleman-core/templates.rb +0 -101
  370. data/lib/middleman-core/templates/default.rb +0 -37
  371. data/lib/middleman-core/templates/default/source/images/background.png +0 -0
  372. data/lib/middleman-core/templates/default/source/images/middleman.png +0 -0
  373. data/lib/middleman-core/templates/default/source/index.html.erb +0 -10
  374. data/lib/middleman-core/templates/default/source/javascripts/all.js +0 -1
  375. data/lib/middleman-core/templates/default/source/layouts/layout.erb +0 -19
  376. data/lib/middleman-core/templates/default/source/stylesheets/all.css +0 -55
  377. data/lib/middleman-core/templates/default/source/stylesheets/normalize.css +0 -375
  378. data/lib/middleman-core/templates/empty.rb +0 -22
  379. data/lib/middleman-core/templates/empty/Gemfile.tt +0 -6
  380. data/lib/middleman-core/templates/extension/Gemfile +0 -18
  381. data/lib/middleman-core/templates/extension/Rakefile +0 -14
  382. data/lib/middleman-core/templates/extension/features/support/env.rb +0 -4
  383. data/lib/middleman-core/templates/extension/gemspec +0 -24
  384. data/lib/middleman-core/templates/extension/gitignore +0 -5
  385. data/lib/middleman-core/templates/extension/lib/lib.rb +0 -38
  386. data/lib/middleman-core/templates/extension/lib/middleman_extension.rb +0 -1
  387. data/lib/middleman-core/templates/html5.rb +0 -29
  388. data/lib/middleman-core/templates/html5/source/.htaccess +0 -542
  389. data/lib/middleman-core/templates/html5/source/404.html +0 -157
  390. data/lib/middleman-core/templates/html5/source/LICENSE.md +0 -19
  391. data/lib/middleman-core/templates/html5/source/README.md +0 -63
  392. data/lib/middleman-core/templates/html5/source/apple-touch-icon-114x114-precomposed.png +0 -0
  393. data/lib/middleman-core/templates/html5/source/apple-touch-icon-144x144-precomposed.png +0 -0
  394. data/lib/middleman-core/templates/html5/source/apple-touch-icon-57x57-precomposed.png +0 -0
  395. data/lib/middleman-core/templates/html5/source/apple-touch-icon-72x72-precomposed.png +0 -0
  396. data/lib/middleman-core/templates/html5/source/apple-touch-icon-precomposed.png +0 -0
  397. data/lib/middleman-core/templates/html5/source/apple-touch-icon.png +0 -0
  398. data/lib/middleman-core/templates/html5/source/crossdomain.xml +0 -15
  399. data/lib/middleman-core/templates/html5/source/css/main.css +0 -298
  400. data/lib/middleman-core/templates/html5/source/css/normalize.css +0 -504
  401. data/lib/middleman-core/templates/html5/source/favicon.ico +0 -0
  402. data/lib/middleman-core/templates/html5/source/humans.txt +0 -15
  403. data/lib/middleman-core/templates/html5/source/index.html.erb +0 -6
  404. data/lib/middleman-core/templates/html5/source/js/main.js +0 -1
  405. data/lib/middleman-core/templates/html5/source/js/plugins.js +0 -14
  406. data/lib/middleman-core/templates/html5/source/js/vendor/jquery-1.8.0.min.js +0 -2
  407. data/lib/middleman-core/templates/html5/source/js/vendor/modernizr-2.6.1.min.js +0 -4
  408. data/lib/middleman-core/templates/html5/source/layouts/layout.erb +0 -40
  409. data/lib/middleman-core/templates/html5/source/robots.txt +0 -3
  410. data/lib/middleman-core/templates/local.rb +0 -27
  411. data/lib/middleman-core/templates/mobile.rb +0 -24
  412. data/lib/middleman-core/templates/mobile/source/404.html +0 -37
  413. data/lib/middleman-core/templates/mobile/source/README.markdown +0 -21
  414. data/lib/middleman-core/templates/mobile/source/crossdomain.xml +0 -25
  415. data/lib/middleman-core/templates/mobile/source/css/style.css +0 -315
  416. data/lib/middleman-core/templates/mobile/source/humans.txt +0 -43
  417. data/lib/middleman-core/templates/mobile/source/img/h/apple-touch-icon.png +0 -0
  418. data/lib/middleman-core/templates/mobile/source/img/h/splash.png +0 -0
  419. data/lib/middleman-core/templates/mobile/source/img/l/apple-touch-icon-precomposed.png +0 -0
  420. data/lib/middleman-core/templates/mobile/source/img/l/apple-touch-icon.png +0 -0
  421. data/lib/middleman-core/templates/mobile/source/img/l/splash.png +0 -0
  422. data/lib/middleman-core/templates/mobile/source/img/m/apple-touch-icon.png +0 -0
  423. data/lib/middleman-core/templates/mobile/source/index.html +0 -92
  424. data/lib/middleman-core/templates/mobile/source/js/libs/modernizr-custom.js +0 -14
  425. data/lib/middleman-core/templates/mobile/source/js/libs/respond.min.js +0 -7
  426. data/lib/middleman-core/templates/mobile/source/js/mylibs/helper.js +0 -171
  427. data/lib/middleman-core/templates/mobile/source/js/plugins.js +0 -20
  428. data/lib/middleman-core/templates/mobile/source/robots.txt +0 -4
  429. data/lib/middleman-core/templates/mobile/source/sitemap.xml +0 -9
  430. data/lib/middleman-core/templates/mobile/source/test/index.html +0 -31
  431. data/lib/middleman-core/templates/mobile/source/test/qunit/qunit.css +0 -148
  432. data/lib/middleman-core/templates/mobile/source/test/qunit/qunit.js +0 -1265
  433. data/lib/middleman-core/templates/mobile/source/test/tests.js +0 -21
  434. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/Readme.PDF +0 -0
  435. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/aspx/aspx1.snippet +0 -31
  436. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/aspx/aspx2.snippet +0 -2
  437. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/aspx/ga.aspx +0 -195
  438. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/aspx/sample.aspx +0 -44
  439. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/jsp/ga.jsp +0 -225
  440. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/jsp/jsp1.snippet +0 -35
  441. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/jsp/jsp2.snippet +0 -2
  442. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/jsp/sample.jsp +0 -51
  443. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/php/ga.php +0 -176
  444. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/php/php1.snippet +0 -30
  445. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/php/php2.snippet +0 -4
  446. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/php/sample.php +0 -44
  447. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/pl/ga.pl +0 -195
  448. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/pl/perl1.snippet +0 -27
  449. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/pl/perl2.snippet +0 -1
  450. data/lib/middleman-core/templates/mobile/source/tools/googleanalyticsformobile/pl/sample.pl +0 -38
  451. data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/COPYING +0 -202
  452. data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/bookmark_bubble.js +0 -559
  453. data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/example/example.html +0 -43
  454. data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/example/example.js +0 -57
  455. data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/images/arrow.png +0 -0
  456. data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/images/close.png +0 -0
  457. data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/images/generate_base64_images +0 -33
  458. data/lib/middleman-core/templates/mobile/source/tools/mobile-bookmark-bubble/images/icon_calendar.png +0 -0
  459. data/lib/middleman-core/templates/mobile/source/tools/wspl/README +0 -27
  460. data/lib/middleman-core/templates/mobile/source/tools/wspl/databasefactory.js +0 -45
  461. data/lib/middleman-core/templates/mobile/source/tools/wspl/dbworker.js +0 -324
  462. data/lib/middleman-core/templates/mobile/source/tools/wspl/dbworker_test.html +0 -393
  463. data/lib/middleman-core/templates/mobile/source/tools/wspl/dbworkerstarter.js +0 -32
  464. data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapper_gears.js +0 -595
  465. data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapper_gears_test.html +0 -404
  466. data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapper_html5.js +0 -203
  467. data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapper_html5_test.html +0 -468
  468. data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapperapi.js +0 -202
  469. data/lib/middleman-core/templates/mobile/source/tools/wspl/dbwrapperapi_test.html +0 -51
  470. data/lib/middleman-core/templates/mobile/source/tools/wspl/gears_resultset.js +0 -71
  471. data/lib/middleman-core/templates/mobile/source/tools/wspl/gears_resultset_test.html +0 -86
  472. data/lib/middleman-core/templates/mobile/source/tools/wspl/gears_transaction.js +0 -196
  473. data/lib/middleman-core/templates/mobile/source/tools/wspl/gears_transaction_test.html +0 -221
  474. data/lib/middleman-core/templates/mobile/source/tools/wspl/gearsutils.js +0 -94
  475. data/lib/middleman-core/templates/mobile/source/tools/wspl/gearsutils_test.html +0 -84
  476. data/lib/middleman-core/templates/mobile/source/tools/wspl/global_functions.js +0 -72
  477. data/lib/middleman-core/templates/mobile/source/tools/wspl/simplenotes/index.html +0 -347
  478. data/lib/middleman-core/templates/mobile/source/tools/wspl/simplenotes/simplenotes.js +0 -503
  479. data/lib/middleman-core/templates/mobile/source/tools/wspl/simplenotes/styles.css +0 -66
  480. data/lib/middleman-core/templates/mobile/source/tools/wspl/simplenotes/template.js +0 -75
  481. data/lib/middleman-core/templates/shared/Gemfile.tt +0 -14
  482. data/lib/middleman-core/templates/shared/config.ru +0 -3
  483. data/lib/middleman-core/templates/shared/config.tt +0 -87
  484. data/lib/middleman-core/templates/shared/gitignore +0 -21
  485. data/lib/middleman-more/core_extensions/compass.rb +0 -75
  486. data/lib/middleman-more/core_extensions/i18n.rb +0 -312
  487. data/lib/middleman-more/extensions/asset_hash.rb +0 -128
  488. data/lib/middleman-more/extensions/asset_host.rb +0 -50
  489. data/lib/middleman-more/extensions/cache_buster.rb +0 -55
  490. data/lib/middleman-more/extensions/minify_css.rb +0 -112
  491. data/lib/middleman-more/extensions/minify_javascript.rb +0 -120
  492. data/lib/middleman-more/extensions/relative_assets.rb +0 -24
  493. data/lib/middleman-more/templates/smacss.rb +0 -29
  494. data/lib/middleman-more/templates/smacss/source/_footer.haml +0 -1
  495. data/lib/middleman-more/templates/smacss/source/index.html.haml +0 -1
  496. data/lib/middleman-more/templates/smacss/source/layouts/layout.haml +0 -13
  497. data/lib/middleman-more/templates/smacss/source/stylesheets/base/README.markdown +0 -11
  498. data/lib/middleman-more/templates/smacss/source/stylesheets/base/base.scss +0 -1
  499. data/lib/middleman-more/templates/smacss/source/stylesheets/base/normalize.scss +0 -375
  500. data/lib/middleman-more/templates/smacss/source/stylesheets/layout/README.markdown +0 -9
  501. data/lib/middleman-more/templates/smacss/source/stylesheets/modules/README.markdown +0 -9
  502. data/lib/middleman-more/templates/smacss/source/stylesheets/states/README.markdown +0 -12
  503. data/lib/middleman-more/templates/smacss/source/stylesheets/style.css.scss +0 -12
  504. data/lib/vendored-middleman-deps/fastimage.rb +0 -287
  505. data/spec/middleman-core/dns_resolver_spec.rb +0 -118
  506. data/spec/middleman-core/preview_server/server_hostname_spec.rb +0 -39
  507. data/spec/middleman-core/preview_server/server_ip_address_spec.rb +0 -43
@@ -1,1265 +0,0 @@
1
- /*
2
- * QUnit - A JavaScript Unit Testing Framework
3
- *
4
- * http://docs.jquery.com/QUnit
5
- *
6
- * Copyright (c) 2009 John Resig, Jörn Zaefferer
7
- * Dual licensed under the MIT (MIT-LICENSE.txt)
8
- * and GPL (GPL-LICENSE.txt) licenses.
9
- */
10
-
11
- (function(window) {
12
-
13
- var QUnit = {
14
-
15
- // call on start of module test to prepend name to all tests
16
- module: function(name, testEnvironment) {
17
- config.currentModule = name;
18
-
19
- synchronize(function() {
20
- if ( config.currentModule ) {
21
- QUnit.moduleDone( config.currentModule, config.moduleStats.bad, config.moduleStats.all );
22
- }
23
-
24
- config.currentModule = name;
25
- config.moduleTestEnvironment = testEnvironment;
26
- config.moduleStats = { all: 0, bad: 0 };
27
-
28
- QUnit.moduleStart( name, testEnvironment );
29
- });
30
- },
31
-
32
- asyncTest: function(testName, expected, callback) {
33
- if ( arguments.length === 2 ) {
34
- callback = expected;
35
- expected = 0;
36
- }
37
-
38
- QUnit.test(testName, expected, callback, true);
39
- },
40
-
41
- test: function(testName, expected, callback, async) {
42
- var name = '<span class="test-name">' + testName + '</span>', testEnvironment, testEnvironmentArg;
43
-
44
- if ( arguments.length === 2 ) {
45
- callback = expected;
46
- expected = null;
47
- }
48
- // is 2nd argument a testEnvironment?
49
- if ( expected && typeof expected === 'object') {
50
- testEnvironmentArg = expected;
51
- expected = null;
52
- }
53
-
54
- if ( config.currentModule ) {
55
- name = '<span class="module-name">' + config.currentModule + "</span>: " + name;
56
- }
57
-
58
- if ( !validTest(config.currentModule + ": " + testName) ) {
59
- return;
60
- }
61
-
62
- synchronize(function() {
63
-
64
- testEnvironment = extend({
65
- setup: function() {},
66
- teardown: function() {}
67
- }, config.moduleTestEnvironment);
68
- if (testEnvironmentArg) {
69
- extend(testEnvironment,testEnvironmentArg);
70
- }
71
-
72
- QUnit.testStart( testName, testEnvironment );
73
-
74
- // allow utility functions to access the current test environment
75
- QUnit.current_testEnvironment = testEnvironment;
76
-
77
- config.assertions = [];
78
- config.expected = expected;
79
-
80
- var tests = id("qunit-tests");
81
- if (tests) {
82
- var b = document.createElement("strong");
83
- b.innerHTML = "Running " + name;
84
- var li = document.createElement("li");
85
- li.appendChild( b );
86
- li.id = "current-test-output";
87
- tests.appendChild( li )
88
- }
89
-
90
- try {
91
- if ( !config.pollution ) {
92
- saveGlobal();
93
- }
94
-
95
- testEnvironment.setup.call(testEnvironment);
96
- } catch(e) {
97
- QUnit.ok( false, "Setup failed on " + name + ": " + e.message );
98
- }
99
- });
100
-
101
- synchronize(function() {
102
- if ( async ) {
103
- QUnit.stop();
104
- }
105
-
106
- try {
107
- callback.call(testEnvironment);
108
- } catch(e) {
109
- fail("Test " + name + " died, exception and test follows", e, callback);
110
- QUnit.ok( false, "Died on test #" + (config.assertions.length + 1) + ": " + e.message );
111
- // else next test will carry the responsibility
112
- saveGlobal();
113
-
114
- // Restart the tests if they're blocking
115
- if ( config.blocking ) {
116
- start();
117
- }
118
- }
119
- });
120
-
121
- synchronize(function() {
122
- try {
123
- checkPollution();
124
- testEnvironment.teardown.call(testEnvironment);
125
- } catch(e) {
126
- QUnit.ok( false, "Teardown failed on " + name + ": " + e.message );
127
- }
128
- });
129
-
130
- synchronize(function() {
131
- try {
132
- QUnit.reset();
133
- } catch(e) {
134
- fail("reset() failed, following Test " + name + ", exception and reset fn follows", e, reset);
135
- }
136
-
137
- if ( config.expected && config.expected != config.assertions.length ) {
138
- QUnit.ok( false, "Expected " + config.expected + " assertions, but " + config.assertions.length + " were run" );
139
- }
140
-
141
- var good = 0, bad = 0,
142
- tests = id("qunit-tests");
143
-
144
- config.stats.all += config.assertions.length;
145
- config.moduleStats.all += config.assertions.length;
146
-
147
- if ( tests ) {
148
- var ol = document.createElement("ol");
149
-
150
- for ( var i = 0; i < config.assertions.length; i++ ) {
151
- var assertion = config.assertions[i];
152
-
153
- var li = document.createElement("li");
154
- li.className = assertion.result ? "pass" : "fail";
155
- li.innerHTML = assertion.message || "(no message)";
156
- ol.appendChild( li );
157
-
158
- if ( assertion.result ) {
159
- good++;
160
- } else {
161
- bad++;
162
- config.stats.bad++;
163
- config.moduleStats.bad++;
164
- }
165
- }
166
- if (bad == 0) {
167
- ol.style.display = "none";
168
- }
169
-
170
- var b = document.createElement("strong");
171
- b.innerHTML = name + " <b style='color:black;'>(<b class='fail'>" + bad + "</b>, <b class='pass'>" + good + "</b>, " + config.assertions.length + ")</b>";
172
-
173
- addEvent(b, "click", function() {
174
- var next = b.nextSibling, display = next.style.display;
175
- next.style.display = display === "none" ? "block" : "none";
176
- });
177
-
178
- addEvent(b, "dblclick", function(e) {
179
- var target = e && e.target ? e.target : window.event.srcElement;
180
- if ( target.nodeName.toLowerCase() == "span" || target.nodeName.toLowerCase() == "b" ) {
181
- target = target.parentNode;
182
- }
183
- if ( window.location && target.nodeName.toLowerCase() === "strong" ) {
184
- window.location.search = "?" + encodeURIComponent(getText([target]).replace(/\(.+\)$/, "").replace(/(^\s*|\s*$)/g, ""));
185
- }
186
- });
187
-
188
- var li = id("current-test-output");
189
- li.id = "";
190
- li.className = bad ? "fail" : "pass";
191
- li.removeChild( li.firstChild );
192
- li.appendChild( b );
193
- li.appendChild( ol );
194
-
195
- if ( bad ) {
196
- var toolbar = id("qunit-testrunner-toolbar");
197
- if ( toolbar ) {
198
- toolbar.style.display = "block";
199
- id("qunit-filter-pass").disabled = null;
200
- id("qunit-filter-missing").disabled = null;
201
- }
202
- }
203
-
204
- } else {
205
- for ( var i = 0; i < config.assertions.length; i++ ) {
206
- if ( !config.assertions[i].result ) {
207
- bad++;
208
- config.stats.bad++;
209
- config.moduleStats.bad++;
210
- }
211
- }
212
- }
213
-
214
- QUnit.testDone( testName, bad, config.assertions.length );
215
-
216
- if ( !window.setTimeout && !config.queue.length ) {
217
- done();
218
- }
219
- });
220
-
221
- if ( window.setTimeout && !config.doneTimer ) {
222
- config.doneTimer = window.setTimeout(function(){
223
- if ( !config.queue.length ) {
224
- done();
225
- } else {
226
- synchronize( done );
227
- }
228
- }, 13);
229
- }
230
- },
231
-
232
- /**
233
- * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
234
- */
235
- expect: function(asserts) {
236
- config.expected = asserts;
237
- },
238
-
239
- /**
240
- * Asserts true.
241
- * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
242
- */
243
- ok: function(a, msg) {
244
- msg = escapeHtml(msg);
245
- QUnit.log(a, msg);
246
-
247
- config.assertions.push({
248
- result: !!a,
249
- message: msg
250
- });
251
- },
252
-
253
- /**
254
- * Checks that the first two arguments are equal, with an optional message.
255
- * Prints out both actual and expected values.
256
- *
257
- * Prefered to ok( actual == expected, message )
258
- *
259
- * @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." );
260
- *
261
- * @param Object actual
262
- * @param Object expected
263
- * @param String message (optional)
264
- */
265
- equal: function(actual, expected, message) {
266
- push(expected == actual, actual, expected, message);
267
- },
268
-
269
- notEqual: function(actual, expected, message) {
270
- push(expected != actual, actual, expected, message);
271
- },
272
-
273
- deepEqual: function(actual, expected, message) {
274
- push(QUnit.equiv(actual, expected), actual, expected, message);
275
- },
276
-
277
- notDeepEqual: function(actual, expected, message) {
278
- push(!QUnit.equiv(actual, expected), actual, expected, message);
279
- },
280
-
281
- strictEqual: function(actual, expected, message) {
282
- push(expected === actual, actual, expected, message);
283
- },
284
-
285
- notStrictEqual: function(actual, expected, message) {
286
- push(expected !== actual, actual, expected, message);
287
- },
288
-
289
- raises: function(fn, message) {
290
- try {
291
- fn();
292
- ok( false, message );
293
- }
294
- catch (e) {
295
- ok( true, message );
296
- }
297
- },
298
-
299
- start: function() {
300
- // A slight delay, to avoid any current callbacks
301
- if ( window.setTimeout ) {
302
- window.setTimeout(function() {
303
- if ( config.timeout ) {
304
- clearTimeout(config.timeout);
305
- }
306
-
307
- config.blocking = false;
308
- process();
309
- }, 13);
310
- } else {
311
- config.blocking = false;
312
- process();
313
- }
314
- },
315
-
316
- stop: function(timeout) {
317
- config.blocking = true;
318
-
319
- if ( timeout && window.setTimeout ) {
320
- config.timeout = window.setTimeout(function() {
321
- QUnit.ok( false, "Test timed out" );
322
- QUnit.start();
323
- }, timeout);
324
- }
325
- }
326
-
327
- };
328
-
329
- // Backwards compatibility, deprecated
330
- QUnit.equals = QUnit.equal;
331
- QUnit.same = QUnit.deepEqual;
332
-
333
- // Maintain internal state
334
- var config = {
335
- // The queue of tests to run
336
- queue: [],
337
-
338
- // block until document ready
339
- blocking: true
340
- };
341
-
342
- // Load paramaters
343
- (function() {
344
- var location = window.location || { search: "", protocol: "file:" },
345
- GETParams = location.search.slice(1).split('&');
346
-
347
- for ( var i = 0; i < GETParams.length; i++ ) {
348
- GETParams[i] = decodeURIComponent( GETParams[i] );
349
- if ( GETParams[i] === "noglobals" ) {
350
- GETParams.splice( i, 1 );
351
- i--;
352
- config.noglobals = true;
353
- } else if ( GETParams[i].search('=') > -1 ) {
354
- GETParams.splice( i, 1 );
355
- i--;
356
- }
357
- }
358
-
359
- // restrict modules/tests by get parameters
360
- config.filters = GETParams;
361
-
362
- // Figure out if we're running the tests from a server or not
363
- QUnit.isLocal = !!(location.protocol === 'file:');
364
- })();
365
-
366
- // Expose the API as global variables, unless an 'exports'
367
- // object exists, in that case we assume we're in CommonJS
368
- if ( typeof exports === "undefined" || typeof require === "undefined" ) {
369
- extend(window, QUnit);
370
- window.QUnit = QUnit;
371
- } else {
372
- extend(exports, QUnit);
373
- exports.QUnit = QUnit;
374
- }
375
-
376
- // define these after exposing globals to keep them in these QUnit namespace only
377
- extend(QUnit, {
378
- config: config,
379
-
380
- // Initialize the configuration options
381
- init: function() {
382
- extend(config, {
383
- stats: { all: 0, bad: 0 },
384
- moduleStats: { all: 0, bad: 0 },
385
- started: +new Date,
386
- updateRate: 1000,
387
- blocking: false,
388
- autostart: true,
389
- autorun: false,
390
- assertions: [],
391
- filters: [],
392
- queue: []
393
- });
394
-
395
- var tests = id("qunit-tests"),
396
- banner = id("qunit-banner"),
397
- result = id("qunit-testresult");
398
-
399
- if ( tests ) {
400
- tests.innerHTML = "";
401
- }
402
-
403
- if ( banner ) {
404
- banner.className = "";
405
- }
406
-
407
- if ( result ) {
408
- result.parentNode.removeChild( result );
409
- }
410
- },
411
-
412
- /**
413
- * Resets the test setup. Useful for tests that modify the DOM.
414
- */
415
- reset: function() {
416
- if ( window.jQuery ) {
417
- jQuery("#main, #qunit-fixture").html( config.fixture );
418
- }
419
- },
420
-
421
- /**
422
- * Trigger an event on an element.
423
- *
424
- * @example triggerEvent( document.body, "click" );
425
- *
426
- * @param DOMElement elem
427
- * @param String type
428
- */
429
- triggerEvent: function( elem, type, event ) {
430
- if ( document.createEvent ) {
431
- event = document.createEvent("MouseEvents");
432
- event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,
433
- 0, 0, 0, 0, 0, false, false, false, false, 0, null);
434
- elem.dispatchEvent( event );
435
-
436
- } else if ( elem.fireEvent ) {
437
- elem.fireEvent("on"+type);
438
- }
439
- },
440
-
441
- // Safe object type checking
442
- is: function( type, obj ) {
443
- return QUnit.objectType( obj ) == type;
444
- },
445
-
446
- objectType: function( obj ) {
447
- if (typeof obj === "undefined") {
448
- return "undefined";
449
-
450
- // consider: typeof null === object
451
- }
452
- if (obj === null) {
453
- return "null";
454
- }
455
-
456
- var type = Object.prototype.toString.call( obj )
457
- .match(/^\[object\s(.*)\]$/)[1] || '';
458
-
459
- switch (type) {
460
- case 'Number':
461
- if (isNaN(obj)) {
462
- return "nan";
463
- } else {
464
- return "number";
465
- }
466
- case 'String':
467
- case 'Boolean':
468
- case 'Array':
469
- case 'Date':
470
- case 'RegExp':
471
- case 'Function':
472
- return type.toLowerCase();
473
- }
474
- if (typeof obj === "object") {
475
- return "object";
476
- }
477
- return undefined;
478
- },
479
-
480
- // Logging callbacks
481
- begin: function() {},
482
- done: function(failures, total) {},
483
- log: function(result, message) {},
484
- testStart: function(name, testEnvironment) {},
485
- testDone: function(name, failures, total) {},
486
- moduleStart: function(name, testEnvironment) {},
487
- moduleDone: function(name, failures, total) {}
488
- });
489
-
490
- if ( typeof document === "undefined" || document.readyState === "complete" ) {
491
- config.autorun = true;
492
- }
493
-
494
- addEvent(window, "load", function() {
495
- QUnit.begin();
496
-
497
- // Initialize the config, saving the execution queue
498
- var oldconfig = extend({}, config);
499
- QUnit.init();
500
- extend(config, oldconfig);
501
-
502
- config.blocking = false;
503
-
504
- var userAgent = id("qunit-userAgent");
505
- if ( userAgent ) {
506
- userAgent.innerHTML = navigator.userAgent;
507
- }
508
-
509
- var toolbar = id("qunit-testrunner-toolbar");
510
- if ( toolbar ) {
511
- toolbar.style.display = "none";
512
-
513
- var filter = document.createElement("input");
514
- filter.type = "checkbox";
515
- filter.id = "qunit-filter-pass";
516
- filter.disabled = true;
517
- addEvent( filter, "click", function() {
518
- var li = document.getElementsByTagName("li");
519
- for ( var i = 0; i < li.length; i++ ) {
520
- if ( li[i].className.indexOf("pass") > -1 ) {
521
- li[i].style.display = filter.checked ? "none" : "";
522
- }
523
- }
524
- });
525
- toolbar.appendChild( filter );
526
-
527
- var label = document.createElement("label");
528
- label.setAttribute("for", "qunit-filter-pass");
529
- label.innerHTML = "Hide passed tests";
530
- toolbar.appendChild( label );
531
-
532
- var missing = document.createElement("input");
533
- missing.type = "checkbox";
534
- missing.id = "qunit-filter-missing";
535
- missing.disabled = true;
536
- addEvent( missing, "click", function() {
537
- var li = document.getElementsByTagName("li");
538
- for ( var i = 0; i < li.length; i++ ) {
539
- if ( li[i].className.indexOf("fail") > -1 && li[i].innerHTML.indexOf('missing test - untested code is broken code') > - 1 ) {
540
- li[i].parentNode.parentNode.style.display = missing.checked ? "none" : "block";
541
- }
542
- }
543
- });
544
- toolbar.appendChild( missing );
545
-
546
- label = document.createElement("label");
547
- label.setAttribute("for", "qunit-filter-missing");
548
- label.innerHTML = "Hide missing tests (untested code is broken code)";
549
- toolbar.appendChild( label );
550
- }
551
-
552
- var main = id('main') || id('qunit-fixture');
553
- if ( main ) {
554
- config.fixture = main.innerHTML;
555
- }
556
-
557
- if (config.autostart) {
558
- QUnit.start();
559
- }
560
- });
561
-
562
- function done() {
563
- if ( config.doneTimer && window.clearTimeout ) {
564
- window.clearTimeout( config.doneTimer );
565
- config.doneTimer = null;
566
- }
567
-
568
- if ( config.queue.length ) {
569
- config.doneTimer = window.setTimeout(function(){
570
- if ( !config.queue.length ) {
571
- done();
572
- } else {
573
- synchronize( done );
574
- }
575
- }, 13);
576
-
577
- return;
578
- }
579
-
580
- config.autorun = true;
581
-
582
- // Log the last module results
583
- if ( config.currentModule ) {
584
- QUnit.moduleDone( config.currentModule, config.moduleStats.bad, config.moduleStats.all );
585
- }
586
-
587
- var banner = id("qunit-banner"),
588
- tests = id("qunit-tests"),
589
- html = ['Tests completed in ',
590
- +new Date - config.started, ' milliseconds.<br/>',
591
- '<span class="passed">', config.stats.all - config.stats.bad, '</span> tests of <span class="total">', config.stats.all, '</span> passed, <span class="failed">', config.stats.bad,'</span> failed.'].join('');
592
-
593
- if ( banner ) {
594
- banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass");
595
- }
596
-
597
- if ( tests ) {
598
- var result = id("qunit-testresult");
599
-
600
- if ( !result ) {
601
- result = document.createElement("p");
602
- result.id = "qunit-testresult";
603
- result.className = "result";
604
- tests.parentNode.insertBefore( result, tests.nextSibling );
605
- }
606
-
607
- result.innerHTML = html;
608
- }
609
-
610
- QUnit.done( config.stats.bad, config.stats.all );
611
- }
612
-
613
- function validTest( name ) {
614
- var i = config.filters.length,
615
- run = false;
616
-
617
- if ( !i ) {
618
- return true;
619
- }
620
-
621
- while ( i-- ) {
622
- var filter = config.filters[i],
623
- not = filter.charAt(0) == '!';
624
-
625
- if ( not ) {
626
- filter = filter.slice(1);
627
- }
628
-
629
- if ( name.indexOf(filter) !== -1 ) {
630
- return !not;
631
- }
632
-
633
- if ( not ) {
634
- run = true;
635
- }
636
- }
637
-
638
- return run;
639
- }
640
-
641
- function escapeHtml(s) {
642
- s = s === null ? "" : s + "";
643
- return s.replace(/[\&"<>\\]/g, function(s) {
644
- switch(s) {
645
- case "&": return "&amp;";
646
- case "\\": return "\\\\";
647
- case '"': return '\"';
648
- case "<": return "&lt;";
649
- case ">": return "&gt;";
650
- default: return s;
651
- }
652
- });
653
- }
654
-
655
- function push(result, actual, expected, message) {
656
- message = escapeHtml(message) || (result ? "okay" : "failed");
657
- message = '<span class="test-message">' + message + "</span>";
658
- expected = escapeHtml(QUnit.jsDump.parse(expected));
659
- actual = escapeHtml(QUnit.jsDump.parse(actual));
660
- var output = message + ', expected: <span class="test-expected">' + expected + '</span>';
661
- if (actual != expected) {
662
- output += ' result: <span class="test-actual">' + actual + '</span>, diff: ' + QUnit.diff(expected, actual);
663
- }
664
-
665
- // can't use ok, as that would double-escape messages
666
- QUnit.log(result, output);
667
- config.assertions.push({
668
- result: !!result,
669
- message: output
670
- });
671
- }
672
-
673
- function synchronize( callback ) {
674
- config.queue.push( callback );
675
-
676
- if ( config.autorun && !config.blocking ) {
677
- process();
678
- }
679
- }
680
-
681
- function process() {
682
- var start = (new Date()).getTime();
683
-
684
- while ( config.queue.length && !config.blocking ) {
685
- if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) {
686
- config.queue.shift()();
687
-
688
- } else {
689
- setTimeout( process, 13 );
690
- break;
691
- }
692
- }
693
- }
694
-
695
- function saveGlobal() {
696
- config.pollution = [];
697
-
698
- if ( config.noglobals ) {
699
- for ( var key in window ) {
700
- config.pollution.push( key );
701
- }
702
- }
703
- }
704
-
705
- function checkPollution( name ) {
706
- var old = config.pollution;
707
- saveGlobal();
708
-
709
- var newGlobals = diff( old, config.pollution );
710
- if ( newGlobals.length > 0 ) {
711
- ok( false, "Introduced global variable(s): " + newGlobals.join(", ") );
712
- config.expected++;
713
- }
714
-
715
- var deletedGlobals = diff( config.pollution, old );
716
- if ( deletedGlobals.length > 0 ) {
717
- ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") );
718
- config.expected++;
719
- }
720
- }
721
-
722
- // returns a new Array with the elements that are in a but not in b
723
- function diff( a, b ) {
724
- var result = a.slice();
725
- for ( var i = 0; i < result.length; i++ ) {
726
- for ( var j = 0; j < b.length; j++ ) {
727
- if ( result[i] === b[j] ) {
728
- result.splice(i, 1);
729
- i--;
730
- break;
731
- }
732
- }
733
- }
734
- return result;
735
- }
736
-
737
- function fail(message, exception, callback) {
738
- if ( typeof console !== "undefined" && console.error && console.warn ) {
739
- console.error(message);
740
- console.error(exception);
741
- console.warn(callback.toString());
742
-
743
- } else if ( window.opera && opera.postError ) {
744
- opera.postError(message, exception, callback.toString);
745
- }
746
- }
747
-
748
- function extend(a, b) {
749
- for ( var prop in b ) {
750
- a[prop] = b[prop];
751
- }
752
-
753
- return a;
754
- }
755
-
756
- function addEvent(elem, type, fn) {
757
- if ( elem.addEventListener ) {
758
- elem.addEventListener( type, fn, false );
759
- } else if ( elem.attachEvent ) {
760
- elem.attachEvent( "on" + type, fn );
761
- } else {
762
- fn();
763
- }
764
- }
765
-
766
- function id(name) {
767
- return !!(typeof document !== "undefined" && document && document.getElementById) &&
768
- document.getElementById( name );
769
- }
770
-
771
- // Test for equality any JavaScript type.
772
- // Discussions and reference: http://philrathe.com/articles/equiv
773
- // Test suites: http://philrathe.com/tests/equiv
774
- // Author: Philippe Rathé <prathe@gmail.com>
775
- QUnit.equiv = function () {
776
-
777
- var innerEquiv; // the real equiv function
778
- var callers = []; // stack to decide between skip/abort functions
779
- var parents = []; // stack to avoiding loops from circular referencing
780
-
781
- // Call the o related callback with the given arguments.
782
- function bindCallbacks(o, callbacks, args) {
783
- var prop = QUnit.objectType(o);
784
- if (prop) {
785
- if (QUnit.objectType(callbacks[prop]) === "function") {
786
- return callbacks[prop].apply(callbacks, args);
787
- } else {
788
- return callbacks[prop]; // or undefined
789
- }
790
- }
791
- }
792
-
793
- var callbacks = function () {
794
-
795
- // for string, boolean, number and null
796
- function useStrictEquality(b, a) {
797
- if (b instanceof a.constructor || a instanceof b.constructor) {
798
- // to catch short annotaion VS 'new' annotation of a declaration
799
- // e.g. var i = 1;
800
- // var j = new Number(1);
801
- return a == b;
802
- } else {
803
- return a === b;
804
- }
805
- }
806
-
807
- return {
808
- "string": useStrictEquality,
809
- "boolean": useStrictEquality,
810
- "number": useStrictEquality,
811
- "null": useStrictEquality,
812
- "undefined": useStrictEquality,
813
-
814
- "nan": function (b) {
815
- return isNaN(b);
816
- },
817
-
818
- "date": function (b, a) {
819
- return QUnit.objectType(b) === "date" && a.valueOf() === b.valueOf();
820
- },
821
-
822
- "regexp": function (b, a) {
823
- return QUnit.objectType(b) === "regexp" &&
824
- a.source === b.source && // the regex itself
825
- a.global === b.global && // and its modifers (gmi) ...
826
- a.ignoreCase === b.ignoreCase &&
827
- a.multiline === b.multiline;
828
- },
829
-
830
- // - skip when the property is a method of an instance (OOP)
831
- // - abort otherwise,
832
- // initial === would have catch identical references anyway
833
- "function": function () {
834
- var caller = callers[callers.length - 1];
835
- return caller !== Object &&
836
- typeof caller !== "undefined";
837
- },
838
-
839
- "array": function (b, a) {
840
- var i, j, loop;
841
- var len;
842
-
843
- // b could be an object literal here
844
- if ( ! (QUnit.objectType(b) === "array")) {
845
- return false;
846
- }
847
-
848
- len = a.length;
849
- if (len !== b.length) { // safe and faster
850
- return false;
851
- }
852
-
853
- //track reference to avoid circular references
854
- parents.push(a);
855
- for (i = 0; i < len; i++) {
856
- loop = false;
857
- for(j=0;j<parents.length;j++){
858
- if(parents[j] === a[i]){
859
- loop = true;//dont rewalk array
860
- }
861
- }
862
- if (!loop && ! innerEquiv(a[i], b[i])) {
863
- parents.pop();
864
- return false;
865
- }
866
- }
867
- parents.pop();
868
- return true;
869
- },
870
-
871
- "object": function (b, a) {
872
- var i, j, loop;
873
- var eq = true; // unless we can proove it
874
- var aProperties = [], bProperties = []; // collection of strings
875
-
876
- // comparing constructors is more strict than using instanceof
877
- if ( a.constructor !== b.constructor) {
878
- return false;
879
- }
880
-
881
- // stack constructor before traversing properties
882
- callers.push(a.constructor);
883
- //track reference to avoid circular references
884
- parents.push(a);
885
-
886
- for (i in a) { // be strict: don't ensures hasOwnProperty and go deep
887
- loop = false;
888
- for(j=0;j<parents.length;j++){
889
- if(parents[j] === a[i])
890
- loop = true; //don't go down the same path twice
891
- }
892
- aProperties.push(i); // collect a's properties
893
-
894
- if (!loop && ! innerEquiv(a[i], b[i])) {
895
- eq = false;
896
- break;
897
- }
898
- }
899
-
900
- callers.pop(); // unstack, we are done
901
- parents.pop();
902
-
903
- for (i in b) {
904
- bProperties.push(i); // collect b's properties
905
- }
906
-
907
- // Ensures identical properties name
908
- return eq && innerEquiv(aProperties.sort(), bProperties.sort());
909
- }
910
- };
911
- }();
912
-
913
- innerEquiv = function () { // can take multiple arguments
914
- var args = Array.prototype.slice.apply(arguments);
915
- if (args.length < 2) {
916
- return true; // end transition
917
- }
918
-
919
- return (function (a, b) {
920
- if (a === b) {
921
- return true; // catch the most you can
922
- } else if (a === null || b === null || typeof a === "undefined" || typeof b === "undefined" || QUnit.objectType(a) !== QUnit.objectType(b)) {
923
- return false; // don't lose time with error prone cases
924
- } else {
925
- return bindCallbacks(a, callbacks, [b, a]);
926
- }
927
-
928
- // apply transition with (1..n) arguments
929
- })(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length -1));
930
- };
931
-
932
- return innerEquiv;
933
-
934
- }();
935
-
936
- /**
937
- * jsDump
938
- * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
939
- * Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)
940
- * Date: 5/15/2008
941
- * @projectDescription Advanced and extensible data dumping for Javascript.
942
- * @version 1.0.0
943
- * @author Ariel Flesler
944
- * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}
945
- */
946
- QUnit.jsDump = (function() {
947
- function quote( str ) {
948
- return '"' + str.toString().replace(/"/g, '\\"') + '"';
949
- };
950
- function literal( o ) {
951
- return o + '';
952
- };
953
- function join( pre, arr, post ) {
954
- var s = jsDump.separator(),
955
- base = jsDump.indent(),
956
- inner = jsDump.indent(1);
957
- if ( arr.join )
958
- arr = arr.join( ',' + s + inner );
959
- if ( !arr )
960
- return pre + post;
961
- return [ pre, inner + arr, base + post ].join(s);
962
- };
963
- function array( arr ) {
964
- var i = arr.length, ret = Array(i);
965
- this.up();
966
- while ( i-- )
967
- ret[i] = this.parse( arr[i] );
968
- this.down();
969
- return join( '[', ret, ']' );
970
- };
971
-
972
- var reName = /^function (\w+)/;
973
-
974
- var jsDump = {
975
- parse:function( obj, type ) { //type is used mostly internally, you can fix a (custom)type in advance
976
- var parser = this.parsers[ type || this.typeOf(obj) ];
977
- type = typeof parser;
978
-
979
- return type == 'function' ? parser.call( this, obj ) :
980
- type == 'string' ? parser :
981
- this.parsers.error;
982
- },
983
- typeOf:function( obj ) {
984
- var type;
985
- if ( obj === null ) {
986
- type = "null";
987
- } else if (typeof obj === "undefined") {
988
- type = "undefined";
989
- } else if (QUnit.is("RegExp", obj)) {
990
- type = "regexp";
991
- } else if (QUnit.is("Date", obj)) {
992
- type = "date";
993
- } else if (QUnit.is("Function", obj)) {
994
- type = "function";
995
- } else if (obj.setInterval && obj.document && !obj.nodeType) {
996
- type = "window";
997
- } else if (obj.nodeType === 9) {
998
- type = "document";
999
- } else if (obj.nodeType) {
1000
- type = "node";
1001
- } else if (typeof obj === "object" && typeof obj.length === "number" && obj.length >= 0) {
1002
- type = "array";
1003
- } else {
1004
- type = typeof obj;
1005
- }
1006
- return type;
1007
- },
1008
- separator:function() {
1009
- return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? '&nbsp;' : ' ';
1010
- },
1011
- indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing
1012
- if ( !this.multiline )
1013
- return '';
1014
- var chr = this.indentChar;
1015
- if ( this.HTML )
1016
- chr = chr.replace(/\t/g,' ').replace(/ /g,'&nbsp;');
1017
- return Array( this._depth_ + (extra||0) ).join(chr);
1018
- },
1019
- up:function( a ) {
1020
- this._depth_ += a || 1;
1021
- },
1022
- down:function( a ) {
1023
- this._depth_ -= a || 1;
1024
- },
1025
- setParser:function( name, parser ) {
1026
- this.parsers[name] = parser;
1027
- },
1028
- // The next 3 are exposed so you can use them
1029
- quote:quote,
1030
- literal:literal,
1031
- join:join,
1032
- //
1033
- _depth_: 1,
1034
- // This is the list of parsers, to modify them, use jsDump.setParser
1035
- parsers:{
1036
- window: '[Window]',
1037
- document: '[Document]',
1038
- error:'[ERROR]', //when no parser is found, shouldn't happen
1039
- unknown: '[Unknown]',
1040
- 'null':'null',
1041
- undefined:'undefined',
1042
- 'function':function( fn ) {
1043
- var ret = 'function',
1044
- name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE
1045
- if ( name )
1046
- ret += ' ' + name;
1047
- ret += '(';
1048
-
1049
- ret = [ ret, this.parse( fn, 'functionArgs' ), '){'].join('');
1050
- return join( ret, this.parse(fn,'functionCode'), '}' );
1051
- },
1052
- array: array,
1053
- nodelist: array,
1054
- arguments: array,
1055
- object:function( map ) {
1056
- var ret = [ ];
1057
- this.up();
1058
- for ( var key in map )
1059
- ret.push( this.parse(key,'key') + ': ' + this.parse(map[key]) );
1060
- this.down();
1061
- return join( '{', ret, '}' );
1062
- },
1063
- node:function( node ) {
1064
- var open = this.HTML ? '&lt;' : '<',
1065
- close = this.HTML ? '&gt;' : '>';
1066
-
1067
- var tag = node.nodeName.toLowerCase(),
1068
- ret = open + tag;
1069
-
1070
- for ( var a in this.DOMAttrs ) {
1071
- var val = node[this.DOMAttrs[a]];
1072
- if ( val )
1073
- ret += ' ' + a + '=' + this.parse( val, 'attribute' );
1074
- }
1075
- return ret + close + open + '/' + tag + close;
1076
- },
1077
- functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function
1078
- var l = fn.length;
1079
- if ( !l ) return '';
1080
-
1081
- var args = Array(l);
1082
- while ( l-- )
1083
- args[l] = String.fromCharCode(97+l);//97 is 'a'
1084
- return ' ' + args.join(', ') + ' ';
1085
- },
1086
- key:quote, //object calls it internally, the key part of an item in a map
1087
- functionCode:'[code]', //function calls it internally, it's the content of the function
1088
- attribute:quote, //node calls it internally, it's an html attribute value
1089
- string:quote,
1090
- date:quote,
1091
- regexp:literal, //regex
1092
- number:literal,
1093
- 'boolean':literal
1094
- },
1095
- DOMAttrs:{//attributes to dump from nodes, name=>realName
1096
- id:'id',
1097
- name:'name',
1098
- 'class':'className'
1099
- },
1100
- HTML:false,//if true, entities are escaped ( <, >, \t, space and \n )
1101
- indentChar:' ',//indentation unit
1102
- multiline:false //if true, items in a collection, are separated by a \n, else just a space.
1103
- };
1104
-
1105
- return jsDump;
1106
- })();
1107
-
1108
- // from Sizzle.js
1109
- function getText( elems ) {
1110
- var ret = "", elem;
1111
-
1112
- for ( var i = 0; elems[i]; i++ ) {
1113
- elem = elems[i];
1114
-
1115
- // Get the text from text nodes and CDATA nodes
1116
- if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
1117
- ret += elem.nodeValue;
1118
-
1119
- // Traverse everything else, except comment nodes
1120
- } else if ( elem.nodeType !== 8 ) {
1121
- ret += getText( elem.childNodes );
1122
- }
1123
- }
1124
-
1125
- return ret;
1126
- };
1127
-
1128
- /*
1129
- * Javascript Diff Algorithm
1130
- * By John Resig (http://ejohn.org/)
1131
- * Modified by Chu Alan "sprite"
1132
- *
1133
- * Released under the MIT license.
1134
- *
1135
- * More Info:
1136
- * http://ejohn.org/projects/javascript-diff-algorithm/
1137
- *
1138
- * Usage: QUnit.diff(expected, actual)
1139
- *
1140
- * QUnit.diff("the quick brown fox jumped over", "the quick fox jumps over") == "the quick <del>brown </del> fox <del>jumped </del><ins>jumps </ins> over"
1141
- */
1142
- QUnit.diff = (function() {
1143
- function diff(o, n){
1144
- var ns = new Object();
1145
- var os = new Object();
1146
-
1147
- for (var i = 0; i < n.length; i++) {
1148
- if (ns[n[i]] == null)
1149
- ns[n[i]] = {
1150
- rows: new Array(),
1151
- o: null
1152
- };
1153
- ns[n[i]].rows.push(i);
1154
- }
1155
-
1156
- for (var i = 0; i < o.length; i++) {
1157
- if (os[o[i]] == null)
1158
- os[o[i]] = {
1159
- rows: new Array(),
1160
- n: null
1161
- };
1162
- os[o[i]].rows.push(i);
1163
- }
1164
-
1165
- for (var i in ns) {
1166
- if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) {
1167
- n[ns[i].rows[0]] = {
1168
- text: n[ns[i].rows[0]],
1169
- row: os[i].rows[0]
1170
- };
1171
- o[os[i].rows[0]] = {
1172
- text: o[os[i].rows[0]],
1173
- row: ns[i].rows[0]
1174
- };
1175
- }
1176
- }
1177
-
1178
- for (var i = 0; i < n.length - 1; i++) {
1179
- if (n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null &&
1180
- n[i + 1] == o[n[i].row + 1]) {
1181
- n[i + 1] = {
1182
- text: n[i + 1],
1183
- row: n[i].row + 1
1184
- };
1185
- o[n[i].row + 1] = {
1186
- text: o[n[i].row + 1],
1187
- row: i + 1
1188
- };
1189
- }
1190
- }
1191
-
1192
- for (var i = n.length - 1; i > 0; i--) {
1193
- if (n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null &&
1194
- n[i - 1] == o[n[i].row - 1]) {
1195
- n[i - 1] = {
1196
- text: n[i - 1],
1197
- row: n[i].row - 1
1198
- };
1199
- o[n[i].row - 1] = {
1200
- text: o[n[i].row - 1],
1201
- row: i - 1
1202
- };
1203
- }
1204
- }
1205
-
1206
- return {
1207
- o: o,
1208
- n: n
1209
- };
1210
- }
1211
-
1212
- return function(o, n){
1213
- o = o.replace(/\s+$/, '');
1214
- n = n.replace(/\s+$/, '');
1215
- var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/));
1216
-
1217
- var str = "";
1218
-
1219
- var oSpace = o.match(/\s+/g);
1220
- if (oSpace == null) {
1221
- oSpace = [" "];
1222
- }
1223
- else {
1224
- oSpace.push(" ");
1225
- }
1226
- var nSpace = n.match(/\s+/g);
1227
- if (nSpace == null) {
1228
- nSpace = [" "];
1229
- }
1230
- else {
1231
- nSpace.push(" ");
1232
- }
1233
-
1234
- if (out.n.length == 0) {
1235
- for (var i = 0; i < out.o.length; i++) {
1236
- str += '<del>' + out.o[i] + oSpace[i] + "</del>";
1237
- }
1238
- }
1239
- else {
1240
- if (out.n[0].text == null) {
1241
- for (n = 0; n < out.o.length && out.o[n].text == null; n++) {
1242
- str += '<del>' + out.o[n] + oSpace[n] + "</del>";
1243
- }
1244
- }
1245
-
1246
- for (var i = 0; i < out.n.length; i++) {
1247
- if (out.n[i].text == null) {
1248
- str += '<ins>' + out.n[i] + nSpace[i] + "</ins>";
1249
- }
1250
- else {
1251
- var pre = "";
1252
-
1253
- for (n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++) {
1254
- pre += '<del>' + out.o[n] + oSpace[n] + "</del>";
1255
- }
1256
- str += " " + out.n[i].text + nSpace[i] + pre;
1257
- }
1258
- }
1259
- }
1260
-
1261
- return str;
1262
- }
1263
- })();
1264
-
1265
- })(this);