diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 5d126348..00000000 --- a/.editorconfig +++ /dev/null @@ -1,13 +0,0 @@ -# editorconfig.org -root = true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -[*.md] -trim_trailing_whitespace = false diff --git a/.gitignore b/.gitignore index aabe272b..535aec06 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,3 @@ -.byebug_history -npm-debug.log -manifest.yaml /.bundle .DS_Store coverage @@ -13,7 +10,6 @@ Gemfile.lock docs .rbenv-* .ruby-version -.ruby-gemset .*.swp build doc @@ -24,4 +20,4 @@ Makefile .idea *.sublime-workspace /bin -middleman-core/fixtures/compass-sprites-app/source/images/icon-s0de2218f58.png +middleman-core/fixtures/compass-sprites-app/source/images/icon-s0de2218f58.png \ No newline at end of file diff --git a/middleman-cli/fixtures/preview-server-app/config.rb b/.gitmodules similarity index 100% rename from middleman-cli/fixtures/preview-server-app/config.rb rename to .gitmodules diff --git a/.rubocop.yml b/.rubocop.yml index c92b709f..7789d6c2 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,24 +1,19 @@ AllCops: - Include: - - '**/Rakefile' - - '**/Gemfile' - - '**/config.ru' - - '**/gem_rake_helper.rb' - Exclude: - - 'script/**/*' - - 'vendor/**/*' - - '**/tmp/**/*' - - '**/bin/**/*' - - 'middleman-core/lib/middleman-core/step_definitions/**/*' - - 'middleman-core/fixtures/**/*' - - 'middleman-core/features/**/*' - - 'middleman-core/spec/**/*' - - 'middleman-cli/lib/middleman-cli/templates/**/*' - - 'middleman-cli/fixtures/**/*' - - 'middleman-cli/features/**/*' - - 'middleman-cli/spec/**/*' -DoubleNegation: - Enabled: false + Includes: + - Rakefile + - Gemfile + - config.ru + - gem_rake_helper.rb + Excludes: + - script/** + - vendor/** + - bin/** + - middleman-core/lib/vendored-middleman-deps/** + - middleman-core/bin/** + - middleman-core/fixtures/** + - middleman-core/features/** + - middleman-core/spec/** + - middleman-templates/lib/middleman-templates/** LineLength: Enabled: false MethodLength: @@ -27,45 +22,7 @@ ClassLength: Enabled: false Documentation: Enabled: false +Encoding: + Enabled: false HashSyntax: - EnforcedStyle: ruby19 -SpaceAroundEqualsInParameterDefault: - EnforcedStyle: no_space -PerlBackrefs: - Enabled: false -ClassAndModuleChildren: - Enabled: false -AssignmentInCondition: - Enabled: false -CyclomaticComplexity: - Enabled: false -HandleExceptions: - Enabled: false -EndAlignment: - AlignWith: variable -SignalException: - Enabled: false -RegexpLiteral: - Enabled: false -FormatString: - Enabled: false -CaseIndentation: - IndentWhenRelativeTo: end -TrivialAccessors: - Enabled: false -SingleLineBlockParams: - Enabled: false -Metrics/AbcSize: - Enabled: false -Metrics/PerceivedComplexity: - Enabled: false -Style/ParallelAssignment: - Enabled: false -Style/BlockDelimiters: - Enabled: false -Style/MultilineBlockChain: - Enabled: false -Style/SpecialGlobalVars: - Enabled: false -Style/FrozenStringLiteralComment: - Enabled: false + EnforcedStyle: ruby19 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index ac5a7f06..e360e9a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,23 +1,30 @@ language: ruby -sudo: false cache: bundler -before_script: - - bundle update +env: TEST=true +bundler_args: --without development +before_install: git submodule update --init --recursive rvm: - ruby-head - - 2.3.1 - - 2.2.4 -os: - - linux - # - osx + - ruby + - jruby-head + - jruby + - jruby-19mode + - 2.1.1 + - 2.1.0 + - 2.0.0 + - 1.9.3 + - rbx-2 matrix: fast_finish: true allow_failures: - rvm: ruby-head -env: - global: - - TEST=true - - CODECLIMATE_REPO_TOKEN=81787f7b1c3bfa937edadcafbc94f807bf5af5c1142c7b793f2d9969a271de1f + - rvm: ruby + - rvm: jruby-head + - rvm: jruby + - rvm: jruby-19mode + - rvm: rbx-2 +env: TEST=true +before_install: git submodule update --init --recursive script: bundle exec rake test notifications: slack: middleman:JW9OvXmn1m3XrSERe8866nBR diff --git a/.yardopts b/.yardopts index 8a5eba70..980f0e4c 100644 --- a/.yardopts +++ b/.yardopts @@ -7,5 +7,4 @@ middleman-*/lib/**/*.rb --exclude middleman-cli/lib/middleman-cli/templates/shared/ --exclude middleman-cli/lib/middleman-cli/templates/extension/ --no-private ---hide-void-return ---markup=markdown \ No newline at end of file +--hide-void-return \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 148aa2e2..57672727 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,148 +1,6 @@ master === -# 4.1.13 - -* Change how config options are passed to Thor. Removes new Thor warnings from #2017 - -# 4.1.12 - -* Fix broken `ignore { |p| true }` form. - -# 4.1.11 - -* Upgrade to Rack 2. - -# 4.1.10 - -* Fix unicode issues in URL deeplinks. -* Add prefix option to asset_hash (#1949) - -# 4.1.9 - -* Fix `--watcher-*` CLI flags. -* Allow spaces in paths to work with `link_to`. Fixes #1914 -* Add support for dotenv -* Fix asset_url with asset_hash (#1919) -* Allow partial lookups without a current_resource (#1912) - -# 4.1.8 - -* Expose `development?` and `production?` helpers to template context. -* require the `try` core extension (#1911) -* Fix contract for Sitemap::Store.register_resource_list_manipulator (#1907) -* Loosen contract on Resource#source_file to Maybe[String] (#1906) -* Let collection loops access ConfigContext for helpers. #1879 -* Use https:// to clone templates (#1901) -* Allow numbers to be unique page_ids (#1886) -* Prevent infinite loop when encountering files where base filename is a possible templating engine - -# 4.1.7 - -* Upgrade fastimage to 2.0 -* Fix shutdown of external_pipeline commands when config.rb is changed. #1877 -* Allow calls to `app.` to work as collections after initial config parse. #1876 - - -# 4.1.5-4.1.6 - -* Fix file recursion when looking for possible asset dependencies. Major preview server performance improvement. - -# 4.1.4 - -* Unify default extensions for all URL processing extensions. #1855 -* Fix URL regex for `content: ` context of CSS. #1853 -* Make sure CLI config over-rides `config.rb` order. -* Fix relative assets in some contexts. #1842 - -# 4.1.3 - -* Expose all top-level config options to CLI (flags now match config. latency -> watcher_latency, etc). -* Fix directory indexes with `.htm` and `.xhtml` files. #1821 - -# 4.1.2 - -* Add `page_id` concept. Using the `id` key in frontmatter, proxy or page will set an ID on a resource which can be referenced by `url_for` and `link_to`. -* Allow looking for `Gemfile` when setting up a project to fail gracefully. -* Send correct exit code when external_pipeline fails during build. -* Fix error when customizing `layouts_dir`. #1028 -* Fix collections (commands in loops) not being processed by `page` command. #1226 -* Correctly asset_hash sourcemap references. - -# 4.1.1 - -* Fix bad code that made `/__middleman/` break. - -# 4.1.0 - -* Add rewrite_ignore option to asset_hash, asset_host, cache_buster & relative_assets. This proc let's you opt-out of the extension behavior on a per-path basis. -* gzip extension now compresses svgs by default -* Fix the `encoding` option. -* Fix relative paths on `image_tag` helper. -* Correctly exit with error code on failed `init` -* Fixed `asset_hash` when path has query string or #hashes -* Fix new extension template -* Don't parse frontmatter on ignored files. -* Fix displaying frontmatter on `/__middleman/sitemap` -* Add `skip_build_clean` config which when set to a block, will avoid removing non-generated paths from build, like .git #1716 -* Minor performance improvements -* DRY-up config.rb-specific commands like `ignore` or `path`. -* Fix automatic images with absolute (or images dir missing) paths in markdown. Fixes #1755 -* Fix asset_host in combination with Google Analytics snippet. #1751 -* Show an error message when git CLI is not available. #1765 -* Correctly show file names of GZIP'ed assets. #1364 -* Build file output is now parallel-ized! Use `middleman build --no-parallel` to disable. -* Make template file extensions that get layouts by default configurable via `config[:extensions_with_layout]` -* Remove `=` from inline url matcher. This means paths in HTML attributes MUST be quoted. Fixes #1780 - -# 4.0.0 - -* Add `:locales` and `:data` source types to the list of files which trigger a live-reload. -* Rename i18n `lang` and `langs` to `locale` and `locales`. -* Avoid matching URLs across new lines. #1689 -* Load Middleman Directory when doing `init` over SSL -* Fix `external_pipeline` first runs running out of sequence. - -# 4.0.0.rc.2 - -* Rather than applying layouts to all files which are not .txt, .css, .js, .json: the new behavior is to only default layouts to active for .html -* Switch from Ruby Sass to SassC. -* `relative_assets` extension overrides local `relative: false` option to stylesheet/javascript tag helpers. -* Add `before_server`-hook to the preview server which is run before the Webrick server is started -* Add `-d` to `middleman server` to make it run as daemon -* Trigger "Possible File Change" events on files which share an output or template type with a changed file. Allows LiveReload to update on partial changes. -* Added `import_file SOURCE, TARGET` and `import_path SOURCE_FOLDER` to copy resources from outside the project in. Does NOT do file change watching. Perfect for `bower_components`. - -# 4.0.0.rc.1 - -* Removed ability to use JSON as frontmatter. Still allowed in data/ folder. -* Added YAML data postscript. Like frontmatter, but reversed. Attach content after the key/value data as a `:postscript` key to the data structure (if Hash). - -# 4.0.0.beta.2 - -* Fixed regression causing exceptions to be silently thrown away outside of `--verbose` mode in the dev server. -* Pull in `--ssl` option from stable. -* Replace `hooks` gem with custom callback solution. - -# 4.0.0.beta.1 - -* Add `resources` class method to extensions to allow simple string-based resource generation. -* rename `app.add_to_instance` to `Extension.expose_to_application` for adding extension-local methods to the shared app instance. -* rename `app.add_to_config_context` to `Extension.expose_to_config` for adding extension-local methods to the sandboxed scope of `config.rb` -* Add `Extension.expose_to_template`, which auto binds copies of extension-local methods into a Template context. -* Remove side-loading of CLI tasks from `tasks/` -* Add the option of naming `config.rb` as `middleman.rb`. -* Builder extracted from Thor. `after_build` hook now passes an instance of a Builder instead of the Thor CLI. -* New FileWatcher API. -* Remove the `partials_dir` setting. Partials should live next to content, or be addressed with absolute paths. -* Partials must be named with a leading underscore. `_my_snippet.html.erb`, not `my_snippet.html.erb`. -* Removed the `proxy` and `ignore` options for the `page` command in `config.rb`. Use the `proxy` and `ignore` commands instead of passing these options to `page`. -* The `page` command in `config.rb` can now be used to add data to the page via the `data` argument. It is accessed the same way as frontmatter data, via `current_resource.data`. -* Add support for `environments` with the `-e` CLI flag. Loads additional config from `environments/envname.rb`. Removed `development?` helper in favor of `environment?(:development)`. Added `server?` helper to differentiate between build and server mode. -* Removed `with_layout`. Use loops of `page` instead. -* Removed Queryable Sitemap API -* Removed `css_compressor` setting, use `activate :minify_css, :compressor =>` instead. -* Removed `js_compressor` setting, use `activate :minify_javascript, :compressor =>` instead. * Removed ability to server folders of content statically (non-Middleman projects). * Prevent local templates being loaded when $HOME is not set * Removed "Implied Extension feature" @@ -158,4 +16,459 @@ master * Remove deprecated `request` instance * Remove old module-style extension support * Placed all `config.rb` evaluation inside the `ConfigContext` class -* The preview server can now serve over HTTPS using the `--https` flag. It will use an automatic self-signed cert which can be overridden using `--ssl_certificate` and `--ssl_private_key`. These settings can also be set in `config.rb` +* Add :format and :keep_original options to :asset_hash + +3.3.0-3.3.2 +=== + +* Update Padrino to 0.12.1. Introduces BREAKING CHANGE for Haml. Helpers which take blocks used to require `-` instead of `=` to work correctly. Now, all helpers which output content should use `=`. See: http://www.padrinorb.com/blog/upgrading-padrino-from-0-11-x-to-0-12-0-guide +* Update Haml to 4.x +* Disable Webrick reverse DNS lookup, vastly improving performance when accessing from a VM. +* Ignore `node_modules` in FileWatcher +* Add `tzinfo-data` for Windows users. +* Prefer loading layouts from `layouts_dir` +* Add `before_build` hook. +* Depend on Erubis and remove support for specifying another ERb engine. +* Removed the ability to set the `sass_cache_path`. +* Improved /__middleman/ meta pages. For example, sitemap view now calls out ignored resources, prints data/options better, and shows which special locals are available on a page. +* Bump Uglifier to 2.5.x + +3.2.2 +=== + +* Specify the full path to the NEWLINE constant +* Refactor some internals which were dependent on certain order of operations +* Updated i18n dep +* Updated Uglifier dep + +3.2.1 +=== + +* Allow path to be passed to page_classes. #1120 +* Parallelize gzip extension using four threads. #1116 +* Fix locale issue when using gzip extension +* Better handle UTF-8 filenames +* Update Padrino to 0.11.4 and Tilt to 1.4.1 + +3.2.0 +=== + +* Dropped support for Ruby 1.8 +* Dropped empty "middleman-more" gem +* Support the AsciiDoc format +* `page_classes` now prefixes class names starting with numbers with an alpha character. "x" by default. +* AREL-style sitemap query language no longer mutates on filter +* Logging can now be forwarded to a file +* Syntax errors in config.rb no longer hang the server +* Fixed memory leak when adding blocks to resources. #1020 +* Support HEAD requests in the server + +3.1.6 +=== + +* Magic sitemap-aware links and image references now work when your markdown engine is Kramdown (the default for Middleman). +* Having the build directory be a symlink no longer causes the --clean (default) option to wipe out your build. +* Fix handling paths and URLs with spaces in them. #961 +* Loosen up Kramdown dependency to allow for using version 1.2. +* Loosen up Listen dependency so it works with sass betas. +* Look for assets using url_for before falling back to the "images" directory. #1017 +* Do not cache generated redirect index file. #1019 +* Make an effort to handle spaces in filenames in a way that url_for can handle. #961 +* Fix localization via filename extension. #1015 + +3.1.5 +=== + +* Escape filenames in regexes. Fixes #942. +* Create automated alt tag addition, based on image name. +* Add listener latency option. (Aliased to -l) +* Add support/tests for Redcarpet 3.0.0 features + - :underline + - :highlight + - :disable_indented_code_blocks +* Fix support for + - :link_attributes + - :filter_html + +3.1.4 +=== + +* Support kramdown 1.1 +* Support redcarpet's :no_links & :no_images. #951 + +3.1.3 +=== + +* Fixed typo in rack extensions block +* Add support for nojekyll dotfile + +3.1.2 +=== + +* Locales regex was broken, selecting .yml files from data folder. +* Fix for implied extensions getting a layout. (Mentioned in #901)git pu +* Added `redirect` command for generating meta refreshes + +3.1.1 +=== + +* Check if set is redefining a param at the class level. Fixes #939 +* Correctly escape `content_tag` when using a block. Fixes #941 + +3.1.0 Highlights +=== + +* Autoload support (moving away from middleman-more) +* New Configuration System +* New v4 Extension API +* `/__middleman' inspector +* Added Ruby 2.0, dropped Ruby 1.9.2 +* Fully tested on JRuby 1.9 +* Build defaults to --clean + +3.1.0.rc.4 +=== + +* Blocks with different templating languages than their layout now work as expected. #860 +* Ruby 1.8 users will need to add the following to their Gemfiles: + platforms :mri_18 do + gem "ruby18_source_location" + end +* The `endpoint` method allows the building of Rack-based files or arbitrary content. + +3.1.0.rc.2 +=== + +* `layouts_dir` is now configurable +* Custom template classes can now override the file used for creating the project Gemfile. +* Add an "empty" template that produces the minimum necessary structure for a Middleman project. +* Fix ignoring layouts from the sitemap when the source directory has been set to something other than 'source'. #896 +* Track test coverage with simplecov +* i18n only autodetects languages in the `locales` root +* Frontmatter cache fixes solve performance regressions found in 3.1.x +* Vendor padrino-* to avoid dep hell +* `middleman-more` gem returns, but it's empty for backwards compat +* Prefer internal files.exists? over ruby's slow File.exists? + +3.1.0.rc.1 +=== + +* Move more into core, autoloaded if gems are available. +* DataStore may now be accessed like a hash with #[] and #has_key?. #880 +* The i18n extension now supports providing localized templates as separate files, like index.es.html.haml. #816, #823 +* The list of regular expressions for which files are ignored by the file watcher are now configurable. +* Revert to Thor 0.15.x +* Revert to padrino-helpers 0.10.x (dependency hell) +* Drop i18n dep to match activesupport at 0.6.1 + +3.1.0.beta.2 +=== + +* Extension template uses new class-based Extension +* Fix missing children in some sitemap traversal operations. #837 +* Add respond_to? to DataStore. #872 +* Allow discovery of prerelease gems. #873 +* Include middleman-livereload in default Gemfile +* Update Rack dependency to 1.5.x +* Update to Listen 1.0.x +* Update to padrino-helpers 0.11.x +* Update uglifier to 2.0.x +* Convert all of middleman-more to new class-based Extensions + +3.1.0.beta.1 +=== + +* Support Slim 2.0 ::Slim::Embedded +* "middleman build" will clean out old files from the build directory by default now, without needing to pass "--clean". Pass "--no-clean" to disable. #862 +* Allow frontmatter to be side-loaded from a neighboring file with a .frontmatter extension: #855 +* Allow frontmatter "renderer_options" key to overwrite renderer options on a per-file basis. #859 +* A custom :partials_dir may be configured, and partials will be looked up from it. #854 +* The sprockets environment is now available before config.rb is run, so you can mess with it. +* Added a "t" helper that delegates to I18n.t, just like Rails. #853. +* I18n will fall back to the default locale if a translation in the current locale is not found. You can disable this behavior by passing `:no_fallbacks => true` when activating `:i18n`. More settings documented at https://github.com/svenfuchs/i18n/wiki/Fallbacks . #853 +* Switched default Markdown engine to Kramdown. #852 +* Overhaul content-type handling, and add a `:content_type` parameter for `page`, `proxy`, and frontmatter that allows for overriding the default content type. #851 +* Fixes for upcoming Sass versions. +* Fix markdown filters in Haml 4 so that they don't throw errors when generating links/images and so they use our magic image_tag/link_to methods. #662 +* Fix a number of bugs with i18n. Add a `:lang` option that can be used with `page` or `proxy` to set the I18n.locale of a page. #845 +* Directory names in the data folder are treated as part of the data key. #836 +* Properly reload the server when files change in "lib" or "helpers". #835 +* Replace Rainpress CSS minifier with the one built into Sass. +* Changed 'default' and 'html5' templates to use 'current_page.data.title' instead of 'data.page.title'. #825 +* Include file extension in template cache. #798 +* Support for Ruby 2.0.0. +* "middleman console" will give you a console where you can mess around inside your middleman context. #775 +* Add to Compass import paths instead of resetting them. #707 +* There are now metadata pages in the preview server at "/__middleman/" that show information about the sitemap and site configuration. #374 and #776 +* The sitemap is now queryable with an ARel-like API. #650 +* Reorganize SMACSS template. #591 +* No longer bundle native file watchers - add an appropriate gem (rb-fsevent for OS X, rb-inotify for Linux, wdm for windows) to your Gemfile. +* `activate :asset_host, :host => hostname` can be used to configure `:asset_host`. +* Path matchers (for things like ignore and page) correctly work with string matchers. #689 +* Configuration has been moved to Middleman::Configuration::ConfigurationManager. This is backwards-compatible, but offers a nicer way of getting and setting configuration for extensions, including documenting those settings and their defaults. #620. + +3.0.13 +=== + +* Require Tilt 1.3.6 (older versions have errant .csv template type) +* Unregister Tilt HTML handler +* Fix dynamic multi-byte utf-8 files rebuilding. #806 +* Force locale to english for number_to_human_size in the gzip extension. #804 +* Don't use the logger from a trap context. Ruby 2.0.0 support. #801. +* Serve extensionless files or dotfiles with text/plain MIME type + +3.0.12 +=== + +* Update to listen 0.7.x. No longer depend on rb-inotify. *nix users should add to Gemfile. +* Support Haml 4 +* :debug_assets can no longer be turned on in the build environment. +* Helpers now work with JS/CSS files with .erb processing. +* Provide an informative exception when link_to is used improperly. +* Force .svgz files to be treated as binary. +* Add a url_for method that performs the link_to magic URL generation without a link. Make form_for use url_for. #739 +* Fix issues when combining relative assets and cache buster. +* Support the .yaml extension for data files. +* Handle non-english default languages in i18n. Fixes #584. #771 +* Allow frontmatter to be parsed on templates outside the project root +* Improve detection of binary files. #763 +* Add before_render and after_render hooks that can be used by extensions to modify templates before they're rendered or modify the rendered output before it's returned. #761 & #774 +* Tightened up dependencies +* Print the command for running middleman in verbose mode with quotes so Bundler doesn't swallow the verbose flag. #750 + +3.0.11 +==== + +* Mitigate major perf regression caused by the Middleman::Util#binary? method + +3.0.10 +==== + +* Avoid looking in binary files for frontmatter. #728 +* Allow nested i18n files. #725 +* Better adapt to Rack interface. #709 +* Add --force-polling flag. #730, #644 + +3.0.9 +==== + +* Lock Rack to 1.4.1 until BodyProxy bug is resolved. #709 +* Safely de-register Tilt extensions which are missing gems. #713 + +3.0.8 +==== + +* Directly send binary files in preview and copy them in build, avoiding reading large binary files into memory for rendering. #643 #699 +* Make link_to helper ignore QueryString values when looking up Sitemap resources +* Directly copy binary files during build, and stream them during preview, to avoid reading them into memory +* Make sure all paths in Sitemap are using Pathname + +3.0.7 +==== + +* Turn html5 boilerplate into a layout +* Fix errors when templates have empty YAML +* Show the hostname when initializing MM +* Fix issues when using Redcarpet inside Slim +* Make automatic_image_sizes avoid SVGs + +3.0.6 +==== +* Make Sitemap more thread-safe. +* Asset-hash fixes in conjunction with Sprockets. +* Proxy improvements. +* Handle directories with a tilde (~) in their path. +* Print better error message which port is already in use. +* Terminal signal improvements, shutsdown correctly when Terminal closed. +* Bundled Normalize.css updated to 2.0.1 +* Fixed Encoding extension activation +* Reload i18n on file changes (#616) + +3.0.5 +==== +* Require newer version of listen. +* Handful of sitemap speed improvements. +* Fix previewing of directories with periods in their name. +* Add CLI ability to skip gemfile and bundler init. +* Fix asset_hash when used in conjunction with Rack middleware. +* Fix LiveReload extension issues. + +3.0.3-3.0.4 +==== +* Add reload_paths to server CLI to add additional paths to reload MM on change. +* Re-organize app reloading code, don't need to restart listen every time. + +3.0.2 +==== +* Logger has no such method .warning. Closes #582 + +3.0.1 +==== +* HTML5 Boilerplate version 4.0.0 +* Use wdm for Windows +* Fix buggy color renaming in built-in CSS minifier. #576 +* Fix Sass/Scss filter in Slim templates +* Added SMACSS template +* Give file metadata (such as frontmatter) precedence over path meta. #552 +* Add `sass_assets_paths` option for arbitrary sass partial locations. +* Don't catch CoffeeScript errors when in build mode. +* Extract load_paths so they aren't locked into the binary +* Add middleman/rack for better config.ru support +* Use centralized Logger and add benchmark methods + +3.0.0 +==== +* Improve asset methods and link_to by making them more clever and aware of options such as relative_assets and http_prefix +* Refer to --verbose, instead of --debug in CLI error message (#505) +* Cleanup listener setup and teardown +* Update to Padrino 0.10.7 and Thor 0.15 (#495) +* Build output correctly shows update and identical, instead of create for all. +* automatic_directory_matcher (#491) + +3.0.0.rc.2 +==== +* Doing a build now shows identical files (#475) +* asset_hash, minify_javascript, and minify_css can now accept regexes, globs, + and procs (#489, #480) +* The `link_to` helper can now accept a sitemap Resource as a URL (#474) +* The preview server now correctly listens for changes (#487, #464) +* HTMLs are now served with a 'utf-8' charset instead of 'utf8' (#478) +* UTF-8 is now the new default encoding for data and templates (#486, #483) +* New :encoding setting that allows users to change default encoding +* You may now use the `use` method with a block when adding Rack middleware +* Middleman now depends on Listen 0.4.5+ and ActiveSupport 3.2.6+ +* Attempt to avoid issues with RVM's default Bundler (#466) +* Fix issue where Middleman won't start with Compass 0.12.2.rc.1 (#469) + +3.0.0.rc.1 +==== +* Split into 3 gems (middleman-core, middleman-more and middleman which simply includes both) +* Rewritten to work directly with Rack (Sinatra apps can still be mounted) +* Sitemap maintains own state +* New Extension Registration API +* Remove old 1.x mm- binaries and messaging +* New default layout functionality: https://github.com/middleman/middleman/issues/165 +* Enable chained templates outside of sprockets (file.html.markdown.erb) +* Sitemap object representing the known world +* FileWatcher proxies file change events +* Unified callback solution +* Removed Slim from base install. Will need to be installed and required by the user (in - config.rb) +* Activate mobile html5boilerplate template +* Update to Redcarpet for Markdown (breaks Haml :markdown filter) +* Return correct exit codes (0 for success, 1 for failure) from CLI +* Yard code docs: http://rubydoc.info/github/middleman/middleman +* config.rb and extensions can add command-line commands +* Nested layouts using `wrap_layout` helper +* Support for placekitten.com +* Added MM_ROOT environmental variable +* activating extensions can now take an options hash +* Don't re-minify files with ".min" in their name +* Serve purely static folders directly (without source/ and config.rb) +* Set ignored files and disable directory_indexes from YAML frontmatter +* Automatically load helper modules in helpers/ directory +* Add pid for cleanup +* Use guard/listen for file watching +* Merge full i18n support +* Implied file extensions (style.scss => style.css) +* Padrino 0.10.6 +* `middleman init` generates a `Gemfile` by default. +* Errors stop the build and print a stacktrace rather than silently getting printed into files. +* `with_layout` works with globs or regexes. +* Setting `directory_index` from `page` with a glob or regex now works. +* `:gzip` extension for pre-gzipping files for better compression with no server CPU cost. +* `:asset_hash` extension that generates unique-by-content filenames for assets and rewrites references to use those filenames, so you can set far-future expires on your assets. +* Removed the `--relative` CLI option. +* Properly output Compass-generated sprited images. +* Switch built-in CSS compressor to Rainpress. +* Automatically load helper modules from `helpers/`, like Rails. +* `ignore` and `page` both work with file globs or regexes. +* `layout`, `ignore`, and `directory_index` can be set from front matter. +* JavaScript and CSS are minified no matter where they are in the site, including in inline code blocks. +* Files with just a template extension get output with the correct exension (foo.erb => foo.html) +* `link_to` is smart about source paths, and can produce relative URLs with the `:relative` option or the sitewide `:relative_links` setting. +* Include vendored assets in sprockets path. +* Finally support Compass in Sprockets! Thanks to @xdite and @petebrowne +* Moved Sprockets into an extension +* Support loading Less @imports + +2.0.14 +==== +* Minor fix for i18n + +2.0.13.2 +==== +* Update Windows eventmachine dep + +2.0.13.1 +==== +* build --clean shouldn't remove dotfiles + +2.0.13 +==== +* middleman build --clean keeps the build directory clean of leftover files +* Padrino 0.10.5 and Rack 1.3.5 + +2.0.12 +==== +* Sinatra 1.3.1 and Padrino 0.10.4 + +2.0.11 +===== +* Lock Padrino and Sinatra versions (for now) + +2.0.9 +===== +* Added --glob option to build which only builds matching files +* Allow data/ files to be in JSON format as well +* Enabled Liquid {% include %} tag +* RubyInstaller-specific gem +* Allow access to data/ in config.rb +* Add mobile html5boilerplate template + +2.0.8 +===== +* Support accessing variables and data objects in ERb Sprockets files (library.js.coffee.erb) +* Make :markdown_engine support simple symbol names (:maruku instead of ::Tilt::MarkukuTemplate) +* Update Padrino deps to 0.10.2 +* Include therubyracer on *nix +* Enable frontmatter for Liquid templates + +2.0.7 +===== +* Updated HTML5 Boilerplate to v2 +* Make Rails 3.1 javascript gems available to Sprockets + +2.0.6 +===== +* Pulled out livereload feature into its own extension, still installed by default. + +2.0.5 +===== +* Vendored Padrino 0.10.0 + +2.0.4 +===== +* Pulled out undocumented remote data feature into its own extension + +2.0.3 +===== +* Pulled out undocumented Blog feature into its own extension + +2.0.2 +===== +* Fixed Sprockets circular error +* Added auto-requiring extensions + +2.0.0 +===== +* Guard-powered auto-reloading of config.rb +* Guard LiveReload +* Sprockets JS +* Refactored Dynamically Reloadable Core +* Combine views/ and public/ into a single source/ folder. +* Support YAML front-matter +* Added callback to run code after Compass is configured +* Added support for a compass.config file which is passed directly to Compass +* Blog-aware Feature (and project template) +* Thor-based, unified `middleman` binary +* :directory_indexes feature diff --git a/.github/CONTRIBUTING.md b/CONTRIBUTING.md similarity index 96% rename from .github/CONTRIBUTING.md rename to CONTRIBUTING.md index 2cb5a0ac..b1b005ec 100644 --- a/.github/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,9 +29,6 @@ Ideally, a bug report should include a pull request with failing specs. [gist]: https://gist.github.com/ ## Submitting a Pull Request - -**WE DO NOT ACCEPT NEW FEATURES FOR THE V3 BRANCH ANYMORE** - 1. [Fork the repository.][fork] 2. Create a topic [branch]. `git checkout -b local_topic_branch` 3. Add specs for your unimplemented feature or bug fix. diff --git a/Gemfile b/Gemfile index db4043a0..27c59bf3 100644 --- a/Gemfile +++ b/Gemfile @@ -1,52 +1,42 @@ source 'https://rubygems.org' # Build and doc tools -gem 'rake', '~> 10.3', require: false -gem 'yard', '~> 0.8', require: false +gem 'rake', '~> 10.0.3', require: false +gem 'yard', '~> 0.8.0', require: false # Test tools -gem 'byebug' -gem 'aruba', '~> 0.7.4', require: false -gem 'rspec', '~> 3.0', require: false -gem 'cucumber', '~> 2.0', require: false -gem 'addressable', '~> 2.4.0', require: false - -# Pry tools -gem 'pry' -gem 'pry-stack_explorer' -gem 'pry-rescue' +gem 'cucumber', '~> 1.3.1' +gem 'fivemat', '~> 1.2.1' +gem 'aruba', '~> 0.5.1' +gem 'rspec', '~> 2.12' +gem 'simplecov' # Optional middleman dependencies, included for tests -gem 'haml', '>= 4.0.5', require: false -gem 'sassc', '~> 1.8', require: false -gem 'coffee-script', '~> 2.2', require: false -gem 'kramdown', '~> 1.2', require: false -gem 'slim', '>= 2.0', require: false -gem 'liquid', '>= 2.6', require: false -gem 'stylus', '>= 1.0', require: false -gem 'sinatra', '>= 2.0.0.beta2', require: false -gem 'redcarpet', '>= 3.1', require: false +gem 'haml', '~> 4.0.0', require: false # Make sure to use Haml 4 for tests +gem 'sinatra', require: false +gem 'slim', require: false +gem 'liquid', require: false +gem 'less', '~> 2.3.0', require: false +gem 'stylus', require: false -# Dns server to test preview server -gem 'rubydns', '~> 1.0.1', require: false +platforms :ruby do + gem 'therubyracer' + gem 'redcarpet', '~> 3.1' + gem 'pry', require: false, group: :development +end -# To test javascript -gem 'poltergeist', '~> 1.8', require: false -gem 'phantomjs', '~> 2.1.1.0', require: false - -# For less, note there is no compatible JS runtime for windows -gem 'therubyrhino', '>= 2.0', platforms: :jruby -gem 'therubyracer', '>= 0.12', platforms: :ruby +platforms :jruby do + gem 'therubyrhino' +end # Code Quality -gem 'rubocop', '~> 0.24', require: false -gem 'simplecov', '~> 0.10', require: false -gem 'coveralls', '~> 0.8', require: false -gem 'codeclimate-test-reporter', '~> 0.3', require: false, group: :test +gem 'cane', platforms: [:mri_19, :mri_20], require: false +gem 'coveralls', require: false +gem 'rubocop', require: false, group: :development # Middleman itself -gem 'middleman-cli', path: 'middleman-cli' gem 'middleman-core', path: 'middleman-core' - -# gem 'middleman-compass', github: 'middleman/middleman-compass', require: false -# gem 'middleman-sprockets', github: 'middleman/middleman-sprockets', require: false +gem 'middleman-cli', path: 'middleman-cli' +gem 'middleman-templates', path: 'middleman-templates' +gem 'middleman-sprockets', github: 'middleman/middleman-sprockets', require: false +gem 'middleman', path: 'middleman' diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md deleted file mode 100644 index 6d2dc0e0..00000000 --- a/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,9 +0,0 @@ -## Expected behavior and actual behavior - -## Steps to reproduce the problem (from a clean middleman installation) - -## Additional information - -- Ruby version: -- Middleman version: -- OS version: diff --git a/README.md b/README.md index df4497f7..d1ea8f67 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ # Middleman - Makes developing websites simple -[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/middleman/middleman?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - **Middleman** is a static site generator using all the shortcuts and tools in modern web development. Check out [middlemanapp.com](http://middlemanapp.com/) for detailed tutorials, including a [getting started guide](http://middlemanapp.com/basics/getting-started/). You can also follow [@middlemanapp](https://twitter.com/middlemanapp) for updates. ## Why Middleman? @@ -10,7 +8,7 @@ The last few years have seen an explosion in the amount and variety of tools dev * [Sass](http://sass-lang.com/) for DRY stylesheets * [CoffeeScript](http://coffeescript.org/) for safer and less verbose javascript -* Multiple asset management solutions, including [Sprockets](https://github.com/rails/sprockets) +* Multiple asset management solutions, including [Sprockets](https://github.com/sstephenson/sprockets) * [ERb](http://ruby-doc.org/stdlib-2.0.0/libdoc/erb/rdoc/ERB.html) & [Haml](http://haml.info/) for dynamic pages and simplified HTML syntax **Middleman** gives the stand-alone developer access to all these tools and many, many more. Why would you use a stand-alone framework instead of Ruby on Rails? @@ -19,7 +17,7 @@ These days, many websites are built with an API in mind. Rather than package the ## Installation -Middleman is built on Ruby and uses the RubyGems package manager for installation. These are usually pre-installed on Mac OS X and Linux. Windows users can install both using [RubyInstaller]. For windows [RubyInstaller-Devkit] is also required. +Middleman is built on Ruby and uses the RubyGems package manager for installation. These are usually pre-installed on Mac OS X and Linux. Windows users can install both using [RubyInstaller]. ``` gem install middleman @@ -64,13 +62,11 @@ Additionally, up-to-date generated code documentation is available on [RubyDoc]. ## Build & Dependency Status -[![Gem Version](http://img.shields.io/gem/v/middleman.svg?style=flat)][gem] -[![License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)][license] -[![Dependency Status](http://img.shields.io/gemnasium/middleman/middleman.svg?style=flat)][gemnasium] -[![Build Status](http://img.shields.io/travis/middleman/middleman.svg?style=flat)][travis] -[![Code Coverage](http://img.shields.io/coveralls/middleman/middleman.svg?style=flat)][coveralls] -[![Code Quality](http://img.shields.io/codeclimate/github/middleman/middleman.svg?style=flat)][codeclimate] -[![Gittip](http://img.shields.io/gittip/middleman.svg?style=flat)][gittip] +[![Gem Version](http://img.shields.io/gem/v/middleman.svg)][gem] +[![Build Status](http://img.shields.io/travis/middleman/middleman.svg)][travis] +[![Code Coverage](http://img.shields.io/coveralls/middleman/middleman.svg)][coveralls] +[![Dependency Status](http://img.shields.io/gemnasium/middleman/middleman.svg)][gemnasium] +[![Code Quality](http://img.shields.io/codeclimate/github/middleman/middleman.svg)][codeclimate] ## Community @@ -91,27 +87,11 @@ The best way to get quick responses to your issues and swift fixes to your bugs ## Donate -[Click here to lend your support to Middleman](https://plasso.co/s/4dXbHBorC3) - -## Versioning - -This library aims to adhere to [Semantic Versioning 2.0.0][semver]. Violations -of this scheme should be reported as bugs. Specifically, if a minor or patch -version is released that breaks backward compatibility, that version should be -immediately yanked and/or a new version should be immediately released that -restores compatibility. Breaking changes to the public API will only be -introduced with new major versions. As a result of this policy, you can (and -should) specify a dependency on this gem using the [Pessimistic Version -Constraint][pvc] with two digits of precision. For example: - - spec.add_dependency 'middleman-core', '~> 4.0' - -[semver]: http://semver.org/ -[pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint +[Click here to lend your support to Middleman](https://spacebox.io/s/4dXbHBorC3) ## License -Copyright (c) 2010-2015 Thomas Reynolds. MIT Licensed, see [LICENSE] for details. +Copyright (c) 2010-2014 Thomas Reynolds. MIT Licensed, see [LICENSE] for details. [middleman]: http://middlemanapp.com [gem]: https://rubygems.org/gems/middleman @@ -119,8 +99,6 @@ Copyright (c) 2010-2015 Thomas Reynolds. MIT Licensed, see [LICENSE] for details [coveralls]: https://coveralls.io/r/middleman/middleman [gemnasium]: https://gemnasium.com/middleman/middleman [codeclimate]: https://codeclimate.com/github/middleman/middleman -[gittip]: https://www.gittip.com/middleman/ [rubyinstaller]: http://rubyinstaller.org/ -[RubyInstaller-Devkit]: http://rubyinstaller.org/add-ons/devkit/ [rubydoc]: http://rubydoc.info/github/middleman/middleman [LICENSE]: https://github.com/middleman/middleman/blob/master/LICENSE.md diff --git a/Rakefile b/Rakefile index 508c3a1d..4c71d31e 100644 --- a/Rakefile +++ b/Rakefile @@ -1,66 +1,118 @@ +require 'rubygems' unless defined?(Gem) +# require 'fileutils' unless defined?(FileUtils) require 'rake' require File.expand_path('../middleman-core/lib/middleman-core/version.rb', __FILE__) ROOT = File.expand_path(File.dirname(__FILE__)) -GEM_NAME = 'middleman'.freeze +GEM_NAME = 'middleman' -middleman_gems = %w(middleman-core middleman-cli middleman) +middleman_gems = %w(middleman-core middleman-templates middleman-cli middleman) GEM_PATHS = middleman_gems.freeze def sh_rake(command) - sh "#{Gem.ruby} -S rake #{command}", verbose: true + sh "#{Gem.ruby} -S rake #{command}", :verbose => true +end + +def say(text, color=:magenta) + n = { :bold => 1, :red => 31, :green => 32, :yellow => 33, :blue => 34, :magenta => 35 }.fetch(color, 0) + puts "\e[%dm%s\e[0m" % [n, text] +end + +desc "Run 'install' for all projects" +task :install do + GEM_PATHS.each do |dir| + Dir.chdir(dir) { sh_rake(:install) } + end +end + +desc 'Clean pkg and other stuff' +task :clean do + GEM_PATHS.each do |g| + %w[tmp pkg coverage].each { |dir| sh 'rm -rf %s' % File.join(g, dir) } + end +end + +desc 'Clean pkg and other stuff' +task :uninstall do + sh 'gem search --no-version middleman | grep middleman | xargs gem uninstall -a' end desc 'Displays the current version' task :version do - puts "Current version: #{Middleman::VERSION}" + say "Current version: #{Middleman::VERSION}" end +desc 'Bumps the version number based on given version' +task :bump, [:version] do |t, args| + raise 'Please specify version=x.x.x !' unless args.version + version_path = File.dirname(__FILE__) + '/middleman-core/lib/middleman-core/version.rb' + version_text = File.read(version_path).sub(/VERSION = '[\d\.\w]+'/, "VERSION = '#{args.version}'") + say "Updating Middleman to version #{args.version}" + File.open(version_path, 'w') { |f| f.write version_text } + sh 'git commit -a -m "Bumped version to %s"' % args.version +end + +desc 'Executes a fresh install removing all middleman version and then reinstall all gems' +task :fresh => [:uninstall, :install, :clean] + desc 'Pushes repository to GitHub' task :push do - puts 'Pushing to github...' + say 'Pushing to github...' sh "git tag v#{Middleman::VERSION}" - sh 'git push' + sh 'git push origin master' sh "git push origin v#{Middleman::VERSION}" end desc 'Release all middleman gems' -task publish: :push do - puts 'Pushing to rubygems...' +task :publish => :push do + say 'Pushing to rubygems...' GEM_PATHS.each do |dir| Dir.chdir(dir) { sh_rake('release') } end + Rake::Task['clean'].invoke end desc 'Generate documentation for all middleman gems' task :doc do GEM_PATHS.each do |g| - Dir.chdir(File.join(ROOT, g).to_s) { sh "#{Gem.ruby} -S rake yard" } + Dir.chdir("#{File.join(ROOT, g)}") { sh "#{Gem.ruby} -S rake yard" } end end desc 'Run tests for all middleman gems' task :test do - Rake::Task['rubocop'].invoke - GEM_PATHS.each do |g| - Dir.chdir(File.join(ROOT, g).to_s) { sh "#{Gem.ruby} -S rake test" } + Dir.chdir("#{File.join(ROOT, g)}") { sh "#{Gem.ruby} -S rake test" } end end desc 'Run specs for all middleman gems' task :spec do GEM_PATHS.each do |g| - Dir.chdir(File.join(ROOT, g).to_s) { sh "#{Gem.ruby} -S rake spec" } + Dir.chdir("#{File.join(ROOT, g)}") { sh "#{Gem.ruby} -S rake spec" } end end -require 'rubocop/rake_task' -desc 'Run RuboCop to check code consistency' -RuboCop::RakeTask.new(:rubocop) do |task| - task.fail_on_error = false +begin + require 'cane/rake_task' + desc 'Run cane to check quality metrics' + Cane::RakeTask.new(:quality) do |cane| + cane.no_style = true + cane.no_doc = true + cane.abc_glob = 'middleman*/lib/middleman*/**/*.rb' + end +rescue LoadError +end + +begin + require 'rubocop/rake_task' + desc 'Run RuboCop to check code consistency' + Rubocop::RakeTask.new(:rubocop) do |task| + task.fail_on_error = false + end +rescue LoadError end desc 'Run tests for all middleman gems' -task default: :test +task :default => :test diff --git a/gem_rake_helper.rb b/gem_rake_helper.rb index ea46e6a7..d6e78861 100644 --- a/gem_rake_helper.rb +++ b/gem_rake_helper.rb @@ -1,3 +1,4 @@ +require 'rubygems' unless defined?(Gem) require 'rake' require 'yard' @@ -18,28 +19,27 @@ Cucumber::Rake::Task.new do |t| exempt_tags = ['--tags ~@wip'] exempt_tags << '--tags ~@nojava' if RUBY_PLATFORM == 'java' exempt_tags << '--tags ~@encoding' unless Object.const_defined?(:Encoding) - exempt_tags << '--tags ~@nowindows' if Gem.win_platform? exempt_tags << '--tags ~@travishatesme' if ENV['TRAVIS'] == 'true' - t.cucumber_opts = "--require features --color #{exempt_tags.join(' ')} --strict" # --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}" + t.cucumber_opts = "--color #{exempt_tags.join(" ")} --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}" end Cucumber::Rake::Task.new(:cucumber_wip) do |t| exempt_tags = ['--tags @wip'] + exempt_tags << '--tags ~@nojava' if RUBY_PLATFORM == 'java' exempt_tags << '--tags ~@encoding' unless Object.const_defined?(:Encoding) - exempt_tags << '--tags ~@nowindows' if Gem.win_platform? - t.cucumber_opts = "--require features --color #{exempt_tags.join(' ')} --strict" # --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}" + t.cucumber_opts = "--color #{exempt_tags.join(" ")} --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}" end require 'rspec/core/rake_task' desc 'Run RSpec' RSpec::Core::RakeTask.new do |spec| spec.pattern = 'spec/**/*_spec.rb' - spec.rspec_opts = ['--color', '--format documentation'] + spec.rspec_opts = ['--color', '--format nested'] end desc 'Run tests, both RSpec and Cucumber' -task test: [:spec, :cucumber] +task :test => [:spec, :cucumber] YARD::Rake::YardocTask.new -task default: :test +task :default => :test diff --git a/middleman-cli/.yardopts b/middleman-cli/.yardopts index b816052e..47ae041b 100644 --- a/middleman-cli/.yardopts +++ b/middleman-cli/.yardopts @@ -5,5 +5,4 @@ lib/**/*.rb --exclude lib/middleman-cli/templates/shared/ --exclude lib/middleman-cli/templates/extension/ --no-private ---hide-void-return ---markup=markdown \ No newline at end of file +--hide-void-return \ No newline at end of file diff --git a/middleman-cli/Rakefile b/middleman-cli/Rakefile index db0d1cb8..a7cd6621 100644 --- a/middleman-cli/Rakefile +++ b/middleman-cli/Rakefile @@ -1,4 +1,4 @@ # coding:utf-8 -RAKE_ROOT = __FILE__.freeze -GEM_NAME = 'middleman-cli'.freeze +RAKE_ROOT = __FILE__ +GEM_NAME = 'middleman-cli' require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper') diff --git a/middleman-cli/bin/middleman b/middleman-cli/bin/middleman index 8b381a08..924f905d 100755 --- a/middleman-cli/bin/middleman +++ b/middleman-cli/bin/middleman @@ -4,67 +4,15 @@ require 'middleman-core/profiling' if ARGV.include? '--profile' Middleman::Profiling.profiler = Middleman::Profiling::RubyProfProfiler.new end -# Middleman::Profiling.start +Middleman::Profiling.start require "middleman-core/load_paths" Middleman.setup_load_paths -require 'dotenv' -::Dotenv.load - -require 'middleman-core' -require 'middleman-core/logger' - -module Middleman::Cli - class << self - attr_accessor :config - end - - def self.import_config(base) - ::Middleman::Cli.config.all_settings.each do |setting| - if setting.default.is_a?(String) || setting.default.is_a?(NilClass) - base.class_option setting.key, - type: :string, - desc: setting.description - elsif setting.default.is_a?(TrueClass) || setting.default.is_a?(FalseClass) - base.class_option setting.key, - type: :boolean, - desc: setting.description - end - end - end -end - require "middleman-cli" # Change directory to the root Dir.chdir(ENV["MM_ROOT"]) if ENV["MM_ROOT"] -# Default command is server -if ARGV[0] != 'help' && (ARGV.length < 1 || ARGV.first.include?('-')) - ARGV.unshift('server') -end - -::Middleman::Logger.singleton(3) -::Middleman::Cli.config = ::Middleman::Application.new do - # - config[:environment] = (ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development').to_sym - config[:mode] = :config - config[:exit_before_ready] = true - config[:watcher_disable] = true - config[:disable_sitemap] = true -end.config - -# Require the Middleman version -require 'middleman-core/version' - -# Include the core CLI items -require 'middleman-cli/init' -require 'middleman-cli/extension' -require 'middleman-cli/server' -require 'middleman-cli/build' -require 'middleman-cli/console' -require 'middleman-cli/config' - # Start the CLI -Middleman::Cli::Base.start(ARGV) +Middleman::Cli::Base.start diff --git a/middleman-core/fixtures/ember-cli-app/test-app/app/components/.gitkeep b/middleman-cli/features/.gitkeep similarity index 100% rename from middleman-core/fixtures/ember-cli-app/test-app/app/components/.gitkeep rename to middleman-cli/features/.gitkeep diff --git a/middleman-cli/features/cli_init.feature b/middleman-cli/features/cli_init.feature deleted file mode 100644 index 96595422..00000000 --- a/middleman-cli/features/cli_init.feature +++ /dev/null @@ -1,93 +0,0 @@ -Feature: Middleman CLI - - Scenario: Create a new project - When I run `middleman init MY_PROJECT` interactively - And I type "y" - And I type "y" - And I type "y" - And I type "y" - Then the exit status should be 0 - When I cd to "MY_PROJECT" - Then the following files should exist: - | Gemfile | - | .gitignore | - | config.rb | - | source/index.html.erb | - | source/layouts/layout.erb | - | source/javascripts/all.js | - | source/stylesheets/site.css.scss | - | source/stylesheets/_normalize.scss | - - Scenario: Create a new project in the current directory - Given a directory named "MY_PROJECT" - When I cd to "MY_PROJECT" - And I run `middleman init` interactively - And I type "y" - And I type "y" - And I type "y" - And I type "y" - Then the exit status should be 0 - And the following files should exist: - | Gemfile | - | config.rb | - | source/index.html.erb | - - Scenario: Create a new project (alias i) - When I run `middleman i MY_PROJECT` interactively - And I type "y" - And I type "y" - And I type "y" - And I type "y" - Then a directory named "MY_PROJECT" should exist - - Scenario: Create a new project (alias new) - When I run `middleman new MY_PROJECT` interactively - And I type "y" - And I type "y" - And I type "y" - And I type "y" - Then a directory named "MY_PROJECT" should exist - - Scenario: Create a new project (alias n) - When I run `middleman n MY_PROJECT` interactively - And I type "y" - And I type "y" - And I type "y" - And I type "y" - Then a directory named "MY_PROJECT" should exist - - Scenario: Create a new project using Middleman directory - When I run `middleman init MY_PROJECT -T blog` - Then a directory named "MY_PROJECT" should exist - When I cd to "MY_PROJECT" - And the file "Gemfile" should contain "middleman-blog" - And the file ".gitignore" should exist - - Scenario: Create an invalid project using Middleman directory - When I run `middleman init MY_PROJECT -T does-not-exist-for-reals` - Then the exit status should be 1 - - Scenario: Create a new project using github(user/repository) - When I run `middleman init MY_PROJECT -T middleman/middleman-templates-default` interactively - And I type "y" - And I type "y" - And I type "y" - And I type "y" - Then a directory named "MY_PROJECT" should exist - - Scenario: Create a new project using github(user/repository#branch) - When I run `middleman init MY_PROJECT -T middleman/middleman-templates-default#master` interactively - And I type "y" - And I type "y" - And I type "y" - And I type "y" - Then a directory named "MY_PROJECT" should exist - And the output should contain "-b master" - - Scenario: Create a new project using full path(://) - When I run `middleman init MY_PROJECT -T https://github.com/middleman/middleman-templates-default.git` interactively - And I type "y" - And I type "y" - And I type "y" - And I type "y" - Then a directory named "MY_PROJECT" should exist diff --git a/middleman-cli/features/preview_server-hook.feature b/middleman-cli/features/preview_server-hook.feature deleted file mode 100644 index 15f6cba0..00000000 --- a/middleman-cli/features/preview_server-hook.feature +++ /dev/null @@ -1,17 +0,0 @@ -Feature: Run preview server before hook - - Scenario: When run - Given a fixture app "preview-server-hook-app" - And the default aruba timeout is 30 seconds - When I run `middleman server --server-name localhost --bind-address 127.0.0.1` interactively - And I stop middleman if the output contains: - """ - ### END ### - """ - Then the output should contain: - """ - /// 127.0.0.1:4567 /// - /// 4567 /// - /// localhost /// - /// http://localhost:4567 /// - """ diff --git a/middleman-cli/features/preview_server.feature b/middleman-cli/features/preview_server.feature deleted file mode 100644 index 94ecc5b2..00000000 --- a/middleman-cli/features/preview_server.feature +++ /dev/null @@ -1,536 +0,0 @@ -Feature: Run the preview server - - As a software developer - I want to start the preview server - In order to view my changes immediately in the browser - - Background: - Given a fixture app "preview-server-app" - And the default aruba timeout is 30 seconds - - Scenario: Start the server with defaults - When I run `middleman server` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - And the output should contain: - """ - View your site at "http:// - """ - And the output should contain: - """ - Inspect your site configuration at "http:// - """ - - Scenario: Start the server with defaults in verbose mode - When I run `middleman server --verbose` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to ":::4567", "0.0.0.0:4567" - """ - And the output should contain: - """ - View your site at "http:// - """ - And the output should contain: - """ - Inspect your site configuration at "http:// - """ - - @wip - Scenario: Start the server with defaults in verbose mode, when a local mdns server resolves the local hostname - Given I start a mdns server for the local hostname - When I run `middleman server --verbose` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to ":::4567", "0.0.0.0:4567" - """ - And the output should contain: - """ - View your site at "http:// - """ - And the output should contain: - """ - Inspect your site configuration at "http:// - """ - - Scenario: Start the server with bind address 127.0.0.1 - Given I have a local hosts file with: - """ - # - 127.0.0.1 localhost.localdomain localhost - """ - When I run `middleman server --verbose --bind-address 127.0.0.1` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to "127.0.0.1:4567" - """ - And the output should contain: - """ - View your site at "http://127.0.0.1:4567" - """ - And the output should contain: - """ - Inspect your site configuration at "http://127.0.0.1:4567/__middleman" - """ - - Scenario: Start the server with bind address 127.0.0.1 configured via config.rb - Given I have a local hosts file with: - """ - # - 127.0.0.1 localhost.localdomain localhost - """ - And a file named "config.rb" with: - """ - set :bind_address, '127.0.0.1' - """ - When I run `middleman server --verbose` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to "127.0.0.1:4567" - """ - And the output should contain: - """ - View your site at "http://127.0.0.1:4567" - """ - And the output should contain: - """ - Inspect your site configuration at "http://127.0.0.1:4567/__middleman" - """ - - @wip - Scenario: Start the server with bind address 127.0.0.5 - - This will have no hostname attached because the hosts file, the DNS server - and the MDNS-server do not know anything about 127.0.0.5 - - When I run `middleman server --verbose --bind-address 127.0.0.5` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to "127.0.0.5:4567" - """ - And the output should contain: - """ - View your site at "http://127.0.0.5:4567" - """ - And the output should contain: - """ - Inspect your site configuration at "http://127.0.0.5:4567/__middleman" - """ - - Scenario: Start the server with bind address ::1 - Given a file named ".hosts" with: - """ - # - ::1 localhost.localdomain localhost - """ - When I run `middleman server --verbose --bind-address ::1` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to "::1:4567" - """ - And the output should contain: - """ - View your site at "http://[::1]:4567" - """ - And the output should contain: - """ - Inspect your site configuration at "http://[::1]:4567/__middleman" - """ - - Scenario: Start the server with bind address 0.0.0.0 - When I run `middleman server --verbose --bind-address 0.0.0.0` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to "0.0.0.0:4567" - """ - And the output should contain: - """ - View your site at "http:// - """ - And the output should contain: - """ - Inspect your site configuration at "http:// - """ - - Scenario: Start the server with bind address :: - When I run `middleman server --verbose --bind-address ::` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to ":::4567" - """ - And the output should contain: - """ - View your site at "http:// - """ - And the output should contain: - """ - Inspect your site configuration at "http:// - """ - - Scenario: Start the server with server name "localhost" - Given I have a local hosts file with: - """ - # - 127.0.0.1 localhost.localdomain localhost - """ - When I run `middleman server --verbose --server-name localhost` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to "127.0.0.1:4567" - """ - And the output should contain: - """ - View your site at "http://localhost:4567", "http://127.0.0.1:4567" - """ - And the output should contain: - """ - Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman" - """ - - Scenario: Start the server with server name "localhost" configured via config.rb - Given I have a local hosts file with: - """ - # - 127.0.0.1 localhost.localdomain localhost - """ - And a file named "config.rb" with: - """ - set :server_name, 'localhost' - """ - When I run `middleman server --verbose` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to "127.0.0.1:4567" - """ - And the output should contain: - """ - View your site at "http://localhost:4567", "http://127.0.0.1:4567" - """ - And the output should contain: - """ - Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman" - """ - - Scenario: Start the server with server name "localhost" and bind address "127.0.0.1" - Given I have a local hosts file with: - """ - # - 127.0.0.1 localhost.localdomain localhost - """ - When I run `middleman server --verbose --server-name localhost --bind-address 127.0.0.1` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to "127.0.0.1:4567" - """ - And the output should contain: - """ - View your site at "http://localhost:4567", "http://127.0.0.1:4567" - """ - And the output should contain: - """ - Inspect your site configuration at "http://localhost:4567/__middleman", "http://127.0.0.1:4567/__middleman" - """ - - Scenario: Start the server with server name "127.0.0.1" - When I run `middleman server --verbose --server-name 127.0.0.1` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to "127.0.0.1:4567" - """ - And the output should contain: - """ - View your site at "http://127.0.0.1:4567" - """ - And the output should contain: - """ - Inspect your site configuration at "http://127.0.0.1:4567/__middleman" - """ - - Scenario: Start the server with server name "::1" - When I run `middleman server --verbose --server-name ::1` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to "::1:4567" - """ - And the output should contain: - """ - View your site at "http://[::1]:4567" - """ - And the output should contain: - """ - Inspect your site configuration at "http://[::1]:4567/__middleman" - """ - - Scenario: Start the server with https - When I run `middleman server --verbose --https` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to ":::4567", "0.0.0.0:4567" - """ - And the output should contain: - """ - View your site at "https:// - """ - And the output should contain: - """ - Inspect your site configuration at "https:// - """ - - Scenario: Start the server with port 65432 - When I run `middleman server --verbose --port 65432` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to ":::65432", "0.0.0.0:65432" - """ - - Scenario: Start the server with port 65432 configured via config.rb - Given a file named "config.rb" with: - """ - set :port, 65432 - """ - When I run `middleman server --verbose` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to ":::65432", "0.0.0.0:65432" - """ - - @wip - Scenario: Start the server when port is blocked by other middleman instance - Given `middleman server` is running in background - When I run `middleman server --verbose` interactively - And I stop all commands if the output of the last command contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman uses a different port - """ - - Scenario: Start the server with bind address 1.1.1.1 - - This should fail, because "1.1.1.1" is not an interface available on this computer. - - Given a file named ".hosts" with: - """ - 1.1.1.1 www.example.com www - """ - When I run `middleman server --verbose --bind-address 1.1.1.1` interactively - And I stop middleman if the output contains: - """ - Running Middleman failed: - """ - Then the output should contain: - """ - Bind address "1.1.1.1" is not available on your system - """ - - Scenario: Start the server with server name www.example.com and bind address 0.0.0.0 - - This should fail, because the user can just use `--server-name`. It does - not make sense for `middleman` to only listen on `0.0.0.0` (IPv4 all - interfaces), but not on `::` (IPv6 all interfaces). There are other tools - like `iptables` (Linux-only) or better some `kernel`-configurations to make - this possible. - - When I run `middleman server --verbose --server-name www.example.com --bind-address 0.0.0.0` interactively - And I stop middleman if the output contains: - """ - Running Middleman failed: - """ - Then the output should contain: - """ - Undefined combination of options "--server-name" and "--bind-address". - """ - - Scenario: Start the server with server name "www.example.com" and bind address "127.0.0.1" - - This should fail because the server name does not resolve to the ip address. - - Given a file named ".hosts" with: - """ - 1.1.1.1 www.example.com www - """ - When I run `middleman server --verbose --server-name www.example.com --bind-address 127.0.0.1` interactively - And I stop middleman if the output contains: - """ - Running Middleman failed: - """ - Then the output should contain: - """ - Server name "www.example.com" does not resolve to bind address "127.0.0.1". Please fix that and try again. - """ - - Scenario: Start the server with server name "garbage.example.com" - When I run `middleman server --verbose --server-name garbage.example.com` interactively - And I stop middleman if the output contains: - """ - Running Middleman failed: - """ - Then the output should contain: - """ - Server name "garbage.example.com" does not resolve to an ip address. Please fix that and try again. - """ - - Scenario: Start the server with server name "www.example.com" and the network name server is used to resolve the server name - Given I have a local hosts file with: - """ - # empty - """ - And I start a mdns server with: - """ - # empty - """ - And I start a dns server with: - """ - www.example.com: 127.0.0.1 - """ - When I run `middleman server --verbose --server-name www.example.com` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to "127.0.0.1:4567" - """ - And the output should contain: - """ - View your site at "http://www.example.com:4567", "http://127.0.0.1:4567" - """ - And the output should contain: - """ - Inspect your site configuration at "http://www.example.com:4567/__middleman", "http://127.0.0.1:4567/__middleman" - """ - - @ruby-2.1 - @wip - Scenario: Start the server with server name "host.local" and the link local name server is used to resolve the server name - - To make the mdns resolver resolve a name, it needs to end with ".local". - Otherwise the resolver returns []. - - Given I have a local hosts file with: - """ - # empty - """ - And I start a mdns server with: - """ - host.local: 127.0.0.1 - """ - When I run `middleman server --verbose --server-name host.local` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to "127.0.0.1:4567" - """ - And the output should contain: - """ - View your site at "http://host.local:4567", "http://127.0.0.1:4567" - """ - And the output should contain: - """ - Inspect your site configuration at "http://host.local:4567/__middleman", "http://127.0.0.1:4567/__middleman" - """ - - @ruby-2.1 - @wip - Scenario: Start the server with server name "host" and the link local name server is used to resolve the server name - - To make the mdns resolver resolve a name, it needs to end with ".local". If - a plain hostname is given `middleman` appends ".local" automatically. - - Given I have a local hosts file with: - """ - # empty - """ - And I start a mdns server with: - """ - host.local: 127.0.0.1 - """ - When I run `middleman server --verbose --server-name host` interactively - And I stop middleman if the output contains: - """ - Inspect your site configuration - """ - Then the output should contain: - """ - The Middleman preview server is bound to "127.0.0.1:4567" - """ - And the output should contain: - """ - View your site at "http://host.local:4567", "http://127.0.0.1:4567" - """ - And the output should contain: - """ - Inspect your site configuration at "http://host.local:4567/__middleman", "http://127.0.0.1:4567/__middleman" - """ diff --git a/middleman-cli/features/support/env.rb b/middleman-cli/features/support/env.rb deleted file mode 100644 index 8044deab..00000000 --- a/middleman-cli/features/support/env.rb +++ /dev/null @@ -1,19 +0,0 @@ -ENV["TEST"] = "true" - -require 'sassc' - -require 'simplecov' -SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/../..')) - -require 'phantomjs/poltergeist' -Capybara.javascript_driver = :poltergeist - -require 'coveralls' -Coveralls.wear! - -require 'codeclimate-test-reporter' -CodeClimate::TestReporter.start - -PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__))) -require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-cli') -require File.join(File.dirname(PROJECT_ROOT_PATH), 'middleman-core', 'lib', 'middleman-core', 'step_definitions') diff --git a/middleman-core/fixtures/ember-cli-app/test-app/app/controllers/.gitkeep b/middleman-cli/fixtures/.gitkeep similarity index 100% rename from middleman-core/fixtures/ember-cli-app/test-app/app/controllers/.gitkeep rename to middleman-cli/fixtures/.gitkeep diff --git a/middleman-cli/fixtures/preview-server-app/bin/dns_server.rb b/middleman-cli/fixtures/preview-server-app/bin/dns_server.rb deleted file mode 100755 index f4f16455..00000000 --- a/middleman-cli/fixtures/preview-server-app/bin/dns_server.rb +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/bin/env ruby - -require 'rubydns' -require 'psych' - -db_file = ARGV[0] -port = ARGV[1] || 5300 - -db = if File.file? db_file - $stderr.puts 'Found dns db' - Psych.load_file(db_file) - else - $stderr.puts 'Found no dns db. Use default db.' - - { - /www\.example\.org/ => '1.1.1.1' - } - end - -interfaces = [ - [:udp, "127.0.0.1", port], - [:tcp, "127.0.0.1", port] -] - - -# Start the RubyDNS server -RubyDNS::run_server(listen: interfaces) do - db.each do |matcher, result| - match(matcher, Resolv::DNS::Resource::IN::A) do |transaction| - transaction.respond!(result) - end - end -end diff --git a/middleman-cli/fixtures/preview-server-app/source/index.html.erb b/middleman-cli/fixtures/preview-server-app/source/index.html.erb deleted file mode 100755 index f47aba51..00000000 --- a/middleman-cli/fixtures/preview-server-app/source/index.html.erb +++ /dev/null @@ -1 +0,0 @@ -

Welcome

\ No newline at end of file diff --git a/middleman-cli/fixtures/preview-server-app/source/layout.erb b/middleman-cli/fixtures/preview-server-app/source/layout.erb deleted file mode 100644 index b72f66e9..00000000 --- a/middleman-cli/fixtures/preview-server-app/source/layout.erb +++ /dev/null @@ -1,9 +0,0 @@ - - - My Sample Site - - - - <%= yield %> - - \ No newline at end of file diff --git a/middleman-cli/fixtures/preview-server-app/source/real.html b/middleman-cli/fixtures/preview-server-app/source/real.html deleted file mode 100644 index cb312952..00000000 --- a/middleman-cli/fixtures/preview-server-app/source/real.html +++ /dev/null @@ -1 +0,0 @@ -I am real \ No newline at end of file diff --git a/middleman-cli/fixtures/preview-server-app/source/real/index.html.erb b/middleman-cli/fixtures/preview-server-app/source/real/index.html.erb deleted file mode 100644 index 190d84ec..00000000 --- a/middleman-cli/fixtures/preview-server-app/source/real/index.html.erb +++ /dev/null @@ -1,5 +0,0 @@ ---- -layout: false ---- - -I am real: <%= @num %> \ No newline at end of file diff --git a/middleman-cli/fixtures/preview-server-app/source/should_be_ignored.html b/middleman-cli/fixtures/preview-server-app/source/should_be_ignored.html deleted file mode 100644 index fb81d5c0..00000000 --- a/middleman-cli/fixtures/preview-server-app/source/should_be_ignored.html +++ /dev/null @@ -1 +0,0 @@ -

Ignore me!

\ No newline at end of file diff --git a/middleman-cli/fixtures/preview-server-app/source/should_be_ignored2.html b/middleman-cli/fixtures/preview-server-app/source/should_be_ignored2.html deleted file mode 100644 index 0940fd7c..00000000 --- a/middleman-cli/fixtures/preview-server-app/source/should_be_ignored2.html +++ /dev/null @@ -1 +0,0 @@ -

Ignore me! 2

\ No newline at end of file diff --git a/middleman-cli/fixtures/preview-server-app/source/should_be_ignored3.html b/middleman-cli/fixtures/preview-server-app/source/should_be_ignored3.html deleted file mode 100644 index 98007c81..00000000 --- a/middleman-cli/fixtures/preview-server-app/source/should_be_ignored3.html +++ /dev/null @@ -1 +0,0 @@ -

Ignore me! 3

\ No newline at end of file diff --git a/middleman-cli/fixtures/preview-server-app/source/static.html b/middleman-cli/fixtures/preview-server-app/source/static.html deleted file mode 100755 index 7e50df4e..00000000 --- a/middleman-cli/fixtures/preview-server-app/source/static.html +++ /dev/null @@ -1 +0,0 @@ -Static, no code! \ No newline at end of file diff --git a/middleman-cli/fixtures/preview-server-hook-app/config.rb b/middleman-cli/fixtures/preview-server-hook-app/config.rb deleted file mode 100644 index 9892009e..00000000 --- a/middleman-cli/fixtures/preview-server-hook-app/config.rb +++ /dev/null @@ -1,19 +0,0 @@ -set :layout, false - -class MyFeature < Middleman::Extension - def initialize(app, options_hash = {}, &block) - super - - app.before_server do |server_information| - puts "/// #{server_information.listeners.first} ///" - puts "/// #{server_information.port} ///" - puts "/// #{server_information.server_name} ///" - puts "/// #{server_information.site_addresses.first} ///" - puts "/// ### END ### ///" - end - end -end - -::Middleman::Extensions.register(:my_feature, MyFeature) - -activate :my_feature diff --git a/middleman-cli/fixtures/preview-server-hook-app/source/index.html.erb b/middleman-cli/fixtures/preview-server-hook-app/source/index.html.erb deleted file mode 100644 index ca390d46..00000000 --- a/middleman-cli/fixtures/preview-server-hook-app/source/index.html.erb +++ /dev/null @@ -1,9 +0,0 @@ - - - - preview-server-hook-app - - -

preview-server-hook-app

- - diff --git a/middleman-cli/lib/middleman-cli.rb b/middleman-cli/lib/middleman-cli.rb index e17137e7..3ddbc72b 100644 --- a/middleman-cli/lib/middleman-cli.rb +++ b/middleman-cli/lib/middleman-cli.rb @@ -1,23 +1,96 @@ -# rubocop:disable FileName - # Setup our load paths libdir = File.expand_path(File.dirname(__FILE__)) $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) # Require Thor since that's what the whole CLI is built around require 'thor' +require 'thor/group' # CLI Module -module Middleman::Cli - # The base task from which everything else extends - class Base < ::Thor - desc 'version', 'Show version' - def version - say "Middleman #{Middleman::VERSION}" - end +module Middleman - def self.exit_on_failure? - true + module Cli + + # The base task from which everything else extends + class Base < Thor + class << self + def start(*args) + # Change flag to a module + ARGV.unshift('help') if ARGV.delete('--help') + + # Default command is server + if ARGV[0] != 'help' && (ARGV.length < 1 || ARGV.first.include?('-')) + ARGV.unshift('server') + end + + super + end + end + + desc 'version', 'Show version' + def version + say "Middleman #{Middleman::VERSION}" + end + + # Override the Thor help method to find help for subtasks + # @param [Symbol, String, nil] meth + # @param [Boolean] subcommand + # @return [void] + def help(meth = nil, subcommand = false) + if meth && !self.respond_to?(meth) + klass, task = Thor::Util.find_class_and_task_by_namespace("#{meth}:#{meth}") + klass.start(['-h', task].compact, :shell => self.shell) + else + list = [] + Thor::Util.thor_classes_in(Middleman::Cli).each do |thor_class| + list += thor_class.printable_tasks(false) + end + list.sort!{ |a,b| a[0] <=> b[0] } + + shell.say 'Tasks:' + shell.print_table(list, :ident => 2, :truncate => true) + shell.say %(\nSee 'middleman help ' for more information on specific command.) + shell.say + end + end + + # Intercept missing methods and search subtasks for them + # @param [Symbol] meth + def method_missing(meth, *args) + meth = meth.to_s + + if self.class.map.has_key?(meth) + meth = self.class.map[meth] + end + + klass, task = Thor::Util.find_class_and_task_by_namespace("#{meth}:#{meth}") + + if klass.nil? + tasks_dir = File.join(Dir.pwd, 'tasks') + + if File.exists?(tasks_dir) + Dir[File.join(tasks_dir, '**/*_task.rb')].each { |f| require f } + klass, task = Thor::Util.find_class_and_task_by_namespace("#{meth}:#{meth}") + end + end + + if klass.nil? + raise Thor::Error.new "There's no '#{meth}' command for Middleman. Try 'middleman help' for a list of commands." + else + args.unshift(task) if task + klass.start(args, :shell => self.shell) + end + end end end end + +# Require the Middleman version +require 'middleman-core/version' + +# Include the core CLI items +require 'middleman-cli/init' +require 'middleman-cli/extension' +require 'middleman-cli/server' +require 'middleman-cli/build' +require 'middleman-cli/console' diff --git a/middleman-cli/lib/middleman-cli/build.rb b/middleman-cli/lib/middleman-cli/build.rb index 9e521dde..0e5d902f 100644 --- a/middleman-cli/lib/middleman-cli/build.rb +++ b/middleman-cli/lib/middleman-cli/build.rb @@ -1,140 +1,301 @@ -require 'middleman-core/application' +require 'fileutils' +require 'set' # CLI Module module Middleman::Cli + # Alias "b" to "build" + Base.map({ 'b' => 'build' }) + # The CLI Build class - class Build < Thor::Group + class Build < Thor include Thor::Actions + attr_reader :debugging + attr_accessor :had_errors + check_unknown_options! - class_option :environment, - aliases: '-e', - default: ENV['MM_ENV'] || ENV['RACK_ENV'] || :production - class_option :clean, - type: :boolean, - default: true, - desc: 'Remove orphaned files from build (--no-clean to disable)' - class_option :parallel, - type: :boolean, - default: true, - desc: 'Output files in parallel (--no-parallel to disable)' - class_option :glob, - type: :string, - aliases: '-g', - default: nil, - desc: 'Build a subset of the project' - class_option :verbose, - type: :boolean, - default: false, - desc: 'Print debug messages' - class_option :instrument, - type: :boolean, - default: false, - desc: 'Print instrument messages' - class_option :profile, - type: :boolean, - default: false, - desc: 'Generate profiling report for the build' + namespace :build - Middleman::Cli.import_config(self) + desc 'build [options]', 'Builds the static site for deployment' + method_option :clean, + :type => :boolean, + :default => true, + :desc => 'Remove orphaned files from build (--no-clean to disable)' + method_option :glob, + :type => :string, + :aliases => '-g', + :default => nil, + :desc => 'Build a subset of the project' + method_option :verbose, + :type => :boolean, + :default => false, + :desc => 'Print debug messages' + method_option :instrument, + :type => :string, + :default => false, + :desc => 'Print instrument messages' + method_option :profile, + :type => :boolean, + :default => false, + :desc => 'Generate profiling report for the build' # Core build Thor command # @return [void] def build - unless ENV['MM_ROOT'] + if !ENV['MM_ROOT'] raise Thor::Error, 'Error: Could not find a Middleman project config, perhaps you are in the wrong folder?' end require 'middleman-core' require 'middleman-core/logger' - require 'middleman-core/builder' - require 'fileutils' - verbose = options['verbose'] ? 0 : 1 - instrument = options['instrument'] + require 'rack' + require 'rack/mock' - builder = nil - cli_options = options + require 'find' - ::Middleman::Logger.singleton(verbose, instrument) + @debugging = Middleman::Cli::Base.respond_to?(:debugging) && Middleman::Cli::Base.debugging + self.had_errors = false - ::Middleman::Util.instrument 'builder.setup' do - @app = ::Middleman::Application.new do - config[:mode] = :build - config[:show_exceptions] = false - config[:cli_options] = cli_options.each_with_object({}) do |(k, v), sum| - sum[k] = v - end + self.class.shared_instance(options['verbose'], options['instrument']) + + opts = {} + opts[:glob] = options['glob'] if options.has_key?('glob') + opts[:clean] = options['clean'] + + self.class.shared_instance.run_hook :before_build, self + + action BuildAction.new(self, opts) + + self.class.shared_instance.run_hook :after_build, self + self.class.shared_instance.config_context.execute_after_build_callbacks(self) + + if self.had_errors && !self.debugging + msg = 'There were errors during this build' + unless options['verbose'] + msg << ', re-run with `middleman build --verbose` to see the full exception.' end - - builder = Middleman::Builder.new(@app, - glob: options['glob'], - clean: options['clean'], - parallel: options['parallel']) - builder.thor = self - builder.on_build_event(&method(:on_event)) + self.shell.say msg, :red end - ::Middleman::Util.instrument 'builder.run' do - if builder.run! - clean_directories! if options['clean'] - shell.say 'Project built successfully.' - else - msg = 'There were errors during this build' - unless options['verbose'] - msg << ', re-run with `middleman build --verbose` to see the full exception.' - end - shell.say msg, :red + exit(1) if self.had_errors + end - exit(1) + # Static methods + class << self + def exit_on_failure? + true + end + + # Middleman::Application singleton + # + # @return [Middleman::Application] + def shared_instance(verbose=false, instrument=false) + @_shared_instance ||= ::Middleman::Application.server.inst do + config[:environment] = :build + ::Middleman::Logger.singleton(verbose ? 0 : 1, instrument) end end end + end - protected + # A Thor Action, modular code, which does the majority of the work. + class BuildAction < ::Thor::Actions::EmptyDirectory + attr_reader :source + attr_reader :logger - # Handles incoming events from the builder. - # @param [Symbol] event_type The type of event. - # @param [String] contents The event contents. - # @param [String] extra The extra information. + # Setup the action + # + # @param [Middleman::Cli::Build] base + # @param [Hash] config + def initialize(base, config={}) + @app = base.class.shared_instance + @source_dir = Pathname(@app.source_dir) + @build_dir = Pathname(@app.config[:build_dir]) + @to_clean = Set.new + + @logger = @app.logger + @rack = ::Rack::MockRequest.new(@app.class.to_rack_app) + + super(base, @build_dir, config) + end + + # Execute the action # @return [void] - def on_event(event_type, target, extra=nil) - case event_type - when :error - say_status :error, target, :red - shell.say extra, :red if options['verbose'] - when :deleted - say_status :remove, target, :green - when :created - say_status :create, target, :green - when :identical - say_status :identical, target, :blue - when :updated - say_status :updated, target, :yellow - else - say_status event_type, extra, :blue + def invoke! + queue_current_paths if should_clean? + execute! + clean! if should_clean? + end + + protected + + # Remove files which were not built in this cycle + # @return [void] + def clean! + @to_clean.each do |f| + base.remove_file f, :force => true + end + + Dir[@build_dir.join('**', '*')].select {|d| File.directory?(d) }.each do |d| + base.remove_file d, :force => true if directory_empty? d end end - # Find empty directories in the build folder and remove them. + # Whether we should clean the build # @return [Boolean] - def clean_directories! - all_build_files = File.join(@app.config[:build_dir], '**', '*') + def should_clean? + @config[:clean] + end - empty_directories = Dir[all_build_files].select do |d| - File.directory?(d) + # Whether the given directory is empty + # @param [String, Pathname] directory + # @return [Boolean] + def directory_empty?(directory) + Pathname(directory).children.empty? + end + + # Get a list of all the file paths in the destination folder and save them + # for comparison against the files we build in this cycle + # @return [void] + def queue_current_paths + return unless File.exist?(@build_dir) + + paths = ::Middleman::Util.all_files_under(@build_dir).map(&:realpath).select(&:file?) + + @to_clean += paths.select do |path| + path.to_s !~ /\/\./ || path.to_s =~ /\.(htaccess|htpasswd)/ end - empty_directories.each do |d| - remove_file d, force: true if Pathname(d).children.empty? + if RUBY_PLATFORM =~ /darwin/ + # handle UTF-8-MAC filename on MacOS + @to_clean = @to_clean.map { |path| path.to_s.encode('UTF-8', 'UTF-8-MAC') } end end - # Add to CLI - Base.register(self, 'build', 'build [options]', 'Builds the static site for deployment') + # Actually build the app + # @return [void] + def execute! + # Sort order, images, fonts, js/css and finally everything else. + sort_order = %w(.png .jpeg .jpg .gif .bmp .svg .svgz .ico .woff .otf .ttf .eot .js .css) - # Map "b" to "build" - Base.map('b' => 'build') + # Pre-request CSS to give Compass a chance to build sprites + logger.debug '== Prerendering CSS' + + @app.sitemap.resources.select do |resource| + resource.ext == '.css' + end.each(&method(:build_resource)) + + logger.debug '== Checking for Compass sprites' + + # Double-check for compass sprites + @app.files.find_new_files((@source_dir + @app.config[:images_dir]).relative_path_from(@app.root_path)) + @app.sitemap.ensure_resource_list_updated! + + # Sort paths to be built by the above order. This is primarily so Compass can + # find files in the build folder when it needs to generate sprites for the + # css files + + logger.debug '== Building files' + + resources = @app.sitemap.resources.sort_by do |r| + sort_order.index(r.ext) || 100 + end + + if @build_dir.expand_path.relative_path_from(@source_dir).to_s =~ /\A[.\/]+\Z/ + raise ":build_dir (#{@build_dir}) cannot be a parent of :source_dir (#{@source_dir})" + end + + # Loop over all the paths and build them. + resources.reject do |resource| + resource.ext == '.css' + end.each(&method(:build_resource)) + + ::Middleman::Profiling.report('build') + end + + def build_resource(resource) + return if @config[:glob] && !File.fnmatch(@config[:glob], resource.destination_path) + + output_path = render_to_file(resource) + + if should_clean? && output_path.exist? + if RUBY_PLATFORM =~ /darwin/ + # handle UTF-8-MAC filename on MacOS + + @to_clean.delete(output_path.realpath.to_s.encode('UTF-8', 'UTF-8-MAC')) + else + @to_clean.delete(output_path.realpath) + end + end + end + + # Render a resource to a file. + # + # @param [Middleman::Sitemap::Resource] resource + # @return [Pathname] The full path of the file that was written + def render_to_file(resource) + output_file = @build_dir + resource.destination_path.gsub('%20', ' ') + + if resource.binary? + if !output_file.exist? + base.say_status :create, output_file, :green + elsif FileUtils.compare_file(resource.source_file, output_file) + base.say_status :identical, output_file, :blue + return output_file + else + base.say_status :update, output_file, :yellow + end + + output_file.dirname.mkpath + FileUtils.cp(resource.source_file, output_file) + else + begin + response = @rack.get(URI.escape(resource.request_path)) + + if response.status == 200 + base.create_file(output_file, binary_encode(response.body)) + else + handle_error(output_file, response.body) + end + rescue => e + handle_error(output_file, "#{e}\n#{e.backtrace.join("\n")}", e) + end + end + + output_file + end + + def handle_error(file_name, response, e=Thor::Error.new(response)) + base.had_errors = true + + base.say_status :error, file_name, :red + if base.debugging + raise e + exit(1) + elsif base.options['verbose'] + base.shell.say response, :red + end + end + + def binary_encode(string) + if string.respond_to?(:force_encoding) + string.force_encoding('ascii-8bit') + end + string + end + end +end + +# Quiet down create file +class ::Thor::Actions::CreateFile + def on_conflict_behavior(&block) + if identical? + say_status :identical, :blue + else + say_status :update, :yellow + block.call unless pretend? + end end end diff --git a/middleman-cli/lib/middleman-cli/config.rb b/middleman-cli/lib/middleman-cli/config.rb deleted file mode 100644 index add8730a..00000000 --- a/middleman-cli/lib/middleman-cli/config.rb +++ /dev/null @@ -1,41 +0,0 @@ -# CLI Module -module Middleman::Cli - # The CLI Config class - class Config < Thor::Group - include Thor::Actions - - check_unknown_options! - - class_option :environment, - aliases: '-e', - default: ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development', - desc: 'The environment Middleman will run under' - def console - require 'json' - require 'middleman-core' - require 'middleman-core/logger' - - opts = { - environment: options['environment'] - } - - # Don't output info messages - ::Middleman::Logger.singleton(2, false) - - app = ::Middleman::Application.new do - config[:mode] = :config - config[:disable_sitemap] = true - config[:watcher_disable] = true - config[:exit_before_ready] = true - config[:environment] = opts[:environment].to_sym if opts[:environment] - end - - puts JSON.pretty_generate(app.config.to_h) - - app.shutdown! - end - - # Add to CLI - Base.register(self, 'config', 'config [options]', 'Output a Middleman configuration in JSON format') - end -end diff --git a/middleman-cli/lib/middleman-cli/console.rb b/middleman-cli/lib/middleman-cli/console.rb index 4e267539..a165b835 100644 --- a/middleman-cli/lib/middleman-cli/console.rb +++ b/middleman-cli/lib/middleman-cli/console.rb @@ -1,51 +1,48 @@ # CLI Module module Middleman::Cli + # Alias "c" to "console" + Base.map({ 'c' => 'console' }) + # The CLI Console class - class Console < Thor::Group + class Console < Thor include Thor::Actions check_unknown_options! - class_option :environment, - aliases: '-e', - default: ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development', - desc: 'The environment Middleman will run under' - class_option :verbose, - type: :boolean, - default: false, - desc: 'Print debug messages' + namespace :console + + desc 'console [options]', 'Start an interactive console in the context of your Middleman application' + method_option :environment, + :aliases => '-e', + :default => ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development', + :desc => 'The environment Middleman will run under' + method_option :verbose, + :type => :boolean, + :default => false, + :desc => 'Print debug messages' def console require 'middleman-core' require 'irb' opts = { - environment: options['environment'], - debug: options['verbose'] + :environment => options['environment'], + :debug => options['verbose'] } - @app = ::Middleman::Application.new do - config[:environment] = opts[:environment].to_sym if opts[:environment] + @app =::Middleman::Application.server.inst do + if opts[:environment] + config[:environment] = opts[:environment].to_sym + end ::Middleman::Logger.singleton(opts[:debug] ? 0 : 1, opts[:instrumenting] || false) end - self.class.interact_with @app - end + # TODO: get file watcher / reload! working in console - # Start an interactive console in the context of the provided object. - # @param [Object] context - # @return [void] - def self.interact_with(context) IRB.setup nil IRB.conf[:MAIN_CONTEXT] = IRB::Irb.new.context require 'irb/ext/multi-irb' - IRB.irb nil, context + IRB.irb nil, @app end - - # Add to CLI - Base.register(self, 'console', 'console [options]', 'Start an interactive console in the context of your Middleman application') - - # Map "c" to "console" - Base.map('c' => 'console') end end diff --git a/middleman-cli/lib/middleman-cli/extension.rb b/middleman-cli/lib/middleman-cli/extension.rb index 69e073fb..5d9b9de9 100644 --- a/middleman-cli/lib/middleman-cli/extension.rb +++ b/middleman-cli/lib/middleman-cli/extension.rb @@ -1,13 +1,16 @@ # CLI Module module Middleman::Cli + # A thor task for creating new projects - class Extension < Thor::Group + class Extension < Thor include Thor::Actions check_unknown_options! + namespace :extension + # Required path for the new project to be generated - argument :name, type: :string + argument :name, :type => :string # Template files are relative to this file # @return [String] @@ -15,13 +18,11 @@ module Middleman::Cli File.join(File.dirname(__FILE__), 'templates') end - class_option 'skip-git', - type: :boolean, - default: false, - desc: 'Skip Git ignores and keeps' - - # Output a .gitignore file - class_option :git, type: :boolean, default: true + desc 'extension [options]', 'Create Middleman extension scaffold NAME' + method_option 'skip-git', + :type => :boolean, + :default => false, + :desc => 'Skip Git ignores and keeps' # The extension task # @param [String] name @@ -30,13 +31,14 @@ module Middleman::Cli template 'extension/Rakefile', File.join(name, 'Rakefile') template 'extension/gemspec', File.join(name, "#{name}.gemspec") template 'extension/Gemfile', File.join(name, 'Gemfile') + template 'extension/lib/middleman_extension.rb', File.join(name, 'lib', 'middleman_extension.rb') template 'extension/lib/lib.rb', File.join(name, 'lib', "#{name}.rb") - template 'extension/lib/lib/extension.rb', File.join(name, 'lib', name, 'extension.rb') template 'extension/features/support/env.rb', File.join(name, 'features', 'support', 'env.rb') empty_directory File.join(name, 'fixtures') end - # Add to CLI - Base.register(self, 'extension', 'extension [options]', 'Create a new Middleman extension') + # Output a .gitignore file + class_option :git, :type => :boolean, :default => true + end end diff --git a/middleman-cli/lib/middleman-cli/init.rb b/middleman-cli/lib/middleman-cli/init.rb index e8e5770c..4376db2a 100644 --- a/middleman-cli/lib/middleman-cli/init.rb +++ b/middleman-cli/lib/middleman-cli/init.rb @@ -1,129 +1,63 @@ +require 'middleman-templates' + # CLI Module module Middleman::Cli + # A thor task for creating new projects - class Init < Thor::Group - include Thor::Actions - - GIT_CMD = 'git'.freeze - + class Init < Thor check_unknown_options! - argument :target, type: :string, default: '.' - - class_option 'template', - aliases: '-T', - default: 'middleman/middleman-templates-default', - desc: 'Use a project template' - - # Do not run bundle install - class_option 'skip-bundle', - type: :boolean, - aliases: '-B', - default: false, - desc: 'Skip bundle install' + namespace :init + desc 'init NAME [options]', 'Create new project NAME' + available_templates = ::Middleman::Templates.registered.keys.join(', ') + method_option 'template', + :aliases => '-T', + :default => 'default', + :desc => "Use a project template: #{available_templates}" + method_option 'css_dir', + # :default => "stylesheets", + :desc => 'The path to the css files' + method_option 'js_dir', + # :default => "javascripts", + :desc => 'The path to the javascript files' + method_option 'images_dir', + # :default => "images", + :desc => 'The path to the image files' + method_option 'rack', + :type => :boolean, + :default => false, + :desc => 'Include a config.ru file' + method_option 'skip-bundle', + :type => :boolean, + :aliases => '-B', + :default => false, + :desc => "Don't run bundle install" + method_option 'skip-git', + :type => :boolean, + :default => false, + :desc => 'Skip Git ignores and keeps' # The init task - def init - require 'fileutils' - require 'tmpdir' - - unless git_present? - msg = 'You need to install the git command line tool to initialize a new project. ' - msg << "For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git" - say msg, :red - exit 1 + # @param [String] name + def init(name = '.') + key = options[:template].to_sym + unless ::Middleman::Templates.registered.has_key?(key) + raise Thor::Error.new "Unknown project template '#{key}'" end - repo_path, repo_branch = if shortname?(options[:template]) - require 'open-uri' - require 'json' - - api = 'https://directory.middlemanapp.com/api' - uri = ::URI.parse("#{api}/#{options[:template]}.json") - - begin - data = ::JSON.parse(uri.read) - data['links']['github'] - data['links']['github'].split('#') - rescue ::OpenURI::HTTPError - say "Template `#{options[:template]}` not found in Middleman Directory." - say 'Did you mean to use a full `user/repo` path?' - exit 1 - end - else - repo_name, repo_branch = options[:template].split('#') - [repository_path(repo_name), repo_branch] - end - - dir = Dir.mktmpdir - - begin - branch_cmd = repo_branch ? "-b #{repo_branch} " : '' - - git_path = "#{branch_cmd}#{repo_path}" - run("#{GIT_CMD} clone --depth 1 #{branch_cmd}#{repo_path} #{dir}") - - unless $?.success? - say "Git clone command failed. Make sure git repository exists: #{git_path}", :red - exit 1 - end - - inside(target) do - thorfile = File.join(dir, 'Thorfile') - - if File.exist?(thorfile) - ::Thor::Util.load_thorfile(thorfile) - - invoke 'middleman:generator' - else - source_paths << dir - directory dir, '.', exclude_pattern: /\.git\/|\.gitignore$/ - end - - run('bundle install') unless ENV['TEST'] || options[:'skip-bundle'] - end - ensure - FileUtils.remove_entry(dir) if File.directory?(dir) - end + thor_group = ::Middleman::Templates.registered[key] + thor_group.new([name], options).invoke_all end - - protected - - # Copied from Bundler - def git_present? - return @git_present if defined?(@git_present) - @git_present = which(GIT_CMD) || which('git.exe') - end - - # Copied from Bundler - def which(executable) - if File.file?(executable) && File.executable?(executable) - executable - elsif ENV['PATH'] - path = ENV['PATH'].split(File::PATH_SEPARATOR).find do |p| - abs_path = File.join(p, executable) - File.file?(abs_path) && File.executable?(abs_path) - end - path && File.expand_path(executable, path) - end - end - - def shortname?(repo) - repo.split('/').length == 1 - end - - def repository_path(repo) - repo.include?('://') || repo.include?('git@') ? repo : "https://github.com/#{repo}.git" - end - - # Add to CLI - Base.register(self, 'init', 'init TARGET [options]', 'Create new project at TARGET') - - # Map "i", "new" and "n" to "init" - Base.map( - 'i' => 'init', - 'new' => 'init', - 'n' => 'init' - ) end + + def self.exit_on_failure? + true + end + + # Map "i", "new" and "n" to "init" + Base.map({ + 'i' => 'init', + 'new' => 'init', + 'n' => 'init' + }) end diff --git a/middleman-cli/lib/middleman-cli/server.rb b/middleman-cli/lib/middleman-cli/server.rb index 85e75a9f..18da26b1 100644 --- a/middleman-cli/lib/middleman-cli/server.rb +++ b/middleman-cli/lib/middleman-cli/server.rb @@ -1,62 +1,87 @@ # CLI Module module Middleman::Cli + # Server thor task - class Server < Thor::Group + class Server < Thor check_unknown_options! - class_option :environment, - aliases: '-e' - class_option :port, - aliases: '-p' - class_option :server_name, - aliases: '-s' - class_option :bind_address, - aliases: '-b' - class_option :verbose, - type: :boolean, - default: false, - desc: 'Print debug messages' - class_option :instrument, - type: :boolean, - default: false, - desc: 'Print instrument messages' - class_option :profile, - type: :boolean, - default: false, - desc: 'Generate profiling report for server startup' - class_option :daemon, - type: :boolean, - aliases: '-d', - default: false, - desc: 'Daemonize preview server' + namespace :server - Middleman::Cli.import_config(self) + desc 'server [options]', 'Start the preview server' + method_option :environment, + :aliases => '-e', + :default => ENV['MM_ENV'] || ENV['RACK_ENV'] || 'development', + :desc => 'The environment Middleman will run under' + method_option :host, + :type => :string, + :aliases => '-h', + :default => '0.0.0.0', + :desc => 'Bind to HOST address' + method_option :port, + :aliases => '-p', + :default => '4567', + :desc => 'The port Middleman will listen on' + method_option :verbose, + :type => :boolean, + :default => false, + :desc => 'Print debug messages' + method_option :instrument, + :type => :string, + :default => false, + :desc => 'Print instrument messages' + method_option :disable_watcher, + :type => :boolean, + :default => false, + :desc => 'Disable the file change and delete watcher process' + method_option :profile, + :type => :boolean, + :default => false, + :desc => 'Generate profiling report for server startup' + method_option :reload_paths, + :type => :string, + :default => false, + :desc => 'Additional paths to auto-reload when files change' + method_option :force_polling, + :type => :boolean, + :default => false, + :desc => 'Force file watcher into polling mode' + method_option :latency, + :type => :numeric, + :aliases => '-l', + :default => 0.25, + :desc => 'Set file watcher latency, in seconds' # Start the server def server require 'middleman-core' require 'middleman-core/preview_server' - unless ENV['MM_ROOT'] + if !ENV['MM_ROOT'] puts '== Could not find a Middleman project config.rb' exit end params = { - debug: options['verbose'], - instrumenting: options['instrument'], - reload_paths: options['reload_paths'], - daemon: options['daemon'] + :port => options['port'], + :host => options['host'], + :environment => options['environment'], + :debug => options['verbose'], + :instrumenting => options['instrument'], + :disable_watcher => options['disable_watcher'], + :reload_paths => options['reload_paths'], + :force_polling => options['force_polling'], + :latency => options['latency'] } puts '== The Middleman is loading' - ::Middleman::PreviewServer.start(params, options) + ::Middleman::PreviewServer.start(params) end - - # Add to CLI - Base.register(self, 'server', 'server [options]', 'Start the preview server') - - # Map "s" to "server" - Base.map('s' => 'server') end + + def self.exit_on_failure? + true + end + + # Map "s" to "server" + Base.map({ 's' => 'server' }) end diff --git a/middleman-cli/lib/middleman-cli/templates/extension/Gemfile b/middleman-cli/lib/middleman-cli/templates/extension/Gemfile index b52f3729..6959cfc1 100644 --- a/middleman-cli/lib/middleman-cli/templates/extension/Gemfile +++ b/middleman-cli/lib/middleman-cli/templates/extension/Gemfile @@ -1,6 +1,6 @@ -# If you do not have OpenSSL installed, update -# the following line to use "http://" instead -source 'https://rubygems.org' +# If you have OpenSSL installed, we recommend updating +# the following line to use "https" +source 'http://rubygems.org' # Specify your gem's dependencies in <%= name %>.gemspec gemspec @@ -13,6 +13,7 @@ end group :test do gem 'cucumber' + gem 'fivemat' gem 'aruba' gem 'rspec' -end +end \ No newline at end of file diff --git a/middleman-cli/lib/middleman-cli/templates/extension/Rakefile b/middleman-cli/lib/middleman-cli/templates/extension/Rakefile index 4c62996f..0f786f84 100644 --- a/middleman-cli/lib/middleman-cli/templates/extension/Rakefile +++ b/middleman-cli/lib/middleman-cli/templates/extension/Rakefile @@ -4,11 +4,11 @@ Bundler::GemHelper.install_tasks require 'cucumber/rake/task' Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t| - t.cucumber_opts = '--color --tags ~@wip --strict' + t.cucumber_opts = "--color --tags ~@wip --strict --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}" end require 'rake/clean' -task test: ['cucumber'] +task :test => ['cucumber'] -task default: :test +task :default => :test \ No newline at end of file diff --git a/middleman-cli/lib/middleman-cli/templates/extension/lib/lib.rb b/middleman-cli/lib/middleman-cli/templates/extension/lib/lib.rb index 48038a71..386d3d2a 100644 --- a/middleman-cli/lib/middleman-cli/templates/extension/lib/lib.rb +++ b/middleman-cli/lib/middleman-cli/templates/extension/lib/lib.rb @@ -1,6 +1,39 @@ -require "middleman-core" +# Require core library +require 'middleman-core' + +# Extension namespace +class MyExtension < ::Middleman::Extension + option :my_option, 'default', 'An example option' + + def initialize(app, options_hash={}, &block) + # Call super to build options from the options_hash + super + + # Require libraries only when activated + # require 'necessary/library' + + # set up your extension + # puts options.my_option + end + + def after_configuration + # Do something + end + + # A Sitemap Manipulator + # def manipulate_resource_list(resources) + # end + + # module do + # def a_helper + # end + # end -Middleman::Extensions.register :<%= name %> do - require "my-extension/extension" - MyExtension end + +# Register extensions which can be activated +# Make sure we have the version of Middleman we expect +# Name param may be omited, it will default to underscored +# version of class name + +# MyExtension.register(:my_extension) diff --git a/middleman-cli/lib/middleman-cli/templates/extension/lib/lib/extension.rb b/middleman-cli/lib/middleman-cli/templates/extension/lib/lib/extension.rb deleted file mode 100644 index f831386f..00000000 --- a/middleman-cli/lib/middleman-cli/templates/extension/lib/lib/extension.rb +++ /dev/null @@ -1,31 +0,0 @@ -# Require core library -require 'middleman-core' - -# Extension namespace -class MyExtension < ::Middleman::Extension - option :my_option, 'default', 'An example option' - - def initialize(app, options_hash={}, &block) - # Call super to build options from the options_hash - super - - # Require libraries only when activated - # require 'necessary/library' - - # set up your extension - # puts options.my_option - end - - def after_configuration - # Do something - end - - # A Sitemap Manipulator - # def manipulate_resource_list(resources) - # end - - # helpers do - # def a_helper - # end - # end -end diff --git a/middleman-cli/lib/middleman-cli/templates/extension/lib/middleman_extension.rb b/middleman-cli/lib/middleman-cli/templates/extension/lib/middleman_extension.rb new file mode 100644 index 00000000..6fba3c06 --- /dev/null +++ b/middleman-cli/lib/middleman-cli/templates/extension/lib/middleman_extension.rb @@ -0,0 +1 @@ +require '<%= name %>' diff --git a/middleman-cli/lib/middleman-core/cli.rb b/middleman-cli/lib/middleman-core/cli.rb deleted file mode 100644 index 19f65d52..00000000 --- a/middleman-cli/lib/middleman-core/cli.rb +++ /dev/null @@ -1,2 +0,0 @@ -# Backwards compat -require 'middleman-cli' diff --git a/middleman-cli/middleman-cli.gemspec b/middleman-cli/middleman-cli.gemspec index e9447a9c..05f5c456 100644 --- a/middleman-cli/middleman-cli.gemspec +++ b/middleman-cli/middleman-cli.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |s| s.test_files = `git ls-files -z -- {fixtures,features}/*`.split("\0") s.executable = 'middleman' s.require_path = 'lib' - s.required_ruby_version = '>= 2.2.0' + s.required_ruby_version = '>= 1.9.3' # CLI s.add_dependency('thor', ['>= 0.17.0', '< 2.0']) diff --git a/middleman-core/.rspec b/middleman-core/.rspec deleted file mode 100644 index 4e1e0d2f..00000000 --- a/middleman-core/.rspec +++ /dev/null @@ -1 +0,0 @@ ---color diff --git a/middleman-core/.yardopts b/middleman-core/.yardopts index ee16b7ac..29455a55 100644 --- a/middleman-core/.yardopts +++ b/middleman-core/.yardopts @@ -2,5 +2,4 @@ lib/**/*.rb --exclude lib/vendored-middleman-deps/ --exclude lib/middleman-core/step_definitions --no-private ---hide-void-return ---markup=markdown \ No newline at end of file +--hide-void-return \ No newline at end of file diff --git a/middleman-core/Rakefile b/middleman-core/Rakefile index 198f09ee..c36c1d35 100644 --- a/middleman-core/Rakefile +++ b/middleman-core/Rakefile @@ -1,4 +1,5 @@ # coding:utf-8 -RAKE_ROOT = __FILE__.freeze +RAKE_ROOT = __FILE__ GEM_NAME = ENV['NAME'] || 'middleman-core' +require 'rubygems' require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper') diff --git a/middleman-core/cucumber.yml b/middleman-core/cucumber.yml deleted file mode 100644 index a65d694e..00000000 --- a/middleman-core/cucumber.yml +++ /dev/null @@ -1,2 +0,0 @@ -default: --require features --tags ~@wip -wip: --require features --tags @wip diff --git a/middleman-core/features/3rd_party_cli.feature b/middleman-core/features/3rd_party_cli.feature new file mode 100644 index 00000000..71e6a009 --- /dev/null +++ b/middleman-core/features/3rd_party_cli.feature @@ -0,0 +1,15 @@ +Feature: Allow config.rb and extensions to add CLI commands + + Scenario: Command autoloaded from tasks/ directory + Given an empty app + And a file named "tasks/hello_task.rb" with: + """ + class Hello < Thor + desc "hello", "Say hello" + def hello + puts "Hello World" + end + end + """ + When I run `middleman hello` + Then the output should contain "Hello World" \ No newline at end of file diff --git a/middleman-core/features/asset_hash.feature b/middleman-core/features/asset_hash.feature index 7c173800..936126e4 100644 --- a/middleman-core/features/asset_hash.feature +++ b/middleman-core/features/asset_hash.feature @@ -1,5 +1,5 @@ -Feature: Assets get file hashes appended to them and references to them are updated - Scenario: Hashed-asset files are produced, and HTML, CSS, JSON and JavaScript gets rewritten to reference the new files +Feature: Assets get a file hash appended to their and references to them are updated + Scenario: Hashed-asset files are produced, and HTML, CSS, and JavaScript gets rewritten to reference the new files Given a successfully built app at "asset-hash-app" When I cd to "build" Then the following files should exist: @@ -8,16 +8,12 @@ Feature: Assets get file hashes appended to them and references to them are upda | favicon.ico | | images/100px-1242c368.png | | images/100px-5fd6fb90.jpg | - | images/200px-c11eb203.jpg | - | images/300px-59adce76.jpg | | images/100px-5fd6fb90.gif | | javascripts/application-1d8d5276.js | - | stylesheets/site-8bc55985.css | + | stylesheets/site-50eaa978.css | | index.html | | subdir/index.html | | other/index.html | - | api.json | - | subdir/api.json | And the following files should not exist: | images/100px.png | | images/100px.jpg | @@ -26,150 +22,106 @@ Feature: Assets get file hashes appended to them and references to them are upda | stylesheets/site.css | And the file "javascripts/application-1d8d5276.js" should contain "img.src = '/images/100px-5fd6fb90.jpg'" - And the file "stylesheets/site-8bc55985.css" should contain: - """ - background-image: url("../images/100px-5fd6fb90.jpg") - """ + And the file "stylesheets/site-50eaa978.css" should contain "background-image: url('../images/100px-5fd6fb90.jpg')" And the file "index.html" should contain 'href="apple-touch-icon.png"' - And the file "index.html" should contain 'href="stylesheets/site-8bc55985.css"' + And the file "index.html" should contain 'href="stylesheets/site-50eaa978.css"' And the file "index.html" should contain 'src="javascripts/application-1d8d5276.js"' And the file "index.html" should contain 'src="images/100px-5fd6fb90.jpg"' - And the file "subdir/index.html" should contain 'href="../stylesheets/site-8bc55985.css"' - And the file "index.html" should contain 'srcset="images/100px-5fd6fb90.jpg 1x, images/200px-c11eb203.jpg 2x, images/300px-59adce76.jpg 3x"' - And the file "index.html" should contain 'src="images/100px-5fd6fb90.gif"' - And the file "index.html" should contain 'src="images/100px-1242c368.png"' + And the file "subdir/index.html" should contain 'href="../stylesheets/site-50eaa978.css"' And the file "subdir/index.html" should contain 'src="../javascripts/application-1d8d5276.js"' And the file "subdir/index.html" should contain 'src="../images/100px-5fd6fb90.jpg"' - And the file "other/index.html" should contain 'href="../stylesheets/site-8bc55985.css"' + And the file "other/index.html" should contain 'href="../stylesheets/site-50eaa978.css"' And the file "other/index.html" should contain 'src="../javascripts/application-1d8d5276.js"' And the file "other/index.html" should contain 'src="../images/100px-5fd6fb90.jpg"' - And the file "api.json" should contain 'images/100px-5fd6fb90.gif' - And the file "api.json" should contain 'images/100px-5fd6fb90.jpg' - And the file "api.json" should contain 'images/100px-1242c368.png' - And the file "subdir/api.json" should contain 'images/100px-5fd6fb90.gif' - And the file "subdir/api.json" should contain 'images/100px-5fd6fb90.jpg' - And the file "subdir/api.json" should contain 'images/100px-1242c368.png' - Scenario: Hashed fonts assets work with woff and woff2 extension - Given a successfully built app at "asset-hash-app" + Scenario: Keep Originals + Given a fixture app "asset-hash-app" + And a file named "config.rb" with: + """ + activate :asset_hash, :keep_original => true + """ + And a successfully built app at "asset-hash-app" When I cd to "build" Then the following files should exist: - | fonts/fontawesome-webfont-56ce13e7.woff | - | fonts/fontawesome-webfont-10752316.woff2 | - And the file "stylesheets/uses_fonts-88aa3e2b.css" should contain "src: url('../fonts/fontawesome-webfont-10752316.woff2')" - And the file "stylesheets/uses_fonts-88aa3e2b.css" should contain "url('../fonts/fontawesome-webfont-56ce13e7.woff')" + | images/100px-1242c368.png | + | images/100px-5fd6fb90.jpg | + | images/100px-5fd6fb90.gif | + | javascripts/application-1d8d5276.js | + | stylesheets/site-171eb3c0.css | + | images/100px.png | + | images/100px.jpg | + | images/100px.gif | + | javascripts/application.js | + | stylesheets/site.css | + + Scenario: Custom format + Given a fixture app "asset-hash-app" + And a file named "config.rb" with: + """ + activate :asset_hash, :format => ':basename-.-:digest.:ext' + activate :directory_indexes + """ + And a successfully built app at "asset-hash-app" + When I cd to "build" + Then the following files should exist: + | images/100px-.-1242c368.png | + | images/100px-.-5fd6fb90.jpg | + | images/100px-.-5fd6fb90.gif | + | javascripts/application-.-1d8d5276.js | + | stylesheets/site-.-171eb3c0.css | + And the following files should not exist: + | images/100px.png | + | images/100px.jpg | + | images/100px.gif | + | javascripts/application.js | + | stylesheets/site.css | + + And the file "javascripts/application-.-1d8d5276.js" should contain "img.src = '/images/100px-.-5fd6fb90.jpg'" + And the file "stylesheets/site-.-171eb3c0.css" should contain "background-image: url('/images/100px-.-5fd6fb90.jpg')" + And the file "index.html" should contain 'href="/stylesheets/site-.-171eb3c0.css"' + And the file "index.html" should contain 'src="/javascripts/application-.-1d8d5276.js"' + And the file "index.html" should contain 'src="/images/100px-.-5fd6fb90.jpg"' + And the file "subdir/index.html" should contain 'href="/stylesheets/site-.-171eb3c0.css"' + And the file "subdir/index.html" should contain 'src="/javascripts/application-.-1d8d5276.js"' + And the file "subdir/index.html" should contain 'src="/images/100px-.-5fd6fb90.jpg"' + And the file "other/index.html" should contain 'href="/stylesheets/site-.-171eb3c0.css"' + And the file "other/index.html" should contain 'src="/javascripts/application-.-1d8d5276.js"' + And the file "other/index.html" should contain 'src="/images/100px-.-5fd6fb90.jpg"' Scenario: Hashed assets work in preview server Given the Server is running at "asset-hash-app" When I go to "/" Then I should see 'href="apple-touch-icon.png"' - And I should see 'href="stylesheets/site-d1a750ca.css"' - And I should see 'href="stylesheets/fragment-99b76247.css"' + And I should see 'href="stylesheets/site-50eaa978.css"' And I should see 'src="javascripts/application-1d8d5276.js"' And I should see 'src="images/100px-5fd6fb90.jpg"' - And I should see 'srcset="images/100px-5fd6fb90.jpg 1x, images/200px-c11eb203.jpg 2x, images/300px-59adce76.jpg 3x"' - And I should see 'src="images/100px-5fd6fb90.jpg?test"' - And I should see 'src="images/100px-5fd6fb90.jpg?#test"' - And I should see 'src="images/100px-5fd6fb90.jpg#test"' When I go to "/subdir/" - Then I should see 'href="../stylesheets/site-d1a750ca.css"' + Then I should see 'href="../stylesheets/site-50eaa978.css"' And I should see 'src="../javascripts/application-1d8d5276.js"' And I should see 'src="../images/100px-5fd6fb90.jpg"' When I go to "/other/" - Then I should see 'href="../stylesheets/site-d1a750ca.css"' + Then I should see 'href="../stylesheets/site-50eaa978.css"' And I should see 'src="../javascripts/application-1d8d5276.js"' And I should see 'src="../images/100px-5fd6fb90.jpg"' - And I should see 'src="../images/100px-5fd6fb90.jpg?test"' - And I should see 'src="../images/100px-5fd6fb90.jpg?#test"' - And I should see 'src="../images/100px-5fd6fb90.jpg#test"' When I go to "/javascripts/application-1d8d5276.js" Then I should see "img.src = '/images/100px-5fd6fb90.jpg'" - When I go to "/stylesheets/site-d1a750ca.css" - Then I should see 'background-image: url("../images/100px-5fd6fb90.jpg");' - When I go to "/api.json" - Then I should see 'images/100px-5fd6fb90.gif' - And I should see 'images/100px-5fd6fb90.jpg' - And I should see 'images/100px-1242c368.png' - When I go to "/subdir/api.json" - Then I should see 'images/100px-5fd6fb90.gif' - And I should see 'images/100px-5fd6fb90.jpg' - And I should see 'images/100px-1242c368.png' - When I go to "/stylesheets/fragment-99b76247.css" - And I should see 'url("../images/100px-5fd6fb90.jpg");' - And I should see 'url("../images/100px-5fd6fb90.jpg?test");' - And I should see 'url("../images/100px-5fd6fb90.jpg?#test");' - And I should see 'url("../images/100px-5fd6fb90.jpg#test");' + When I go to "/stylesheets/site-50eaa978.css" + Then I should see "background-image: url('../images/100px-5fd6fb90.jpg')" - Scenario: Hashed assets work with Slim - Given the Server is running at "asset-hash-app" - When I go to "/slim.html" - And I should see 'src="images/300px-59adce76.jpg"' - And I should see 'src="images/100px-5fd6fb90.jpg"' - And I should see 'srcset="images/100px-5fd6fb90.jpg 1x, images/200px-c11eb203.jpg 2x, images/300px-59adce76.jpg 3x"' - - Scenario: Enabling an asset host still produces hashed files and references (hash first) - Given a fixture app "asset-hash-host-app" - And a file named "config.rb" with: - """ - set :sass_source_maps, false - activate :asset_hash - activate :directory_indexes - activate :asset_host, host: 'http://middlemanapp.com' - """ + Scenario: Enabling an asset host still produces hashed files and references Given the Server is running at "asset-hash-host-app" When I go to "/" - Then I should see 'href="http://middlemanapp.com/stylesheets/site-7474cadd.css"' - Then I should see 'href="http://middlemanapp.com/stylesheets/fragment-2902933e.css"' + Then I should see 'href="http://middlemanapp.com/stylesheets/site-54baaf3a.css"' And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"' - And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?test"' - And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?#test"' - And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg#test"' When I go to "/subdir/" - Then I should see 'href="http://middlemanapp.com/stylesheets/site-7474cadd.css"' + Then I should see 'href="http://middlemanapp.com/stylesheets/site-54baaf3a.css"' And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"' When I go to "/other/" - Then I should see 'href="http://middlemanapp.com/stylesheets/site-7474cadd.css"' + Then I should see 'href="http://middlemanapp.com/stylesheets/site-54baaf3a.css"' And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"' - And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?test"' - And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?#test"' - And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg#test"' - When I go to "/stylesheets/fragment-2902933e.css" - And I should see 'url("http://middlemanapp.com/images/100px-5fd6fb90.jpg");' - And I should see 'url("http://middlemanapp.com/images/100px-5fd6fb90.jpg?test");' - And I should see 'url("http://middlemanapp.com/images/100px-5fd6fb90.jpg?#test");' - And I should see 'url("http://middlemanapp.com/images/100px-5fd6fb90.jpg#test");' - - Scenario: Enabling an asset host still produces hashed files and references (host first) - Given a fixture app "asset-hash-host-app" - And a file named "config.rb" with: - """ - set :sass_source_maps, false - activate :asset_host, host: 'http://middlemanapp.com' - activate :directory_indexes - activate :asset_hash - """ - Given the Server is running at "asset-hash-host-app" - When I go to "/" - Then I should see 'href="http://middlemanapp.com/stylesheets/site-7474cadd.css"' - Then I should see 'href="http://middlemanapp.com/stylesheets/fragment-2902933e.css"' - And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"' - And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?test"' - And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?#test"' - And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg#test"' - When I go to "/subdir/" - Then I should see 'href="http://middlemanapp.com/stylesheets/site-7474cadd.css"' - And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"' - When I go to "/other/" - Then I should see 'href="http://middlemanapp.com/stylesheets/site-7474cadd.css"' - And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg"' - And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?test"' - And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg?#test"' - And I should see 'src="http://middlemanapp.com/images/100px-5fd6fb90.jpg#test"' - When I go to "/stylesheets/fragment-2902933e.css" - And I should see 'url("http://middlemanapp.com/images/100px-5fd6fb90.jpg")' - And I should see 'url("http://middlemanapp.com/images/100px-5fd6fb90.jpg?test")' - And I should see 'url("http://middlemanapp.com/images/100px-5fd6fb90.jpg?#test")' - And I should see 'url("http://middlemanapp.com/images/100px-5fd6fb90.jpg#test")' + # Asset helpers don't appear to work from Compass right now + # When I go to "/stylesheets/site-e5a31a3e.css" + # Then I should see "background-image: url('http://middlemanapp.com/images/100px-5fd6fb90.jpg')" Scenario: The asset hash should change when a SASS partial changes Given the Server is running at "asset-hash-app" @@ -179,14 +131,14 @@ Feature: Assets get file hashes appended to them and references to them are upda font-size: 14px """ When I go to "/partials/" - Then I should see 'href="../stylesheets/uses_partials-4d4e34e6.css' + Then I should see 'href="../stylesheets/uses_partials-423a00f7.css' And the file "source/stylesheets/_partial.sass" has the contents """ body font-size: 18px !important """ When I go to "/partials/" - Then I should see 'href="../stylesheets/uses_partials-ec347271.css' + Then I should see 'href="../stylesheets/uses_partials-e8c3d4eb.css' Scenario: The asset hash should change when a Rack-based filter changes Given a fixture app "asset-hash-app" @@ -196,25 +148,22 @@ Feature: Assets get file hashes appended to them and references to them are upda activate :relative_assets activate :directory_indexes require 'lib/middleware.rb' - use ::Middleware + use Middleware """ Given the Server is running at "asset-hash-app" When I go to "/" - Then I should see 'href="stylesheets/site-5ad7def0.css' - When I go to "stylesheets/site-5ad7def0.css" - Then I should see 'background-image: url("../images/100px-5fd6fb90.jpg")' + Then I should see 'href="stylesheets/site-5770af52.css' + When I go to "stylesheets/site-5770af52.css" + Then I should see 'background-image' Then I should see 'Added by Rack filter' + When I go to "stylesheets/site-50eaa978.css" + Then I should see 'Not Found' Scenario: Hashed-asset files are not produced for ignored paths Given a fixture app "asset-hash-app" And a file named "config.rb" with: """ - is_stylesheet = proc { |path| path.start_with? 'stylesheets' } - activate :asset_hash, ignore: [ - %r(javascripts/*), - 'images/*', - is_stylesheet - ] + activate :asset_hash, :ignore => [%r(javascripts/*), 'images/*'] activate :relative_assets activate :directory_indexes """ @@ -228,97 +177,27 @@ Feature: Assets get file hashes appended to them and references to them are upda | images/100px.jpg | | images/100px.gif | | javascripts/application.js | - | stylesheets/site.css | + | stylesheets/site-50eaa978.css | | index.html | | subdir/index.html | | other/index.html | - | api.json | - | subdir/api.json | And the following files should not exist: | images/100px-1242c368.png | | images/100px-5fd6fb90.jpg | | images/100px-5fd6fb90.gif | | javascripts/application-1d8d5276.js | - | stylesheets/site-7474cadd.css | - - Scenario: Hashed-asset files are not replaced for rewrite ignored paths - Given a fixture app "asset-hash-app" - And a file named "config.rb" with: - """ - is_stylesheet = proc { |path| path.start_with? '/stylesheets' } - activate :asset_hash, rewrite_ignore: [ - %r(javascripts/*), - '/subdir/*', - is_stylesheet - ] - activate :relative_assets - activate :directory_indexes - """ - And a successfully built app at "asset-hash-app" - When I cd to "build" - Then the following files should exist: - | index.html | - | subdir/index.html | - | images/100px-5fd6fb90.jpg | - | javascripts/application-1d8d5276.js | - | stylesheets/site-8bc55985.css | - And the following files should not exist: - | images/100px.jpg | - | javascripts/application.js | | stylesheets/site.css | - And the file "javascripts/application-1d8d5276.js" should contain "img.src = '/images/100px.jpg'" - And the file "stylesheets/site-8bc55985.css" should contain: - """ - background-image: url("../images/100px.jpg") - """ - And the file "index.html" should contain 'href="stylesheets/site-8bc55985.css"' - And the file "index.html" should contain 'src="javascripts/application-1d8d5276.js"' - And the file "index.html" should contain 'src="images/100px-5fd6fb90.jpg"' - And the file "subdir/index.html" should contain: - """ -

Image url3:

-

- """ - Scenario: Already minified files should still be hashed - Given a successfully built app at "asset-hash-minified-app" - When I cd to "build" - Then the following files should exist: - | javascripts/jquery.min-276c87ff.js | - | stylesheets/test-7de2ad06.css | - And the following files should not exist: - | javascripts/jquery.min.js | - And the file "stylesheets/test-7de2ad06.css" should contain: - """ - .no-bug{background-image:url(/images/100px-5fd6fb90.jpg)} - .bug{content:"";background-image:url(/images/100px-5fd6fb90.jpg)} - .no-bug{content:""; background-image:url(/images/100px-5fd6fb90.jpg)} - """ + # @wip Currently broken, we should move all asset-host functionality out of Compass and into something more similar to asset_hash with Rack-based rewrites + # Scenario: Enabling an asset host and referencing assets in CSS with URL fragments are rewritten correctly + # Given a successfully built app at "asset-hash-host-app" + # When I cd to "build" - Scenario: Source map paths include the hash - Given a successfully built app at "asset-hash-source-map" - When I cd to "build" - Then the following files should exist: - | index.html | - | javascripts/application-4553338c.js | - | javascripts/application.js-22cc2b5f.map | - | index.html | - And the following files should not exist: - | javascripts/application.js | - | javascripts/application.js.map | + # Then the following files should exist: + # | images/100px-5fd6fb90.jpg | + # | stylesheets/fragment-c058ecb2.css | + # And the following files should not exist: + # | images/100px.jpg | - And the file "javascripts/application-4553338c.js" should contain "//# sourceMappingURL=application.js-22cc2b5f.map" - - Scenario: Hashes can contain a prefix - Given a successfully built app at "asset-hash-prefix" - When I cd to "build" - Then the following files should exist: - | index.html | - | javascripts/application-myprefix-4553338c.js | - | javascripts/application.js-myprefix-22cc2b5f.map | - | index.html | - And the following files should not exist: - | javascripts/application.js | - | javascripts/application.js.map | - - And the file "javascripts/application-myprefix-4553338c.js" should contain "//# sourceMappingURL=application.js-myprefix-22cc2b5f.map" + # And the file "stylesheets/fragment-c058ecb2.css" should contain "http://middlemanapp.com/images/100px-5fd6fb90.jpg#test" + # And the file "stylesheets/fragment-c058ecb2.css" should not contain "http://middlemanapp.com/images/100px.jpg#test" diff --git a/middleman-core/features/asset_host.feature b/middleman-core/features/asset_host.feature index 0433b61b..30746473 100644 --- a/middleman-core/features/asset_host.feature +++ b/middleman-core/features/asset_host.feature @@ -1,55 +1,56 @@ Feature: Alternate between multiple asset hosts + In order to speed up page loading + + Scenario: Set single host globally + Given a fixture app "asset-host-app" + And a file named "config.rb" with: + """ + activate :asset_host + set :asset_host, "http://assets1.example.com" + """ + And the Server is running + When I go to "/asset_host.html" + Then I should see "http://assets1" + When I go to "/stylesheets/asset_host.css" + Then I should see "http://assets1" + + Scenario: Set proc host globally + Given a fixture app "asset-host-app" + And a file named "config.rb" with: + """ + activate :asset_host + set :asset_host do |asset| + "http://assets%d.example.com" % (asset.hash % 4) + end + """ + And the Server is running + When I go to "/asset_host.html" + Then I should see "http://assets" + When I go to "/stylesheets/asset_host.css" + Then I should see "http://assets" Scenario: Set single host with inline-option Given a fixture app "asset-host-app" And a file named "config.rb" with: """ - activate :asset_host, host: "http://assets1.example.com" + activate :asset_host, :host => "http://assets1.example.com" """ And the Server is running When I go to "/asset_host.html" - Then I should see "'.google-analytics.com/ga.js'" - Then I should see 'src="https://code.jquery.com/jquery-2.1.3.min.js"' - Then I should see content matching %r{http://assets1.example.com/} - Then I should not see content matching %r{http://assets1.example.com//} - Then I should see content matching %r{Angular.js} - Then I should see content matching %r{'//www.example.com/script.js'} + Then I should see "http://assets1" When I go to "/stylesheets/asset_host.css" - Then I should see content matching %r{http://assets1.example.com/} - Then I should not see content matching %r{http://assets1.example.com//} - When I go to "/javascripts/asset_host.js" - Then I should not see content matching %r{http://assets1.example.com/} + Then I should see "http://assets1" Scenario: Set proc host with inline-option Given a fixture app "asset-host-app" And a file named "config.rb" with: """ - activate :asset_host, host: Proc.new { |asset| - hash = Digest::MD5.digest(asset).bytes.map!(&:ord).reduce(&:+) - "http://assets%d.example.com" % (hash % 4) + activate :asset_host, :host => Proc.new { |asset| + "http://assets%d.example.com" % (asset.hash % 4) } """ And the Server is running When I go to "/asset_host.html" - Then I should see 'src="https://code.jquery.com/jquery-2.1.3.min.js"' - Then I should see content matching %r{http://assets1.example.com/} - Then I should not see content matching %r{http://assets1.example.com//} - Then I should see content matching %r{Angular.js} - Then I should see content matching %r{'//www.example.com/script.js'} + Then I should see "http://assets" When I go to "/stylesheets/asset_host.css" - Then I should see content matching %r{http://assets1.example.com/} - Then I should not see content matching %r{http://assets1.example.com//} - - Scenario: Hosts are not rewritten for rewrite ignored paths - Given a fixture app "asset-host-app" - And a file named "config.rb" with: - """ - activate :asset_host, host: "http://assets1.example.com", rewrite_ignore: [ - '/stylesheets/asset_host.css', - ] - """ - And the Server is running - When I go to "/asset_host.html" - Then I should see content matching %r{http://assets1.example.com/} - When I go to "/stylesheets/asset_host.css" - Then I should not see content matching %r{http://assets1.example.com/} + Then I should see "http://assets" \ No newline at end of file diff --git a/middleman-core/features/automatic_alt_tags.feature b/middleman-core/features/automatic_alt_tags.feature deleted file mode 100644 index 12e84459..00000000 --- a/middleman-core/features/automatic_alt_tags.feature +++ /dev/null @@ -1,8 +0,0 @@ -Feature: Automatically detect and insert image dimensions into tags - In order to speed up development and appease YSlow - - Scenario: Rendering an image with the feature enabled - Given "automatic_alt_tags" feature is "enabled" - And the Server is running at "automatic-alt-tags-app" - When I go to "/auto-image-sizes.html" - Then I should see 'alt="Blank"' \ No newline at end of file diff --git a/middleman-core/features/automatic_image_sizes.feature b/middleman-core/features/automatic_image_sizes.feature index 50a0b02e..89f9d7a5 100644 --- a/middleman-core/features/automatic_image_sizes.feature +++ b/middleman-core/features/automatic_image_sizes.feature @@ -2,28 +2,15 @@ Feature: Automatically detect and insert image dimensions into tags In order to speed up development and appease YSlow Scenario: Rendering an image with the feature disabled - Given a fixture app "automatic-image-size-app" - And a file named "config.rb" with: - """ - """ + Given "automatic_image_sizes" feature is "disabled" And the Server is running at "automatic-image-size-app" When I go to "/auto-image-sizes.html" Then I should not see "width=" And I should not see "height=" - When I go to "/markdown-sizes.html" - Then I should not see "width=" - And I should not see "height=" - + Scenario: Rendering an image with the feature enabled - Given a fixture app "automatic-image-size-app" - And a file named "config.rb" with: - """ - activate :automatic_image_sizes - """ + Given "automatic_image_sizes" feature is "enabled" And the Server is running at "automatic-image-size-app" When I go to "/auto-image-sizes.html" - Then I should see 'width="1"' - And I should see 'height="1"' - When I go to "/markdown-sizes.html" - Then I should see 'width="1"' - And I should see 'height="1"' + Then I should see "width=" + And I should see "height=" \ No newline at end of file diff --git a/middleman-core/features/builder.feature b/middleman-core/features/builder.feature index d99c165c..25f686e9 100644 --- a/middleman-core/features/builder.feature +++ b/middleman-core/features/builder.feature @@ -9,6 +9,7 @@ Feature: Builder | static.html | | services/index.html | | stylesheets/static.css | + | spaces in file.html | | images/blank.gif | | images/Read me (example).txt | | images/Child folder/regular_file(example).txt | @@ -20,13 +21,14 @@ Feature: Builder | layout | | layouts/custom | | layouts/content_for | - + And the file "index.html" should contain "Comment in layout" And the file "index.html" should contain "

Welcome

" And the file "static.html" should contain "Static, no code!" And the file "services/index.html" should contain "Services" And the file "stylesheets/static.css" should contain "body" - + And the file "spaces in file.html" should contain "spaces" + Scenario: Build glob Given a successfully built app at "glob-app" with flags "--glob '*.css'" When I cd to "build" @@ -34,28 +36,16 @@ Feature: Builder | index.html | Then the following files should exist: | stylesheets/site.css | - + Scenario: Build with errors Given a built app at "build-with-errors-app" Then the exit status should be 1 - + Scenario: Build empty errors Given a built app at "empty-app" Then the exit status should be 1 - Scenario: Build external_pipeline errors - Given a built app at "external-pipeline-error" - Then the exit status should be 1 - Scenario: Build alias (b) Given a fixture app "large-build-app" When I run `middleman b` - Then was successfully built - - Scenario: Builded text file(ex: html, css, xml, txt)'s permission is 0644 - Given a successfully built app at "large-build-app" - When I cd to "build" - Then the mode of filesystem object "index.html" should match "0644" - And the mode of filesystem object "stylesheets/static.css" should match "0644" - And the mode of filesystem object "feed.xml" should match "0644" - And the mode of filesystem object ".htaccess" should match "0644" + Then was successfully built \ No newline at end of file diff --git a/middleman-core/features/cache_buster.feature b/middleman-core/features/cache_buster.feature index bea898e3..11040ba5 100644 --- a/middleman-core/features/cache_buster.feature +++ b/middleman-core/features/cache_buster.feature @@ -5,7 +5,7 @@ Feature: Generate mtime-based query string for busting browser caches Given "cache_buster" feature is "disabled" And the Server is running at "cache-buster-app" When I go to "/stylesheets/relative_assets.css" - Then I should see 'blank.gif"' + Then I should see "blank.gif'" Scenario: Rendering html with the feature disabled Given "cache_buster" feature is "disabled" @@ -39,18 +39,4 @@ Feature: Generate mtime-based query string for busting browser caches And the Server is running at "cache-buster-app" When I go to "/cache-buster.html" Then I should see "site.css?" - Then I should see "blank.gif?" - - Scenario: URLs are not rewritten for rewrite ignored paths - Given a fixture app "cache-buster-app" - And a file named "config.rb" with: - """ - activate :cache_buster, rewrite_ignore: [ - '/cache-buster.html', - ] - """ - And the Server is running at "cache-buster-app" - When I go to "/cache-buster.html" - Then I should see 'site.css"' - Then I should see 'empty-with-include.js"' - Then I should see 'blank.gif"' + Then I should see "blank.gif?" \ No newline at end of file diff --git a/middleman-core/features/chained_templates.feature b/middleman-core/features/chained_templates.feature index 27135bf6..b7d4e83e 100644 --- a/middleman-core/features/chained_templates.feature +++ b/middleman-core/features/chained_templates.feature @@ -7,103 +7,13 @@ Feature: Templates should be chainable Then I should see "Title" And I should see "Subtitle" And I should see "Sup" - + Scenario: Build chained template Given a successfully built app at "chained-app" When I cd to "build" Then the following files should exist: | index.html | - | test.erb.combobreaker | + And the file "index.html" should contain "Title" And the file "index.html" should contain "Subtitle" - And the file "index.html" should contain "Sup" - And the file "test.erb.combobreaker" should contain "Title" - And the file "test.erb.combobreaker" should contain "Subtitle" - And the file "test.erb.combobreaker" should contain "Sup" - - Scenario: Partials are parsed by multiple template engines: Outer template has .erb and inner .md.erb - Given a fixture app "partial-chained_templates-app" - And a template named "my_template.html.erb" with: - """ -

My Template

- - <%= partial 'my_partial' %> - """ - And a template named "my_partial.html.md.erb" with: - """ - ## My Partial - - <%= 'hello world' %> - """ - And the Server is running - When I go to "/my_template.html" - Then I should see: - """ -

My Template

- """ - Then I should see: - """ -

My Partial

- """ - Then I should see: - """ -

hello world

- """ - - Scenario: Partials are parsed by multiple template engines: Outer template has .md.erb and inner .md.erb - Given a fixture app "partial-chained_templates-app" - And a template named "my_template.html.md.erb" with: - """ - # My Template - - <%= partial 'my_partial' %> - """ - And a template named "my_partial.html.md.erb" with: - """ - ## My Partial - - <%= 'hello world' %> - """ - And the Server is running - When I go to "/my_template.html" - Then I should see: - """ -

My Template

- """ - Then I should see: - """ -

My Partial

- """ - Then I should see: - """ -

hello world

- """ - - Scenario: Partials are parsed by multiple template engines: Outer template has .md.erb, and inner .erb - Given a fixture app "partial-chained_templates-app" - And a template named "my_template.html.md.erb" with: - """ - # My Template - - <%= partial 'my_partial' %> - """ - And a template named "my_partial.html.erb" with: - """ -

My Partial

- - <%= 'hello world' %> - """ - And the Server is running - When I go to "/my_template.html" - Then I should see: - """ -

My Template

- """ - Then I should see: - """ -

My Partial

- """ - Then I should see: - """ -

hello world

- """ + And the file "index.html" should contain "Sup" \ No newline at end of file diff --git a/middleman-core/features/clean_build.feature b/middleman-core/features/clean_build.feature index 60c18578..e5254df4 100644 --- a/middleman-core/features/clean_build.feature +++ b/middleman-core/features/clean_build.feature @@ -16,22 +16,6 @@ Feature: Build Clean | build/should_be_ignored3.html | And the file "build/index.html" should contain "Comment in layout" - Scenario: Clean build has a whitelist - Given a fixture app "clean-app" - When a file named "build/.test" with: - """ - Hello - """ - When a file named "config.rb" with: - """ - set :skip_build_clean do |path| - path =~ /\.test/ - end - """ - Given a built app at "clean-app" - Then the following files should exist: - | build/.test | - Scenario: Clean build an app with newly ignored files and a nested output directory Given a fixture app "clean-nested-app" When a file named "config.rb" with: @@ -58,21 +42,3 @@ Feature: Build Clean Then the following files should not exist: | sub/dir/about.html | | sub/dir/nested/nested.html | - - Scenario: Build and clean an app under a hidden directory - Given a fixture app "clean-app" - And app "clean-app" is using config "hidden-dir-before" - And a built app at "clean-app" - Then the following files should exist: - | .build/index.html | - | .build/should_be_ignored.html | - | .build/should_be_ignored2.html | - | .build/should_be_ignored3.html | - Given app "clean-app" is using config "hidden-dir-after" - And a built app at "clean-app" - Then the following files should exist: - | .build/index.html | - And the following files should not exist: - | .build/should_be_ignored.html | - | .build/should_be_ignored2.html | - | .build/should_be_ignored3.html | diff --git a/middleman-cli/features/cli_extension.feature b/middleman-core/features/cli_extension.feature similarity index 91% rename from middleman-cli/features/cli_extension.feature rename to middleman-core/features/cli_extension.feature index 5385a622..b762664c 100644 --- a/middleman-cli/features/cli_extension.feature +++ b/middleman-core/features/cli_extension.feature @@ -9,6 +9,6 @@ Feature: Middleman New Extension CLI | Rakefile | | my-extension-library.gemspec | | features/support/env.rb | - | lib/my-extension-library/extension.rb | + | lib/middleman_extension.rb | | lib/my-extension-library.rb | | .gitignore | diff --git a/middleman-core/features/cli_init.feature b/middleman-core/features/cli_init.feature new file mode 100644 index 00000000..d6d5b4b4 --- /dev/null +++ b/middleman-core/features/cli_init.feature @@ -0,0 +1,100 @@ +Feature: Middleman CLI + + Scenario: Create a new project + Given I run `middleman init MY_PROJECT` + Then the exit status should be 0 + When I cd to "MY_PROJECT" + Then the following files should exist: + | Gemfile | + | .gitignore | + | config.rb | + | source/index.html.erb | + | source/images/background.png | + | source/images/middleman.png | + | source/layouts/layout.erb | + | source/javascripts/all.js | + | source/stylesheets/all.css | + | source/stylesheets/normalize.css | + + Scenario: Create a new project in the current directory + Given a directory named "MY_PROJECT" + When I cd to "MY_PROJECT" + And I run `middleman init` + Then the exit status should be 0 + And the following files should exist: + | Gemfile | + | config.rb | + | source/index.html.erb | + + Scenario: Create a new project (alias i) + When I run `middleman i MY_PROJECT` + Then a directory named "MY_PROJECT" should exist + + Scenario: Create a new project (alias new) + When I run `middleman new MY_PROJECT` + Then a directory named "MY_PROJECT" should exist + + Scenario: Create a new project (alias n) + When I run `middleman n MY_PROJECT` + Then a directory named "MY_PROJECT" should exist + + Scenario: Create a new project with Rack + When I run `middleman init MY_PROJECT --rack` + Then a directory named "MY_PROJECT" should exist + When I cd to "MY_PROJECT" + Then the following files should exist: + | config.rb | + | config.ru | + | Gemfile | + + Scenario: Create a new HTML5 project + When I run `middleman init MY_PROJECT --template=html5` + Then a directory named "MY_PROJECT" should exist + When I cd to "MY_PROJECT" + Then the following files should exist: + | config.rb | + | Gemfile | + Then the following files should not exist: + | config.ru | + And the file "config.rb" should contain "set :js_dir, 'js'" + Then a directory named "source" should exist + When I cd to "source" + Then the following files should exist: + | index.html.erb | + | layouts/layout.erb | + | humans.txt | + | js/main.js | + + Scenario: Create a new HTML5 project with Rack + When I run `middleman init MY_PROJECT --rack --template=html5` + Then a directory named "MY_PROJECT" should exist + When I cd to "MY_PROJECT" + Then the following files should exist: + | config.rb | + | config.ru | + | Gemfile | + + Scenario: Create a new Mobile HTML5 project + When I run `middleman init MY_PROJECT --template=mobile` + Then a directory named "MY_PROJECT" should exist + When I cd to "MY_PROJECT" + Then the following files should exist: + | config.rb | + | Gemfile | + Then the following files should not exist: + | config.ru | + Then a directory named "source" should exist + When I cd to "source" + Then the following files should exist: + | index.html | + | humans.txt | + | js/libs/respond.min.js | + + Scenario: Create a new Mobile HTML5 project with Rack + When I run `middleman init MY_PROJECT --rack --template=mobile` + Then a directory named "MY_PROJECT" should exist + When I cd to "MY_PROJECT" + Then the following files should exist: + | config.rb | + | config.ru | + | Gemfile | diff --git a/middleman-core/features/collections.feature b/middleman-core/features/collections.feature deleted file mode 100644 index 2d313a3c..00000000 --- a/middleman-core/features/collections.feature +++ /dev/null @@ -1,265 +0,0 @@ -Feature: Collections - Scenario: Lazy query - Given a fixture app "collections-app" - And a file named "config.rb" with: - """ - articles1 = collection :articles1, resources.select { |r| - matcher = ::Middleman::Util::UriTemplates.uri_template('blog1/{year}-{month}-{day}-{title}.html') - ::Middleman::Util::UriTemplates.extract_params(matcher, ::Middleman::Util.normalize_path(r.url)) - } - - everything = resources.select do |r| - true - end - - def get_tags(resource) - if resource.data.tags.is_a? String - resource.data.tags.split(',').map(&:strip) - else - resource.data.tags - end - end - - def group_lookup(resource, sum) - results = Array(get_tags(resource)).map(&:to_s).map(&:to_sym) - - results.each do |k| - sum[k] ||= [] - sum[k] << resource - end - end - - tags = everything - .select { |resource| resource.data.tags } - .each_with_object({}, &method(:group_lookup)) - - class Wrapper - attr_reader :stuff - - def initialize - @stuff = Set.new - end - - def <<((k, v)) - @stuff << k - self - end - end - - collection :wrapped, tags.reduce(Wrapper.new, :<<) - - set :tags, tags # Expose to templates - - collection :first_tag, tags.keys.sort.first - """ - And a file named "source/index.html.erb" with: - """ - <% collection(:articles1).each do |article| %> - Article1: <%= article.data.title %> - <% end %> - - Tag Count: <%= collection(:wrapped).stuff.length %> - - <% config[:tags].value.each do |k, items| %> - Tag: <%= k %> (<%= items.length %>) - <% items.each do |article| %> - Article (<%= k %>): <%= article.data.title %> - <% end %> - <% end %> - - First Tag: <%= collection(:first_tag) %> - """ - Given the Server is running at "collections-app" - When I go to "index.html" - Then I should see 'Article1: Blog1 Newer Article' - And I should see 'Article1: Blog1 Another Article' - And I should see 'Tag: foo (4)' - And I should see 'Article (foo): Blog1 Newer Article' - And I should see 'Article (foo): Blog1 Another Article' - And I should see 'Article (foo): Blog2 Newer Article' - And I should see 'Article (foo): Blog2 Another Article' - And I should see 'Tag: bar (2)' - And I should see 'Article (bar): Blog1 Newer Article' - And I should see 'Article (bar): Blog2 Newer Article' - And I should see 'Tag: 120 (1)' - And I should see 'Article (120): Blog1 Another Article' - And I should see 'First Tag: 120' - And I should see 'Tag Count: 3' - - Scenario: Collected resources update with file changes - Given a fixture app "collections-app" - And a file named "config.rb" with: - """ - collection :articles, resources.select { |r| - matcher = ::Middleman::Util::UriTemplates.uri_template('blog2/{year}-{month}-{day}-{title}.html') - ::Middleman::Util::UriTemplates.extract_params(matcher, ::Middleman::Util.normalize_path(r.url)) - } - """ - And a file named "source/index.html.erb" with: - """ - <% collection(:articles).each do |article| %> - Article: <%= article.data.title || article.file_descriptor[:relative_path] %> - <% end %> - """ - Given the Server is running at "collections-app" - When I go to "index.html" - Then I should not see "Article: index.html.erb" - Then I should see 'Article: Blog2 Newer Article' - And I should see 'Article: Blog2 Another Article' - - And the file "source/blog2/2011-01-02-another-article.html.markdown" has the contents - """ - --- - title: "Blog3 Another Article" - date: 2011-01-02 - tags: - - foo - --- - - Another Article Content - - """ - When I go to "index.html" - Then I should see "Article: Blog2 Newer Article" - And I should not see "Article: Blog2 Another Article" - And I should see 'Article: Blog3 Another Article' - - And the file "source/blog2/2011-01-01-new-article.html.markdown" is removed - When I go to "index.html" - Then I should not see "Article: Blog2 Newer Article" - And I should see 'Article: Blog3 Another Article' - - And the file "source/blog2/2014-01-02-yet-another-article.html.markdown" has the contents - """ - --- - title: "Blog2 Yet Another Article" - date: 2011-01-02 - tags: - - foo - --- - - Yet Another Article Content - """ - When I go to "index.html" - And I should see 'Article: Blog3 Another Article' - And I should see 'Article: Blog2 Yet Another Article' - - Scenario: Work with local helpers - Given a fixture app "collections-app" - And a file named "config.rb" with: - """ - module TestHelper - def help_me - "ok" - end - end - - include TestHelper - - data.articles.each_with_index do |a, i| - proxy "/#{i}-#{help_me}.html", a - end - """ - And a file named "data/articles.yaml" with: - """ - --- - - "/blog1/2011-01-01-new-article.html" - - "/blog2/2011-01-02-another-article.html" - """ - Given the Server is running at "collections-app" - When I go to "0-ok.html" - Then I should see 'Newer Article Content' - When I go to "1-ok.html" - Then I should see 'Another Article Content' - - Scenario: Collected data update with file changes - Given a fixture app "collections-app" - And a file named "config.rb" with: - """ - data.articles.each_with_index do |a, i| - proxy "/#{i}.html", a - end - """ - And a file named "data/articles.yaml" with: - """ - --- - - "/blog1/2011-01-01-new-article.html" - - "/blog2/2011-01-02-another-article.html" - """ - Given the Server is running at "collections-app" - When I go to "0.html" - Then I should see 'Newer Article Content' - When I go to "1.html" - Then I should see 'Another Article Content' - When I go to "2.html" - Then I should see 'Not Found' - - When the file "data/articles.yaml" has the contents - """ - --- - - "/blog1/2011-01-01-new-article.html" - """ - When I go to "0.html" - Then I should see 'Newer Article Content' - When I go to "1.html" - Then I should see 'Not Found' - When I go to "2.html" - Then I should see 'Not Found' - - When the file "data/articles.yaml" has the contents - """ - --- - - "/blog2/2011-01-02-another-article.html" - - "/blog1/2011-01-01-new-article.html" - - "/blog2/2011-01-01-new-article.html" - """ - When I go to "0.html" - Then I should see 'Another Article Content' - When I go to "1.html" - Then I should see 'Newer Article Content' - When I go to "2.html" - Then I should see 'Again' - - Scenario: Arbitrary live datasets - Given a fixture app "collections-app" - And a file named "config.rb" with: - """ - ignore "/description_template.html" - - live { - Dir[File.join(root, "descriptions/*.txt")] - }.each do |description_name| - base = File.basename(description_name, '.txt') - proxy "#{base}.html", "/description_template.html", locals: { - contents: File.read(description_name) - } - end - """ - And a file named "source/description_template.html.erb" with: - """ - <%= contents %> - """ - And a file named "descriptions/test1.txt" with: - """ - Test1 - """ - Given the Server is running at "collections-app" - When I go to "test1.html" - Then I should see 'Test1' - When I go to "test2.html" - Then I should see 'Not Found' - - When the file "descriptions/test2.txt" has the contents - """ - Test2 - """ - When I go to "test1.html" - Then I should see 'Test1' - When I go to "test2.html" - Then I should see 'Test2' - - When the file "descriptions/test1.txt" is removed - When I go to "test1.html" - Then I should see 'Not Found' - When I go to "test2.html" - Then I should see 'Test2' diff --git a/middleman-core/features/compass-sprites.feature b/middleman-core/features/compass-sprites.feature new file mode 100644 index 00000000..871c277a --- /dev/null +++ b/middleman-core/features/compass-sprites.feature @@ -0,0 +1,6 @@ +Feature: Compass sprites should be generated on build and copied + Scenario: Building a clean site with sprites + Given a successfully built app at "compass-sprites-app" + When I cd to "build" + Then the following files should exist: + | images/icon-s0de2218f58.png | \ No newline at end of file diff --git a/middleman-core/features/console.feature b/middleman-core/features/console.feature deleted file mode 100644 index 1bd55809..00000000 --- a/middleman-core/features/console.feature +++ /dev/null @@ -1,11 +0,0 @@ -Feature: Console - - Scenario: Enter and exit the console - Given a fixture app "large-build-app" - When I run `middleman console` interactively - And I type "puts 'Hello from the console.'" - And I type "exit" - Then it should pass with: - """ - Hello from the console. - """ diff --git a/middleman-core/features/content_type.feature b/middleman-core/features/content_type.feature index 8d05d6a5..175361d8 100644 --- a/middleman-core/features/content_type.feature +++ b/middleman-core/features/content_type.feature @@ -12,15 +12,13 @@ Feature: Setting the right content type for files Then the content type should be "text/css" When I go to "/README" Then the content type should be "text/plain" - When I go to "/index.php" - Then the content type should be "text/php" Scenario: Content type can be set explicitly via page or proxy or frontmatter Given a fixture app "content-type-app" And a file named "config.rb" with: """ - page "README", content_type: 'text/awesome' - proxy "bar", "index.html", content_type: 'text/custom' + page "README", :content_type => 'text/awesome' + proxy "bar", "index.html", :content_type => 'text/custom' proxy "foo", "README" # auto-delegate to target content type """ And the Server is running at "content-type-app" @@ -33,7 +31,6 @@ Feature: Setting the right content type for files When I go to "/override.html" Then the content type should be "text/neato" - @preserve_mime_types Scenario: Content types can be overridden with mime_type Given a fixture app "content-type-app" And a file named "config.rb" with: diff --git a/middleman-core/features/custom_layouts.feature b/middleman-core/features/custom_layouts.feature index dfe52344..32feaa99 100644 --- a/middleman-core/features/custom_layouts.feature +++ b/middleman-core/features/custom_layouts.feature @@ -1,38 +1,26 @@ Feature: Custom layouts In order easily switch between relative and absolute paths - + Scenario: Using custom :layout attribute - Given a fixture app "custom-layout-app2" - And a file named "config.rb" with: - """ - page '/custom-layout.html', layout: :custom - """ + Given page "/custom-layout.html" has layout "custom" + And the Server is running at "custom-layout-app2" + When I go to "/custom-layout.html" + Then I should see "Custom Layout" + + Scenario: Using with_layout block + Given "/custom-layout.html" with_layout block has layout "custom" And the Server is running at "custom-layout-app2" When I go to "/custom-layout.html" Then I should see "Custom Layout" - Scenario: Using custom :layout attribute with proxy - Given a fixture app "custom-layout-app2" - And a file named "config.rb" with: - """ - page '/test/*', layout: :custom - proxy "/test/me.html", "/custom-layout.html" - live { %w(you) }.each do |who| - proxy "/test/#{who}.html", "/custom-layout.html" - end - """ + Scenario: Using with_layout block with globs + Given "/custom-*" with_layout block has layout "custom" And the Server is running at "custom-layout-app2" - When I go to "/test/me.html" + When I go to "/custom-layout.html" Then I should see "Custom Layout" - When I go to "/test/you.html" - Then I should see "Custom Layout" - + Scenario: Using custom :layout attribute with folders - Given a fixture app "custom-layout-app2" - And a file named "config.rb" with: - """ - page '/custom-layout-dir/', layout: :custom - """ + Given page "/custom-layout-dir/" has layout "custom" And the Server is running at "custom-layout-app2" When I go to "/custom-layout-dir" Then I should see "Custom Layout" @@ -40,13 +28,9 @@ Feature: Custom layouts Then I should see "Custom Layout" When I go to "/custom-layout-dir/index.html" Then I should see "Custom Layout" - + Scenario: Using custom :layout attribute with folders - Given a fixture app "custom-layout-app2" - And a file named "config.rb" with: - """ - page '/custom-layout-dir', layout: :custom - """ + Given page "/custom-layout-dir" has layout "custom" And the Server is running at "custom-layout-app2" When I go to "/custom-layout-dir" Then I should see "Custom Layout" @@ -54,13 +38,9 @@ Feature: Custom layouts Then I should see "Custom Layout" When I go to "/custom-layout-dir/index.html" Then I should see "Custom Layout" - + Scenario: Using custom :layout attribute with folders - Given a fixture app "custom-layout-app2" - And a file named "config.rb" with: - """ - page '/custom-layout-dir/index.html', layout: :custom - """ + Given page "/custom-layout-dir/index.html" has layout "custom" And the Server is running at "custom-layout-app2" When I go to "/custom-layout-dir" Then I should see "Custom Layout" @@ -68,7 +48,7 @@ Feature: Custom layouts Then I should see "Custom Layout" When I go to "/custom-layout-dir/index.html" Then I should see "Custom Layout" - + Scenario: Setting layout inside a matching page block Given the Server is running at "page-helper-layout-block-app" When I go to "/index.html" @@ -81,4 +61,4 @@ Feature: Custom layouts When I go to "/path/index.html" Then I should see "Alt" And I should see "Monde" - And I should not see "Hello" + And I should not see "Hello" \ No newline at end of file diff --git a/middleman-core/features/data.feature b/middleman-core/features/data.feature index db8bede6..fcce8445 100644 --- a/middleman-core/features/data.feature +++ b/middleman-core/features/data.feature @@ -51,10 +51,3 @@ Feature: Local Data API Then I should see "title1:Hello" Then I should see "title2:More" Then I should see "title3:Stuff" - - Scenario: Using data postscript - Given the Server is running at "nested-data-app" - When I go to "/extracontent.html" - Then I should see "

With Content

" - Then I should see '

Header 2

' - Then I should see "

Paragraph 1

" diff --git a/middleman-core/features/default-layout.feature b/middleman-core/features/default-layout.feature deleted file mode 100644 index 82fbeeff..00000000 --- a/middleman-core/features/default-layout.feature +++ /dev/null @@ -1,90 +0,0 @@ -Feature: Describe which files get layouts - - Background: - Given an empty app - And a file named "config.rb" with: - """ - page "/about.html", layout: :layout2 - """ - And a file named "source/layouts/layout.erb" with: - """ - In Layout - <%= yield %> - """ - And a file named "source/layouts/layout2.erb" with: - """ - - Second Layout - <%= yield %> - - """ - And a file named "source/index.html.erb" with: - """ - In Index - """ - And a file named "source/about.html.erb" with: - """ - In About - """ - And a file named "source/style.css.scss" with: - """ - html { border: 1; } - """ - And a file named "source/style2.scss" with: - """ - html { border: 2; } - """ - And a file named "source/data.json" with: - """ - { "hello": "world" } - """ - And a file named "source/script.js" with: - """ - helloWorld(); - """ - And a file named "source/test.xml.erb" with: - """ - --- - layout: layout2 - --- - - Hi - """ - And the Server is running at "empty_app" - - Scenario: Normal Template - When I go to "/index.html" - Then I should see "In Index" - And I should see "In Layout" - - Scenario: Normal Template with override - When I go to "/about.html" - Then I should see "In About" - And I should see "Second Layout" - And I should not see "In Layout" - - Scenario: Sass - When I go to "/style.css" - Then I should see "border: 1" - And I should not see "In Layout" - - Scenario: Sass with extension - When I go to "/style2" - Then I should see "border: 2" - And I should not see "In Layout" - - Scenario: JSON - When I go to "/data.json" - Then I should see "hello" - And I should not see "In Layout" - - Scenario: JS - When I go to "/script.js" - Then I should see "helloWorld()" - And I should not see "In Layout" - - Scenario: XML - When I go to "/test.xml" - Then I should see "Hi" - And I should see "Second Layout" - diff --git a/middleman-core/features/directory_index.feature b/middleman-core/features/directory_index.feature index ddbd703f..99dbe60e 100644 --- a/middleman-core/features/directory_index.feature +++ b/middleman-core/features/directory_index.feature @@ -9,7 +9,6 @@ Feature: Directory Index | a_folder/needs_index/index.html | | leave_me_alone.html | | wildcard_leave_me_alone.html | - | regex_leave_me_alone2.html | | evil spaces/index.html | | regular/index.html | | .htaccess | @@ -22,28 +21,28 @@ Feature: Directory Index | a_folder/needs_index.html | | leave_me_alone/index.html | | wildcard_leave_me_alone/index.html | - | regex_leave_me_alone2/index.html | And the file "needs_index/index.html" should contain "Indexable" And the file "a_folder/needs_index/index.html" should contain "Indexable" And the file "leave_me_alone.html" should contain "Stay away" And the file "regular/index.html" should contain "Regular" - And the file "evil spaces/index.html" should contain "Filled with Evil Spaces" + And the file "evil spaces/index.html" should contain "Spaces" + Scenario: Preview normal file Given the Server is running at "indexable-app" When I go to "/needs_index/" Then I should see "Indexable" - + Scenario: Preview normal file with spaces in filename Given the Server is running at "indexable-app" - When I go to "/evil spaces/" - Then I should see "Filled with Evil Spaces" + When I go to "/evil%20spaces/" + Then I should see "Spaces" Scenario: Preview normal file subdirectory Given the Server is running at "indexable-app" When I go to "/a_folder/needs_index/" Then I should see "Indexable" - + Scenario: Preview ignored file Given the Server is running at "indexable-app" When I go to "/leave_me_alone/" @@ -70,13 +69,14 @@ Feature: Directory Index And the Server is running at "indexable-app" When I go to "/link_to/" Then I should see 'link_to: Needs Index' - Then I should see 'explicit_link_to: Explicit' + Then I should see 'explicit_link_to: Explicit' Then I should see 'unknown_link_to: Unknown' Then I should see 'relative_link_to: Relative' Then I should see 'link_to_with_spaces: Spaces' When I go to "/link_to/sub/" Then I should see 'link_to: Needs Index' - Then I should see 'explicit_link_to: Explicit' + Then I should see 'explicit_link_to: Explicit' Then I should see 'unknown_link_to: Unknown' Then I should see 'relative_link_to: Relative' Then I should see 'link_to_with_spaces: Spaces' + diff --git a/middleman-core/features/dynamic_pages.feature b/middleman-core/features/dynamic_pages.feature index fc886ffd..6d1b59ac 100644 --- a/middleman-core/features/dynamic_pages.feature +++ b/middleman-core/features/dynamic_pages.feature @@ -31,8 +31,7 @@ Feature: Dynamic Pages | should_be_ignored6.html | | should_be_ignored7.html | | should_be_ignored8.html | - | should_be_ignored9.html | - + Scenario: Preview basic proxy Given the Server is running at "dynamic-pages-app" When I go to "/fake.html" @@ -43,46 +42,46 @@ Feature: Dynamic Pages Then I should see "I am real" When I go to "/fake4.html" Then I should see "I am real" - + Scenario: Preview proxy with variable one Given the Server is running at "dynamic-pages-app" When I go to "/fake/one.html" Then I should see "I am real: one" Then I should see "Global: I am one glob" Then I should see "All: I am all glob" - + When I go to "/fake2/one.html" Then I should see "I am real: one" Then I should see "Global: I am two glob" Then I should see "All: I am all glob" - + When I go to "/fake3/one.html" Then I should see "I am real: one" Then I should see "Global: I am three glob" Then I should see "All: I am all glob" - + When I go to "/fake4/one.html" Then I should see "I am real: one" Then I should see "Global: I am four glob" Then I should see "All: I am all glob" - + Scenario: Preview proxy with variable two Given the Server is running at "dynamic-pages-app" When I go to "/fake/two.html" Then I should see "I am real: two" Then I should see "Global: I am one glob" Then I should see "All: I am all glob" - + When I go to "/fake2/two.html" Then I should see "I am real: two" Then I should see "Global: I am two glob" Then I should see "All: I am all glob" - + When I go to "/fake3/two.html" Then I should see "I am real: two" Then I should see "Global: I am three glob" Then I should see "All: I am all glob" - + When I go to "/fake4/two.html" Then I should see "I am real: two" Then I should see "Global: I am four glob" @@ -102,7 +101,7 @@ Feature: Dynamic Pages Then the file "fake3/one.html" should contain "I am real: one" Then the file "fake3/one.html" should contain "Global: I am three glob" Then the file "fake3/one.html" should contain "All: I am all glob" - + Scenario: Target ignore Given the Server is running at "dynamic-pages-app" When I go to "/target_ignore.html" @@ -113,7 +112,7 @@ Feature: Dynamic Pages Then I should see "Ignore me! 7" When I go to "/target_ignore4.html" Then I should see "Ignore me! 8" - + Scenario: Preview ignored paths Given the Server is running at "dynamic-pages-app" When I go to "/should_be_ignored.html" @@ -131,6 +130,4 @@ Feature: Dynamic Pages When I go to "/should_be_ignored7.html" Then I should see "File Not Found" When I go to "/should_be_ignored8.html" - Then I should see "File Not Found" - When I go to "/should_be_ignored9.html" - Then I should see "File Not Found" + Then I should see "File Not Found" \ No newline at end of file diff --git a/middleman-core/features/encoding_option.feature b/middleman-core/features/encoding_option.feature deleted file mode 100644 index 6244e420..00000000 --- a/middleman-core/features/encoding_option.feature +++ /dev/null @@ -1,28 +0,0 @@ -# encoding: iso-8859-1 -Feature: encoding option - - Scenario: No encoding set - Given a fixture app "clean-app" - Given the Server is running at "clean-app" - - When I go to "/index.html" - Then the "Content-Type" header should contain "text/html" - Then the "Content-Type" header should contain "charset=utf-8" - - @wip - Scenario: Custom encoding set - Given a fixture app "i-8859-1-app" - And a file named "config.rb" with: - """ - set :encoding, "ISO-8859-1" - - ::Rack::Mime::MIME_TYPES['.html'] = 'text/html; charset=iso-8859-1' - ::Rack::Mime::MIME_TYPES['.htm'] = 'text/html; charset=iso-8859-1' - ::Rack::Mime::MIME_TYPES['.map'] = 'application/json; charset=iso-8859-1' - """ - Given the Server is running at "i-8859-1-app" - - When I go to "/index.html" - Then the "Content-Type" header should contain "text/html" - Then the "Content-Type" header should contain "charset=iso-8859-1" - Then I should see "äöü" diff --git a/middleman-core/features/extension_api_deprecations.feature b/middleman-core/features/extension_api_deprecations.feature deleted file mode 100644 index 8c9dd216..00000000 --- a/middleman-core/features/extension_api_deprecations.feature +++ /dev/null @@ -1,10 +0,0 @@ -Feature: Extension author could use some hooks - - Scenario: When build - Given a fixture app "extension-api-deprecations-app" - When I run `middleman build` - Then the exit status should be 0 - And the output should contain "`set :layout` is deprecated" - And the file "build/index.html" should contain "In Index" - And the file "build/index.html" should not contain "In Layout" - diff --git a/middleman-core/features/extension_hooks.feature b/middleman-core/features/extension_hooks.feature deleted file mode 100644 index 1dedd9a9..00000000 --- a/middleman-core/features/extension_hooks.feature +++ /dev/null @@ -1,13 +0,0 @@ -Feature: Extension author could use some hooks - - Scenario: When build - Given a fixture app "extension-hooks-app" - When I run `middleman build` - Then the exit status should be 0 - And the output should contain "/// after_configuration ///" - And the output should contain "/// ready ///" - And the output should contain "/// before_build ///" - And the output should contain "/// before ///" - And the output should contain "/// before_render ///" - And the output should contain "/// after_render ///" - And the output should contain "/// after_build ///" diff --git a/middleman-core/features/fonts.feature b/middleman-core/features/fonts.feature new file mode 100644 index 00000000..7cc9f8a1 --- /dev/null +++ b/middleman-core/features/fonts.feature @@ -0,0 +1,15 @@ +Feature: Web Fonts + + Scenario: Checking built folder for content + Given a successfully built app at "fonts-app" + When I cd to "build" + Then the following files should exist: + | stylesheets/fonts.css | + And the file "stylesheets/fonts.css" should contain "/fonts/StMarie-Thin.otf" + And the file "stylesheets/fonts.css" should contain "/fonts/blank/blank.otf" + + Scenario: Rendering scss + Given the Server is running at "fonts-app" + When I go to "/stylesheets/fonts.css" + Then I should see "/fonts/StMarie-Thin.otf" + And I should see "/fonts/blank/blank.otf" diff --git a/middleman-core/features/front-matter-neighbor.feature b/middleman-core/features/front-matter-neighbor.feature index 9260ff41..f29c554e 100644 --- a/middleman-core/features/front-matter-neighbor.feature +++ b/middleman-core/features/front-matter-neighbor.feature @@ -22,7 +22,7 @@ Feature: Neighboring YAML Front Matter Then I should not see "---" When I go to "/raw-front-matter.php.frontmatter" Then I should see "File Not Found" - + Scenario: YAML not on first line, with encoding Given the Server is running at "frontmatter-neighbor-app" When I go to "/front-matter-encoding.html" @@ -30,12 +30,23 @@ Feature: Neighboring YAML Front Matter Then I should not see "---" When I go to "/front-matter-encoding.html.erb.frontmatter" Then I should see "File Not Found" + + Scenario: Rendering html (json) + Given the Server is running at "frontmatter-neighbor-app" + When I go to "/json-front-matter.html.erb.frontmatter" + Then I should see "File Not Found" + When I go to "/json-front-matter-2.php" + Then I should see "

This is the title

" + Then I should see " + <%= current_page.data.title %> """ And the file "source/front-matter-change.html.erb.frontmatter" has the contents """ @@ -43,8 +54,6 @@ Feature: Neighboring YAML Front Matter title: Hello World layout: false --- - - FileB """ When I go to "/front-matter-change.html" Then I should see "Hello World" @@ -54,8 +63,6 @@ Feature: Neighboring YAML Front Matter title: Hola Mundo layout: false --- - - FileC """ When I go to "/front-matter-change.html" Then I should see "Hola Mundo" @@ -129,23 +136,3 @@ Feature: Neighboring YAML Front Matter Then I should see "Layout in use: Override" When I go to "/page_mentioned.html.erb.frontmatter" Then I should see "File Not Found" - - # Scenario: Neighbor frontmatter for destination of proxy resources - # Given the Server is running at "frontmatter-settings-neighbor-app" - # And the file "source/proxied_with_frontmatter.html.frontmatter" has the contents - # """ - # --- - # title: Proxied title - # --- - # """ - # And the file "source/ignored.html.erb" has the contents - # """ - # --- - # ignored: true - # --- - - # <%= current_resource.data.inspect %> - # <%= current_resource.data.title %> - # """ - # When I go to "/proxied_with_frontmatter.html" - # Then I should see "Proxied title" diff --git a/middleman-core/features/front-matter.feature b/middleman-core/features/front-matter.feature index 64bcb94b..1775bc36 100644 --- a/middleman-core/features/front-matter.feature +++ b/middleman-core/features/front-matter.feature @@ -18,33 +18,39 @@ Feature: YAML Front Matter Then I should see "This is a document" - Then I should see "

To be or not to be

" - Then I should see "The meaning of life is 42" - Then I should not see "..." - Then I should not see "layout: false" - Then I should not see "title: Pandoc likes trailing dots..." - - Scenario: Rendering Haml (yaml) - Given the Server is running at "frontmatter-app" - When I go to "/front-matter-haml.html" - Then I should see "

This is the title

" - Then I should not see "---" - Scenario: YAML not on first line, no encoding Given the Server is running at "frontmatter-app" When I go to "/front-matter-line-2.html" Then I should see "

" Then I should see "---" - + Scenario: YAML not on first line, with encoding Given the Server is running at "frontmatter-app" When I go to "/front-matter-encoding.html" Then I should see "

This is the title

" Then I should not see "---" + + Scenario: Rendering html (json) + Given the Server is running at "frontmatter-app" + When I go to "/json-front-matter.html" + Then I should see "

This is the title

" + Then I should not see ";;;" + When I go to "/json-front-matter-2.php" + Then I should see "

This is the title

" + Then I should see "" + Then I should see ";;;" + + Scenario: JSON not on first line, with encoding + Given the Server is running at "frontmatter-app" + When I go to "/json-front-matter-encoding.html" + Then I should see "

This is the title

" + Then I should not see ";;;" Scenario: A template changes frontmatter during preview Given the Server is running at "frontmatter-app" diff --git a/middleman-core/features/gzip.feature b/middleman-core/features/gzip.feature index 643972bc..93ae2cf5 100644 --- a/middleman-core/features/gzip.feature +++ b/middleman-core/features/gzip.feature @@ -3,13 +3,14 @@ Feature: GZIP assets during build Scenario: Built assets should be gzipped Given a successfully built app at "gzip-app" Then the following files should exist: - | build/index.html | + | build/javascripts/test.js.gz | + | build/stylesheets/test.css.gz | | build/index.html.gz | | build/javascripts/test.js | - | build/javascripts/test.js.gz | | build/stylesheets/test.css | - | build/stylesheets/test.css.gz | - And the file "build/javascripts/test.js.gz" should be gzipped + | build/index.html | + When I run `file build/javascripts/test.js.gz` + Then the output should contain "gzip" Scenario: Preview server doesn't change Given the Server is running at "gzip-app" @@ -17,35 +18,4 @@ Feature: GZIP assets during build Then I should see "test_function" When I go to "/stylesheets/test.css" Then I should see "test_selector" - - Scenario: Only specified extensions should be gzipped - Given a fixture app "gzip-app" - And a file named "config.rb" with: - """ - activate :gzip, exts: %w(.htm .html .js .xhtml) - """ - And a successfully built app at "gzip-app" - Then the following files should exist: - | build/index.html | - | build/index.html.gz | - | build/javascripts/test.js | - | build/javascripts/test.js.gz | - | build/stylesheets/test.css | - And the following files should not exist: - | build/stylesheets/test.css.gz | - - Scenario: Gzipped files are not produced for ignored paths - Given a fixture app "gzip-app" - And a file named "config.rb" with: - """ - activate :gzip, ignore: ['index.html', %r(javascripts/.*)] - """ - And a successfully built app at "gzip-app" - Then the following files should exist: - | build/index.html | - | build/javascripts/test.js | - | build/stylesheets/test.css | - | build/stylesheets/test.css.gz | - And the following files should not exist: - | build/index.html.gz | - | build/javascripts/test.js.gz | + \ No newline at end of file diff --git a/middleman-core/features/helpers_auto_javascript_include_tag.feature b/middleman-core/features/helpers_auto_javascript_include_tag.feature index ffcf7df5..4407ea72 100644 --- a/middleman-core/features/helpers_auto_javascript_include_tag.feature +++ b/middleman-core/features/helpers_auto_javascript_include_tag.feature @@ -6,11 +6,6 @@ Feature: Built-in auto_javascript_include_tag view helper When I go to "/auto-js.html" Then I should see "javascripts/auto-js.js" - Scenario: Viewing the root path (directory index) - Given the Server is running at "auto-js-directory-index-app" - When I go to "/auto-js/index.html" - Then I should see "javascripts/auto-js.js" - Scenario: Viewing the root path (build mode) Given a successfully built app at "auto-js-app" When I cd to "build" diff --git a/middleman-core/features/helpers_content_tag.feature b/middleman-core/features/helpers_content_tag.feature index 16d57957..4c54aae7 100644 --- a/middleman-core/features/helpers_content_tag.feature +++ b/middleman-core/features/helpers_content_tag.feature @@ -5,8 +5,8 @@ Feature: content_tag helper And an empty file named "config.rb" And a file named "source/index.html.erb" with: """ - <%= content_tag :div, "world", class: 'one' %> - <% content_tag :where, class: 'the hell is' do %> + <%= content_tag :div, "world", :class => 'one' %> + <% content_tag :where, :class => 'the hell is' do %> damn croissant <% end %> """ diff --git a/middleman-core/features/helpers_form_tag.feature b/middleman-core/features/helpers_form_tag.feature index f1abaf5f..643ca18a 100644 --- a/middleman-core/features/helpers_form_tag.feature +++ b/middleman-core/features/helpers_form_tag.feature @@ -5,16 +5,16 @@ Feature: form_tag helper And an empty file named "config.rb" And a file named "source/form_tag.html.erb" with: """ - absolute: <% form_tag "/needs_index.html#absolute", relative: true do %> + absolute: <% form_tag "/needs_index.html#absolute", :relative => true do %> <% end %> - relative: <% form_tag "needs_index.html#relative", relative: true do %> + relative: <% form_tag "needs_index.html#relative", :relative => true do %> <% end %> """ And a file named "source/form_tag/sub.html.erb" with: """ - absolute: <% form_tag "/needs_index.html#absolute", relative: true do %> + absolute: <% form_tag "/needs_index.html#absolute", :relative => true do %> <% end %> - relative: <% form_tag "../needs_index.html#relative", relative: true do %> + relative: <% form_tag "../needs_index.html#relative", :relative => true do %> <% end %> """ And the Server is running at "indexable-app" diff --git a/middleman-core/features/helpers_link_to.feature b/middleman-core/features/helpers_link_to.feature index fe8e8530..162c1e8a 100644 --- a/middleman-core/features/helpers_link_to.feature +++ b/middleman-core/features/helpers_link_to.feature @@ -5,24 +5,6 @@ Feature: link_to helper When I go to "/link_to_erb.html" Then I should see "erb with html tags" - Scenario: link_to works with absolute URLs (where the relative part matches a local path) - Given a fixture app "link-to-app" - And a file named "config.rb" with: - """ - set :relative_links, true - """ - And a file named "source/test.html.erb" with: - """ - Hello - """ - And a file named "source/link_to_absolute.html.erb" with: - """ - <%= link_to "test", "http://google.com/test.html" %> - """ - And the Server is running at "link-to-app" - When I go to "/link_to_absolute.html" - Then I should see 'test' - Scenario: link_to works with blocks (slim) Given the Server is running at "link-to-app" When I go to "/link_to_slim.html" @@ -38,31 +20,21 @@ Feature: link_to helper And an empty file named "config.rb" And a file named "source/link_to.html.erb" with: """ - absolute: <%= link_to "Needs Index", "/needs_index.html", relative: true %> - relative: <%= link_to "Relative", "needs_index.html", relative: true %> - - absolute spaces: <%= link_to "Spaces Index", "/evil spaces.html", relative: true %> - relative spaces: <%= link_to "Spaces Relative", "evil spaces.html", relative: true %> + absolute: <%= link_to "Needs Index", "/needs_index.html", :relative => true %> + relative: <%= link_to "Relative", "needs_index.html", :relative => true %> """ And a file named "source/link_to/sub.html.erb" with: """ - absolute: <%= link_to "Needs Index", "/needs_index.html", relative: true %> - relative: <%= link_to "Relative", "../needs_index.html", relative: true %> - - absolute spaces: <%= link_to "Spaces Index", "/evil spaces.html", relative: true %> - relative spaces: <%= link_to "Spaces Relative", "../evil spaces.html", relative: true %> + absolute: <%= link_to "Needs Index", "/needs_index.html", :relative => true %> + relative: <%= link_to "Relative", "../needs_index.html", :relative => true %> """ And the Server is running at "indexable-app" When I go to "/link_to.html" Then I should see 'absolute: Needs Index' Then I should see 'relative: Relative' - Then I should see 'absolute spaces: Spaces Index' - Then I should see 'relative spaces: Spaces Relative' When I go to "/link_to/sub.html" Then I should see 'absolute: Needs Index' Then I should see 'relative: Relative' - Then I should see 'absolute spaces: Spaces Index' - Then I should see 'relative spaces: Spaces Relative' Scenario: link_to relative works with strip_index_file Given a fixture app "indexable-app" @@ -107,7 +79,7 @@ Feature: link_to helper And a file named "source/link_to.html.erb" with: """ absolute: <%= link_to "Needs Index", "/needs_index.html" %> - relative: <%= link_to "Relative", "needs_index.html", relative: false %> + relative: <%= link_to "Relative", "needs_index.html", :relative => false %> unknown: <%= link_to "Unknown", "foo.html" %> """ And a file named "source/link_to/sub.html.erb" with: @@ -123,18 +95,18 @@ Feature: link_to helper When I go to "/link_to/sub.html" Then I should see 'absolute: Needs Index' Then I should see 'relative: Relative' - + Scenario: link_to knows about directory indexes Given a fixture app "indexable-app" And a file named "source/link_to.html.erb" with: """ - absolute: <%= link_to "Needs Index", "/needs_index.html", relative: true %> - relative: <%= link_to "Relative", "needs_index.html", relative: true %> + absolute: <%= link_to "Needs Index", "/needs_index.html", :relative => true %> + relative: <%= link_to "Relative", "needs_index.html", :relative => true %> """ And a file named "source/link_to/sub.html.erb" with: """ - absolute: <%= link_to "Needs Index", "/needs_index.html", relative: true %> - relative: <%= link_to "Relative", "../needs_index.html", relative: true %> + absolute: <%= link_to "Needs Index", "/needs_index.html", :relative => true %> + relative: <%= link_to "Relative", "../needs_index.html", :relative => true %> """ And the Server is running at "indexable-app" When I go to "/link_to/" @@ -186,8 +158,8 @@ Feature: link_to helper Given a fixture app "indexable-app" And a file named "source/link_to.html.erb" with: """ - <%= link_to "Needs Index String", "/needs_index.html", query: "foo" %> - <%= link_to "Needs Index Hash", "/needs_index.html", query: { foo: :bar } %> + <%= link_to "Needs Index String", "/needs_index.html", :query => "foo" %> + <%= link_to "Needs Index Hash", "/needs_index.html", :query => { :foo => :bar } %> """ And the Server is running at "indexable-app" When I go to "/link_to/" diff --git a/middleman-core/features/helpers_select_tag.feature b/middleman-core/features/helpers_select_tag.feature index fff51c74..54bf1e54 100644 --- a/middleman-core/features/helpers_select_tag.feature +++ b/middleman-core/features/helpers_select_tag.feature @@ -9,9 +9,11 @@ Feature: select_tag helper """ And the Server is running at "indexable-app" When I go to "/select_tag.html" - Then I should see '' + Then I should see: + """ + + """ diff --git a/middleman-core/features/helpers_url_for.feature b/middleman-core/features/helpers_url_for.feature index 840dcc9d..c2b5a5a8 100644 --- a/middleman-core/features/helpers_url_for.feature +++ b/middleman-core/features/helpers_url_for.feature @@ -5,13 +5,13 @@ Feature: url_for helper And an empty file named "config.rb" And a file named "source/url_for.html.erb" with: """ - absolute: <%= url_for "/needs_index.html", relative: true %> - relative: <%= url_for "needs_index.html", relative: true %> + absolute: <%= url_for "/needs_index.html", :relative => true %> + relative: <%= url_for "needs_index.html", :relative => true %> """ And a file named "source/url_for/sub.html.erb" with: """ - absolute: <%= url_for "/needs_index.html", relative: true %> - relative: <%= url_for "../needs_index.html", relative: true %> + absolute: <%= url_for "/needs_index.html", :relative => true %> + relative: <%= url_for "../needs_index.html", :relative => true %> """ And the Server is running at "indexable-app" When I go to "/url_for.html" @@ -64,7 +64,7 @@ Feature: url_for helper And a file named "source/url_for.html.erb" with: """ absolute: <%= url_for "/needs_index.html" %> - relative: <%= url_for "needs_index.html", relative: false %> + relative: <%= url_for "needs_index.html", :relative => false %> unknown: <%= url_for "foo.html" %> """ And a file named "source/url_for/sub.html.erb" with: @@ -85,13 +85,13 @@ Feature: url_for helper Given a fixture app "indexable-app" And a file named "source/url_for.html.erb" with: """ - absolute: <%= url_for "/needs_index.html", relative: true %> - relative: <%= url_for "needs_index.html", relative: true %> + absolute: <%= url_for "/needs_index.html", :relative => true %> + relative: <%= url_for "needs_index.html", :relative => true %> """ And a file named "source/url_for/sub.html.erb" with: """ - absolute: <%= url_for "/needs_index.html", relative: true %> - relative: <%= url_for "../needs_index.html", relative: true %> + absolute: <%= url_for "/needs_index.html", :relative => true %> + relative: <%= url_for "../needs_index.html", :relative => true %> """ And the Server is running at "indexable-app" When I go to "/url_for/" @@ -143,8 +143,8 @@ Feature: url_for helper Given a fixture app "indexable-app" And a file named "source/url_for.html.erb" with: """ - Needs Index String <%= url_for "/needs_index.html", query: "foo" %> - Needs Index Hash <%= url_for "/needs_index.html", query: { foo: :bar } %> + Needs Index String <%= url_for "/needs_index.html", :query => "foo" %> + Needs Index Hash <%= url_for "/needs_index.html", :query => { :foo => :bar } %> """ And the Server is running at "indexable-app" When I go to "/url_for/" diff --git a/middleman-core/features/i18n_link_to.feature b/middleman-core/features/i18n_link_to.feature deleted file mode 100644 index 9d3f0682..00000000 --- a/middleman-core/features/i18n_link_to.feature +++ /dev/null @@ -1,209 +0,0 @@ -Feature: i18n Paths - - Scenario: link_to is i18n aware - Given a fixture app "empty-app" - And a file named "data/pages.yml" with: - """ - - hello.html - """ - And a file named "locales/en.yml" with: - """ - --- - en: - msg: Hello - home: Home - """ - And a file named "locales/es.yml" with: - """ - --- - es: - paths: - hello: "hola" - msg: Hola - home: Casa - """ - And a file named "source/localizable/index.html.erb" with: - """ - Page: <%= t(:hom) %> - """ - And a file named "source/localizable/hello.html.erb" with: - """ - Page: <%= t(:msg) %> - - <%= link_to "Current Home", "/index.html", class: 'current' %> - <%= link_to "Other Home", "/index.html", title: "Other Home", locale: ::I18n.locale == :en ? :es : :en %> - <% link_to "/index.html", class: 'current' do %>Home: Current Block<% end %> - <% link_to "/index.html", title: "Other Home", locale: ::I18n.locale == :en ? :es : :en do %>Home: Other Block<% end %> - - <% data.pages.each_with_index do |p, i| %> - <%= link_to "Current #{p}", "/#{p}", class: 'current' %> - <%= link_to "Other #{p}", "/#{p}", title: "Other #{p}", locale: ::I18n.locale == :en ? :es : :en %> - <% link_to "/#{p}", class: 'current' do %>Current Block<% end %> - <% link_to "/#{p}", title: "Other #{p}", locale: ::I18n.locale == :en ? :es : :en do %>Other Block<% end %> - <% end %> - """ - And a file named "config.rb" with: - """ - set :strip_index_file, false - activate :i18n, mount_at_root: :en - """ - Given the Server is running at "empty-app" - When I go to "/hello.html" - Then I should see "Page: Hello" - Then I should see 'Current Home' - Then I should see 'Other Home' - Then I should see 'Home: Current Block' - Then I should see 'Home: Other Block' - Then I should see 'Current hello.html' - Then I should see 'Other hello.html' - Then I should see 'Current Block' - Then I should see 'Other Block' - When I go to "/es/hola.html" - Then I should see "Page: Hola" - Then I should see 'Current Home' - Then I should see 'Other Home' - Then I should see 'Home: Current Block' - Then I should see 'Home: Other Block' - Then I should see 'Current hello.html' - Then I should see 'Other hello.html' - Then I should see 'Current Block' - Then I should see 'Other Block' - - Scenario: link_to is i18n aware and supports relative_links - Given a fixture app "empty-app" - And a file named "locales/en.yml" with: - """ - --- - en: - msg: Hello - home: Home - """ - And a file named "locales/es.yml" with: - """ - --- - es: - paths: - hello: "hola" - msg: Hola - home: Casa - """ - And a file named "source/assets/css/main.css.scss" with: - """ - $color: red; - body { background: $color; } - """ - And a file named "source/localizable/index.html.erb" with: - """ - Page: <%= t(:home) %> - <%= stylesheet_link_tag :main %> - """ - And a file named "source/localizable/hello.html.erb" with: - """ - Page: <%= t(:msg) %> - - <%= link_to "Current Home", "/index.html", class: 'current' %> - <%= link_to "Other Home", "/index.html", title: "Other Home", locale: ::I18n.locale == :en ? :es : :en %> - <% link_to "/index.html", class: 'current' do %>Home: Current Block<% end %> - <% link_to "/index.html", title: "Other Home", locale: ::I18n.locale == :en ? :es : :en do %>Home: Other Block<% end %> - - <%= link_to "Current hello.html", "/hello.html", class: 'current' %> - <%= link_to "Other hello.html", "/hello.html", title: "Other hello.html", locale: ::I18n.locale == :en ? :es : :en %> - <% link_to "/hello.html", class: 'current' do %>Current Block<% end %> - <% link_to "/hello.html", title: "Other hello.html", locale: ::I18n.locale == :en ? :es : :en do %>Other Block<% end %> - """ - And a file named "config.rb" with: - """ - set :css_dir, 'assets/css' - set :relative_links, true - set :strip_index_file, false - activate :i18n, mount_at_root: :en - activate :relative_assets - """ - Given the Server is running at "empty-app" - When I go to "/index.html" - Then I should see "assets/css/main.css" - When I go to "/hello.html" - Then I should see "Page: Hello" - Then I should see 'Current Home' - Then I should see 'Other Home' - Then I should see 'Home: Current Block' - Then I should see 'Home: Other Block' - Then I should see 'Current hello.html' - Then I should see 'Other hello.html' - Then I should see 'Current Block' - Then I should see 'Other Block' - When I go to "/es/hola.html" - Then I should see "Page: Hola" - Then I should see 'Current Home' - Then I should see 'Other Home' - Then I should see 'Home: Current Block' - Then I should see 'Home: Other Block' - Then I should see 'Current hello.html' - Then I should see 'Other hello.html' - Then I should see 'Current Block' - Then I should see 'Other Block' - - Scenario: url_for is i18n aware - Given a fixture app "empty-app" - And a file named "data/pages.yml" with: - """ - - hello.html - - article.html - """ - And a file named "locales/en.yml" with: - """ - --- - en: - msg: Hello - """ - And a file named "locales/es.yml" with: - """ - --- - es: - paths: - hello: "hola" - msg: Hola - """ - And a file named "source/localizable/hello.html.erb" with: - """ - Page: <%= t(:msg) %> - <% data.pages.each_with_index do |p, i| %> - Current: <%= url_for "/#{p}" %> - Other: <%= url_for "/#{p}", locale: ::I18n.locale == :en ? :es : :en %> - <% end %> - """ - And a file named "source/localizable/article.html.erb" with: - """ - Page Lang: Default - - Current: <%= url_for "/article.html" %> - Other: <%= url_for "/article.html", locale: ::I18n.locale == :en ? :es : :en %> - """ - And a file named "source/localizable/article.es.html.erb" with: - """ - Page Lang: Spanish - - Current: <%= url_for "/article.html" %> - Other: <%= url_for "/article.html", locale: :en %> - """ - And a file named "config.rb" with: - """ - activate :i18n, mount_at_root: :en - """ - Given the Server is running at "empty-app" - When I go to "/hello.html" - Then I should see "Page: Hello" - Then I should see 'Current: /hello.html' - Then I should see 'Other: /es/hola.html' - When I go to "/es/hola.html" - Then I should see "Page: Hola" - Then I should see 'Current: /es/hola.html' - Then I should see 'Other: /hello.html' - When I go to "/article.html" - Then I should see "Page Lang: Default" - Then I should see 'Current: /article.html' - Then I should see 'Other: /es/article.html' - When I go to "/es/article.html" - Then I should see "Page Lang: Spanish" - Then I should see 'Current: /es/article.html' - Then I should see 'Other: /article.html' diff --git a/middleman-core/features/i18n_mixed_sources.feature b/middleman-core/features/i18n_mixed_sources.feature deleted file mode 100644 index 7ea92028..00000000 --- a/middleman-core/features/i18n_mixed_sources.feature +++ /dev/null @@ -1,39 +0,0 @@ -Feature: i18n merging path trees - - Scenario: Mixing localized and non-localized sources and merging the path trees (see issue #1709) - Given a fixture app "i18n-test-app" - And a file named "config.rb" with: - """ - activate :i18n, mount_at_root: :en, langs: [:en, :es] - """ - Given the Server is running at "i18n-mixed-sources" - - When I go to "/" - Then I should see "Current locale: en" - Then I should see "path: is-localized Home" - When I go to "/es" - Then I should see "Current locale: es" - Then I should see "path: is-localized Home" - - When I go to "/a/" - Then I should see "Current locale: en" - Then I should see "path: is-localized Home # a/index.html.erb" - When I go to "/es/a/" - Then I should see "Current locale: es" - Then I should see "path: is-localized Home # a/index.html.erb" - - When I go to "/b/" - Then I should see "Current locale: en" - Then I should see "path: is-localized Home # b/index.html.erb" - - When I go to "/a/sub.html" - Then I should see "Current locale: en" - Then I should see "path: is-localized Home # a/index.html.erb # a/sub.html.erb" - - When I go to "/b/sub.html" - Then I should see "Current locale: en" - Then I should see "path: is-localized Home # b/index.html.erb # b/sub.html.erb" - - When I go to "/es/b/sub.html" - Then I should see "Current locale: es" - Then I should see "path: is-localized Home # b/index.html.erb # b/sub.html.erb" diff --git a/middleman-core/features/i18n_partials.feature b/middleman-core/features/i18n_partials.feature deleted file mode 100644 index f4f947c0..00000000 --- a/middleman-core/features/i18n_partials.feature +++ /dev/null @@ -1,23 +0,0 @@ -Feature: i18n Partials - - Scenario: Running localize with the default config - Given a fixture app "i18n-test-app" - And a file named "config.rb" with: - """ - activate :i18n - """ - Given the Server is running at "i18n-test-app" - When I go to "/partials/index.html" - Then I should see "Country: USA" - Then I should see "State: District of Columbia" - Then I should see "Greeting: Hello" - Then I should see "Site: Locale Site" - Then I should see "Flag: stars" - Then I should see "President: obama" - When I go to "/es/partials/index.html" - Then I should see "Country: Mexico" - Then I should see "State: Distrito Federal" - Then I should see "Greeting: Hola" - Then I should see "Site: Locale Site" - Then I should see "Flag: bars" - Then I should see "President: nieto" \ No newline at end of file diff --git a/middleman-core/features/i18n_builder.feature b/middleman-core/features/i18n_v3_builder.feature similarity index 86% rename from middleman-core/features/i18n_builder.feature rename to middleman-core/features/i18n_v3_builder.feature index 6129f250..c9b41592 100644 --- a/middleman-core/features/i18n_builder.feature +++ b/middleman-core/features/i18n_v3_builder.feature @@ -1,13 +1,13 @@ -Feature: i18n Builder +Feature: i18n v3 Builder In order to preview localized html Scenario: Running localize with the default config - Given a fixture app "i18n-test-app" + Given a fixture app "i18n-v3-test-app" And a file named "config.rb" with: """ - activate :i18n + activate :i18n_v3 """ - Given a successfully built app at "i18n-test-app" + Given a successfully built app at "i18n-v3-test-app" When I cd to "build" Then the following files should exist: | index.html | @@ -46,12 +46,12 @@ Feature: i18n Builder And the file "password.txt" should contain "hunter2" Scenario: Running localize with the alt path config - Given a fixture app "i18n-test-app" + Given a fixture app "i18n-v3-test-app" And a file named "config.rb" with: """ - activate :i18n, path: "/lang_:locale/" + activate :i18n_v3, :path => "/lang_:locale/" """ - Given a successfully built app at "i18n-test-app" + Given a successfully built app at "i18n-v3-test-app" When I cd to "build" Then the following files should exist: | index.html | @@ -66,12 +66,12 @@ Feature: i18n Builder And the file "lang_es/hola.html" should contain "Hola World" Scenario: Running localize with the alt root config - Given a fixture app "i18n-alt-root-app" + Given a fixture app "i18n-v3-alt-root-app" And a file named "config.rb" with: """ - activate :i18n, templates_dir: "lang_data" + activate :i18n_v3, :templates_dir => "lang_data" """ - Given a successfully built app at "i18n-alt-root-app" + Given a successfully built app at "i18n-v3-alt-root-app" When I cd to "build" Then the following files should exist: | index.html | @@ -86,12 +86,12 @@ Feature: i18n Builder And the file "es/hola.html" should contain "Hola World" Scenario: Running localize with the lang map config - Given a fixture app "i18n-test-app" + Given a fixture app "i18n-v3-test-app" And a file named "config.rb" with: """ - activate :i18n, lang_map: { en: :english, es: :spanish } + activate :i18n_v3, :lang_map => { :en => :english, :es => :spanish } """ - Given a successfully built app at "i18n-test-app" + Given a successfully built app at "i18n-v3-test-app" When I cd to "build" Then the following files should exist: | index.html | @@ -106,12 +106,12 @@ Feature: i18n Builder And the file "spanish/hola.html" should contain "Hola World" Scenario: Running localize with the no mount config - Given a fixture app "i18n-test-app" + Given a fixture app "i18n-v3-test-app" And a file named "config.rb" with: """ - activate :i18n, mount_at_root: false + activate :i18n_v3, :mount_at_root => false """ - Given a successfully built app at "i18n-test-app" + Given a successfully built app at "i18n-v3-test-app" When I cd to "build" Then the following files should exist: | en/index.html | @@ -127,12 +127,12 @@ Feature: i18n Builder And the file "es/hola.html" should contain "Hola World" Scenario: Running localize with the subset config - Given a fixture app "i18n-test-app" + Given a fixture app "i18n-v3-test-app" And a file named "config.rb" with: """ - activate :i18n, langs: [:en] + activate :i18n_v3, :langs => [:en] """ - Given a successfully built app at "i18n-test-app" + Given a successfully built app at "i18n-v3-test-app" When I cd to "build" Then the following files should exist: | index.html | @@ -145,13 +145,13 @@ Feature: i18n Builder And the file "hello.html" should contain "Hello World" Scenario: Running localize with relative_assets - Given a fixture app "i18n-test-app" + Given a fixture app "i18n-v3-test-app" And a file named "config.rb" with: """ - activate :i18n + activate :i18n_v3 activate :relative_assets """ - Given a successfully built app at "i18n-test-app" + Given a successfully built app at "i18n-v3-test-app" When I cd to "build" Then the following files should exist: | index.html | diff --git a/middleman-core/features/i18n_force_locale.feature b/middleman-core/features/i18n_v3_force_locale.feature similarity index 80% rename from middleman-core/features/i18n_force_locale.feature rename to middleman-core/features/i18n_v3_force_locale.feature index afe8fc3b..8d57d486 100644 --- a/middleman-core/features/i18n_force_locale.feature +++ b/middleman-core/features/i18n_v3_force_locale.feature @@ -1,7 +1,7 @@ -Feature: i18n manually setting locale +Feature: i18n v3 manually setting locale Scenario: Setting I18n.locale in a block (see issue #809) or with the :lang option - Given the Server is running at "i18n-force-locale" + Given the Server is running at "i18n-v3-force-locale" When I go to "/en/index.html" Then I should see "Hello" Then I should see "I18n.locale: en" diff --git a/middleman-core/features/i18n_v3_preview.feature b/middleman-core/features/i18n_v3_preview.feature new file mode 100644 index 00000000..47b083fa --- /dev/null +++ b/middleman-core/features/i18n_v3_preview.feature @@ -0,0 +1,252 @@ +Feature: i18n v3 Preview + In order to preview localized html + + Scenario: Running localize with the default config + Given a fixture app "i18n-v3-test-app" + And a file named "config.rb" with: + """ + activate :i18n_v3 + """ + Given the Server is running at "i18n-v3-test-app" + When I go to "/" + Then I should see "Howdy" + When I go to "/hello.html" + Then I should see "Hello World" + When I go to "/morning.html" + Then I should see "Good morning" + When I go to "/one.html" + Then I should see "Only one" + When I go to "/defaults_en/index.html" + Then I should see "File Not Found" + When I go to "/en/index.html" + Then I should see "File Not Found" + When I go to "/en/morning.html" + Then I should see "File Not Found" + When I go to "/defaults_es/index.html" + Then I should see "File Not Found" + When I go to "/es/index.html" + Then I should see "Como Esta?" + When I go to "/es/hola.html" + Then I should see "Hola World" + When I go to "/es/manana.html" + Then I should see "Buenos días" + When I go to "/es/una.html" + Then I should see "Solamente una" + + Scenario: A template changes i18n during preview + Given a fixture app "i18n-v3-test-app" + And a file named "config.rb" with: + """ + activate :i18n_v3 + """ + Given the Server is running at "i18n-v3-test-app" + And the file "locales/en.yml" has the contents + """ + --- + en: + greetings: "Howdy" + hi: "Hello" + """ + When I go to "/" + Then I should see "Howdy" + When I go to "/hello.html" + Then I should see "Hello World" + When the file "locales/en.yml" has the contents + """ + --- + en: + greetings: "How You Doin" + hi: "Sup" + """ + When I go to "/" + Then I should see "How You Doin" + When I go to "/hello.html" + Then I should see "Sup World" + + Scenario: Running localize with the alt path config + Given a fixture app "i18n-v3-test-app" + And a file named "config.rb" with: + """ + activate :i18n_v3, :path => "/lang_:locale/" + """ + Given the Server is running at "i18n-v3-test-app" + When I go to "/" + Then I should see "Howdy" + When I go to "/hello.html" + Then I should see "Hello World" + When I go to "/lang_en/index.html" + Then I should see "File Not Found" + When I go to "/lang_es/index.html" + Then I should see "Como Esta?" + When I go to "/lang_es/hola.html" + Then I should see "Hola World" + + + Scenario: Running localize with the alt root config + Given a fixture app "i18n-v3-alt-root-app" + And a file named "config.rb" with: + """ + activate :i18n_v3, :templates_dir => "lang_data" + """ + Given the Server is running at "i18n-v3-alt-root-app" + When I go to "/" + Then I should see "Howdy" + When I go to "/hello.html" + Then I should see "Hello World" + When I go to "/en/index.html" + Then I should see "File Not Found" + When I go to "/es/index.html" + Then I should see "Como Esta?" + When I go to "/es/hola.html" + Then I should see "Hola World" + + Scenario: Running localize with the lang map config + Given a fixture app "i18n-v3-test-app" + And a file named "config.rb" with: + """ + activate :i18n_v3, :lang_map => { :en => :english, :es => :spanish } + """ + Given the Server is running at "i18n-v3-test-app" + When I go to "/" + Then I should see "Howdy" + When I go to "/hello.html" + Then I should see "Hello World" + When I go to "/english/index.html" + Then I should see "File Not Found" + When I go to "/spanish/index.html" + Then I should see "Como Esta?" + When I go to "/spanish/hola.html" + Then I should see "Hola World" + + Scenario: Running localize with a non-English mount config + Given a fixture app "i18n-v3-test-app" + And a file named "config.rb" with: + """ + activate :i18n_v3, :mount_at_root => :es + """ + Given the Server is running at "i18n-v3-test-app" + When I go to "/en/index.html" + Then I should see "Howdy" + When I go to "/en/hello.html" + Then I should see "Hello World" + When I go to "/" + Then I should see "Como Esta?" + When I go to "/hola.html" + Then I should see "Hola World" + When I go to "/manana.html" + Then I should see "Buenos días" + When I go to "/hello.html" + Then I should see "File Not Found" + When I go to "/en/morning.html" + Then I should see "Good morning" + When I go to "/es/manana.html" + Then I should see "File Not Found" + When I go to "/es/index.html" + Then I should see "File Not Found" + When I go to "/es/hola.html" + Then I should see "File Not Found" + + Scenario: Running localize with a non-English lang subset + Given a fixture app "i18n-v3-test-app" + And a file named "config.rb" with: + """ + activate :i18n_v3, :langs => :es + """ + Given the Server is running at "i18n-v3-test-app" + When I go to "/en/index.html" + Then I should see "File Not Found" + When I go to "/en/hello.html" + Then I should see "File Not Found" + When I go to "/" + Then I should see "Como Esta?" + When I go to "/hola.html" + Then I should see "Hola World" + When I go to "/hello.html" + Then I should see "File Not Found" + When I go to "/es/index.html" + Then I should see "File Not Found" + When I go to "/es/hola.html" + Then I should see "File Not Found" + + + Scenario: Running localize with the no mount config + Given a fixture app "i18n-v3-test-app" + And a file named "config.rb" with: + """ + activate :i18n_v3, :mount_at_root => false + """ + Given the Server is running at "i18n-v3-test-app" + When I go to "/en/index.html" + Then I should see "Howdy" + When I go to "/en/hello.html" + Then I should see "Hello World" + When I go to "/" + Then I should see "File Not Found" + When I go to "/hello.html" + Then I should see "File Not Found" + When I go to "/es/index.html" + Then I should see "Como Esta?" + When I go to "/es/hola.html" + Then I should see "Hola World" + + Scenario: Running localize with the subset config + Given a fixture app "i18n-v3-test-app" + And a file named "config.rb" with: + """ + activate :i18n_v3, :langs => [:en] + """ + Given the Server is running at "i18n-v3-test-app" + When I go to "/" + Then I should see "Howdy" + When I go to "/hello.html" + Then I should see "Hello World" + When I go to "/en/index.html" + Then I should see "File Not Found" + When I go to "/es/index.html" + Then I should see "File Not Found" + When I go to "/es/hola.html" + Then I should see "File Not Found" + + Scenario: Running localize with relative_assets + Given a fixture app "i18n-v3-test-app" + And a file named "config.rb" with: + """ + activate :i18n_v3 + activate :relative_assets + """ + Given the Server is running at "i18n-v3-test-app" + When I go to "/" + Then I should see '"stylesheets/site.css"' + When I go to "/hello.html" + Then I should see '"stylesheets/site.css"' + When I go to "/es/index.html" + Then I should see '"../stylesheets/site.css"' + When I go to "/es/hola.html" + Then I should see '"../stylesheets/site.css"' + + Scenario: Missing translations fall back to the default locale + Given a fixture app "i18n-v3-default-app" + And a file named "config.rb" with: + """ + activate :i18n_v3, :mount_at_root => :es + """ + Given the Server is running at "i18n-v3-default-app" + When I go to "/en/" + Then I should see "Default locale: es" + Then I should see "Current locale: en" + Then I should see "Buenos días" + Then I should see "Howdy" + + Scenario: Nested i18n yaml + Given a fixture app "i18n-v3-nested-app" + And a file named "config.rb" with: + """ + activate :i18n_v3 + """ + Given the Server is running at "i18n-v3-nested-app" + When I go to "/" + Then I should see "Howdy" + Then I should see "More" + When I go to "/es/" + Then I should see "Como Esta?" + Then I should see "Mucho" \ No newline at end of file diff --git a/middleman-core/features/i18n_preview.feature b/middleman-core/features/i18n_v4_preview.feature similarity index 80% rename from middleman-core/features/i18n_preview.feature rename to middleman-core/features/i18n_v4_preview.feature index 4b96efcf..df9bd0b0 100644 --- a/middleman-core/features/i18n_preview.feature +++ b/middleman-core/features/i18n_v4_preview.feature @@ -1,13 +1,14 @@ -Feature: i18n Preview +@wip +Feature: i18n v4 Preview In order to preview localized html Scenario: Running localize with the default config - Given a fixture app "i18n-test-app" + Given a fixture app "i18n-v4-test-app" And a file named "config.rb" with: """ activate :i18n """ - Given the Server is running at "i18n-test-app" + Given the Server is running at "i18n-v4-test-app" When I go to "/" Then I should see "Howdy" When I go to "/hello.html" @@ -34,12 +35,12 @@ Feature: i18n Preview Then I should see "Solamente una" Scenario: A template changes i18n during preview - Given a fixture app "i18n-test-app" + Given a fixture app "i18n-v4-test-app" And a file named "config.rb" with: """ activate :i18n """ - Given the Server is running at "i18n-test-app" + Given the Server is running at "i18n-v4-test-app" And the file "locales/en.yml" has the contents """ --- @@ -64,12 +65,12 @@ Feature: i18n Preview Then I should see "Sup World" Scenario: Running localize with the alt path config - Given a fixture app "i18n-test-app" + Given a fixture app "i18n-v4-test-app" And a file named "config.rb" with: """ - activate :i18n, path: "/lang_:locale/" + activate :i18n, :path => "/lang_:locale/" """ - Given the Server is running at "i18n-test-app" + Given the Server is running at "i18n-v4-test-app" When I go to "/" Then I should see "Howdy" When I go to "/hello.html" @@ -83,12 +84,12 @@ Feature: i18n Preview Scenario: Running localize with the alt root config - Given a fixture app "i18n-alt-root-app" + Given a fixture app "i18n-v4-alt-root-app" And a file named "config.rb" with: """ - activate :i18n, templates_dir: "lang_data" + activate :i18n, :templates_dir => "lang_data" """ - Given the Server is running at "i18n-alt-root-app" + Given the Server is running at "i18n-v4-alt-root-app" When I go to "/" Then I should see "Howdy" When I go to "/hello.html" @@ -101,12 +102,12 @@ Feature: i18n Preview Then I should see "Hola World" Scenario: Running localize with the lang map config - Given a fixture app "i18n-test-app" + Given a fixture app "i18n-v4-test-app" And a file named "config.rb" with: """ - activate :i18n, lang_map: { en: :english, es: :spanish } + activate :i18n, :lang_map => { :en => :english, :es => :spanish } """ - Given the Server is running at "i18n-test-app" + Given the Server is running at "i18n-v4-test-app" When I go to "/" Then I should see "Howdy" When I go to "/hello.html" @@ -119,12 +120,12 @@ Feature: i18n Preview Then I should see "Hola World" Scenario: Running localize with a non-English mount config - Given a fixture app "i18n-test-app" + Given a fixture app "i18n-v4-test-app" And a file named "config.rb" with: """ - activate :i18n, mount_at_root: :es + activate :i18n, :mount_at_root => :es """ - Given the Server is running at "i18n-test-app" + Given the Server is running at "i18n-v4-test-app" When I go to "/en/index.html" Then I should see "Howdy" When I go to "/en/hello.html" @@ -147,12 +148,12 @@ Feature: i18n Preview Then I should see "File Not Found" Scenario: Running localize with a non-English lang subset - Given a fixture app "i18n-test-app" + Given a fixture app "i18n-v4-test-app" And a file named "config.rb" with: """ - activate :i18n, langs: :es + activate :i18n, :langs => :es """ - Given the Server is running at "i18n-test-app" + Given the Server is running at "i18n-v4-test-app" When I go to "/en/index.html" Then I should see "File Not Found" When I go to "/en/hello.html" @@ -170,12 +171,12 @@ Feature: i18n Preview Scenario: Running localize with the no mount config - Given a fixture app "i18n-test-app" + Given a fixture app "i18n-v4-test-app" And a file named "config.rb" with: """ - activate :i18n, mount_at_root: false + activate :i18n, :mount_at_root => false """ - Given the Server is running at "i18n-test-app" + Given the Server is running at "i18n-v4-test-app" When I go to "/en/index.html" Then I should see "Howdy" When I go to "/en/hello.html" @@ -190,12 +191,12 @@ Feature: i18n Preview Then I should see "Hola World" Scenario: Running localize with the subset config - Given a fixture app "i18n-test-app" + Given a fixture app "i18n-v4-test-app" And a file named "config.rb" with: """ - activate :i18n, langs: [:en] + activate :i18n, :langs => [:en] """ - Given the Server is running at "i18n-test-app" + Given the Server is running at "i18n-v4-test-app" When I go to "/" Then I should see "Howdy" When I go to "/hello.html" @@ -208,13 +209,13 @@ Feature: i18n Preview Then I should see "File Not Found" Scenario: Running localize with relative_assets - Given a fixture app "i18n-test-app" + Given a fixture app "i18n-v4-test-app" And a file named "config.rb" with: """ activate :i18n activate :relative_assets """ - Given the Server is running at "i18n-test-app" + Given the Server is running at "i18n-v4-test-app" When I go to "/" Then I should see '"stylesheets/site.css"' When I go to "/hello.html" @@ -225,12 +226,12 @@ Feature: i18n Preview Then I should see '"../stylesheets/site.css"' Scenario: Missing translations fall back to the default locale - Given a fixture app "i18n-default-app" + Given a fixture app "i18n-v4-default-app" And a file named "config.rb" with: """ - activate :i18n, mount_at_root: :es + activate :i18n, :mount_at_root => :es """ - Given the Server is running at "i18n-default-app" + Given the Server is running at "i18n-v4-default-app" When I go to "/en/" Then I should see "Default locale: es" Then I should see "Current locale: en" @@ -238,12 +239,12 @@ Feature: i18n Preview Then I should see "Howdy" Scenario: Nested i18n yaml - Given a fixture app "i18n-nested-app" + Given a fixture app "i18n-v4-nested-app" And a file named "config.rb" with: """ activate :i18n """ - Given the Server is running at "i18n-nested-app" + Given the Server is running at "i18n-v4-nested-app" When I go to "/" Then I should see "Howdy" Then I should see "More" diff --git a/middleman-core/features/ignore.feature b/middleman-core/features/ignore.feature index 9e3d4688..166002c5 100644 --- a/middleman-core/features/ignore.feature +++ b/middleman-core/features/ignore.feature @@ -12,7 +12,7 @@ Feature: Ignoring paths And the following files should not exist: | build/plain.html | | build/about.html | - + Scenario: Ignore a single path (server) Given a fixture app "ignore-app" And a file named "config.rb" with: @@ -28,35 +28,6 @@ Feature: Ignoring paths When I go to "/about.html" Then I should see "File Not Found" - Scenario: Ignoring collected values - Given a fixture app "ignore-app" - And a file named "data/ignores.yaml" with: - """ - --- - - "plain" - """ - And a file named "config.rb" with: - """ - data.ignores.each do |name| - ignore "#{name}.html" - end - """ - And the Server is running - When I go to "/plain.html" - Then I should see "File Not Found" - When I go to "/about.html" - Then I should not see "File Not Found" - - When the file "data/ignores.yaml" has the contents - """ - --- - - "about" - """ - When I go to "/plain.html" - Then I should not see "File Not Found" - When I go to "/about.html" - Then I should see "File Not Found" - Scenario: Ignore a globbed path (build) Given a fixture app "ignore-app" And a file named "config.rb" with: @@ -76,7 +47,7 @@ Feature: Ignoring paths | build/reports/index.html | | build/reports/another.html | | build/images/icons/messages.png | - + Scenario: Ignore a globbed path (server) Given a fixture app "ignore-app" And a file named "config.rb" with: @@ -122,7 +93,7 @@ Feature: Ignoring paths | build/reports/index.html | | build/reports/another.html | | build/images/icons/messages.png | - + Scenario: Ignore a regex (server) Given a fixture app "ignore-app" And a file named "config.rb" with: @@ -147,4 +118,4 @@ Feature: Ignoring paths When I go to "/reports/another.html" Then I should see "File Not Found" When I go to "/images/icons/messages.png" - Then I should see "File Not Found" + Then I should see "File Not Found" \ No newline at end of file diff --git a/middleman-core/features/image_srcset_paths.feature b/middleman-core/features/image_srcset_paths.feature deleted file mode 100644 index b6b1046c..00000000 --- a/middleman-core/features/image_srcset_paths.feature +++ /dev/null @@ -1,7 +0,0 @@ -Feature: Support srcset property as params for image_tag helper - This lets you specify responsive image sizes - - Scenario: Rendering an image with the feature enabled - Given the Server is running at "image-srcset-paths-app" - When I go to "/image-srcset-paths.html" - Then I should see '//example.com/remote-image.jpg 2x, /images/blank_3x.jpg 3x' \ No newline at end of file diff --git a/middleman-core/features/import_files.feature b/middleman-core/features/import_files.feature deleted file mode 100644 index faaf2039..00000000 --- a/middleman-core/features/import_files.feature +++ /dev/null @@ -1,15 +0,0 @@ -Feature: Import files - - Scenario: Move one path to another - Given the Server is running at "import-app" - When I go to "/static.html" - Then I should see 'Not Found' - When I go to "/static2.html" - Then I should see 'Static, no code!' - - Scenario: Import all of bower - Given the Server is running at "import-app" - When I go to "/bower_components/jquery/dist/jquery.js" - Then I should see 'jQuery' - When I go to "/bower_components2/jquery/dist/jquery.js" - Then I should see 'jQuery' diff --git a/middleman-core/features/javascript-testing.feature b/middleman-core/features/javascript-testing.feature deleted file mode 100644 index 031d70d0..00000000 --- a/middleman-core/features/javascript-testing.feature +++ /dev/null @@ -1,18 +0,0 @@ -Feature: Test a site with javascript included - - As a software developer - I want to develop a site using javascript - I would like to have a server step rendering javascript correctly in order to test it - - @javascript - Scenario: Existing app with javascript - Given the Server is running at "javascript-app" - When I go to "/index.html" - Then I should see: - """ - Local Hour - """ - And I should see: - """ - Local Minutes - """ diff --git a/middleman-core/features/markdown_kramdown.feature b/middleman-core/features/markdown_kramdown.feature index 667aa58f..3f64a44c 100644 --- a/middleman-core/features/markdown_kramdown.feature +++ b/middleman-core/features/markdown_kramdown.feature @@ -6,7 +6,7 @@ Feature: Markdown (Kramdown) support And a file named "config.rb" with: """ set :markdown_engine, :kramdown - set :markdown, smartypants: true + set :markdown, :smartypants => true """ Given the Server is running at "markdown-app" When I go to "/smarty_pants.html" diff --git a/middleman-core/features/markdown_kramdown_in_haml.feature b/middleman-core/features/markdown_kramdown_in_haml.feature index 5980e1b7..5b5a5871 100644 --- a/middleman-core/features/markdown_kramdown_in_haml.feature +++ b/middleman-core/features/markdown_kramdown_in_haml.feature @@ -33,10 +33,9 @@ Feature: Markdown support in Haml (Kramdown) :markdown [A link](/link_target.html) - ![image](blank.gif){: srcset="image_2x.jpg 2x"} + ![image](blank.gif) """ Given the Server is running at "markdown-in-haml-app" When I go to "/link_and_image/" Then I should see "/link_target/" - Then I should see "/images/image_2x.jpg 2x" Then I should see 'src="/images/blank.gif"' diff --git a/middleman-core/features/markdown_kramdown_in_slim.feature b/middleman-core/features/markdown_kramdown_in_slim.feature deleted file mode 100644 index 9e58a461..00000000 --- a/middleman-core/features/markdown_kramdown_in_slim.feature +++ /dev/null @@ -1,42 +0,0 @@ -Feature: Markdown support in Slim (Kramdown) - In order to test support of the Slim markdown filter - - Scenario: Markdown filter in Slim works (with Kramdown) - Given a fixture app "markdown-in-slim-app" - And a file named "config.rb" with: - """ - set :markdown_engine, :kramdown - activate :directory_indexes - """ - And a file named "source/markdown_filter.html.slim" with: - """ - markdown: - # H1 - - paragraph - """ - Given the Server is running at "markdown-in-slim-app" - When I go to "/markdown_filter/" - Then I should see ">H1" - Then I should see "

paragraph

" - - - Scenario: Markdown filter in Slim uses our link_to and image_tag helpers (with Kramdown) - Given a fixture app "markdown-in-slim-app" - And a file named "config.rb" with: - """ - set :markdown_engine, :kramdown - activate :directory_indexes - """ - And a file named "source/link_and_image.html.slim" with: - """ - markdown: - [A link](/link_target.html) - - ![image](blank.gif){: srcset="image_2x.jpg 2x"} - """ - Given the Server is running at "markdown-in-slim-app" - When I go to "/link_and_image/" - Then I should see "/link_target/" - Then I should see "/images/image_2x.jpg 2x" - Then I should see 'src="/images/blank.gif"' diff --git a/middleman-core/features/markdown_redcarpet.feature b/middleman-core/features/markdown_redcarpet.feature index c0f744ac..7eec709b 100644 --- a/middleman-core/features/markdown_redcarpet.feature +++ b/middleman-core/features/markdown_redcarpet.feature @@ -1,3 +1,4 @@ +@nojava Feature: Markdown (Redcarpet) support In order to test included Redcarpet support @@ -6,14 +7,14 @@ Feature: Markdown (Redcarpet) support And a file named "config.rb" with: """ set :markdown_engine, :redcarpet - set :markdown, no_intra_emphasis: true, - tables: true, - fenced_code_blocks: true, - autolink: true, - strikethrough: true, - space_after_headers: true, - superscript: true, - lax_spacing: true + set :markdown, :no_intra_emphasis => true, + :tables => true, + :fenced_code_blocks => true, + :autolink => true, + :strikethrough => true, + :space_after_headers => true, + :superscript => true, + :lax_spacing => true """ Given the Server is running at "markdown-app" @@ -41,9 +42,9 @@ Feature: Markdown (Redcarpet) support And a file named "config.rb" with: """ set :markdown_engine, :redcarpet - set :markdown, underline: true, - highlight: true, - disable_indented_code_blocks: true + set :markdown, :underline => true, + :highlight => true, + :disable_indented_code_blocks => true """ Given the Server is running at "markdown-app" When I go to "/underline.html" @@ -58,7 +59,7 @@ Feature: Markdown (Redcarpet) support And a file named "config.rb" with: """ set :markdown_engine, :redcarpet - set :markdown, smartypants: true + set :markdown, :smartypants => true """ Given the Server is running at "markdown-app" When I go to "/smarty_pants.html" @@ -69,13 +70,13 @@ Feature: Markdown (Redcarpet) support And a file named "config.rb" with: """ set :markdown_engine, :redcarpet - set :markdown, filter_html: true, - no_images: true, - no_links: true, - with_toc_data: true, - hard_wrap: true, - safe_links_only: true, - prettify: true + set :markdown, :filter_html => true, + :no_images => true, + :no_links => true, + :with_toc_data => true, + :hard_wrap => true, + :safe_links_only => true, + :prettify => true """ Given the Server is running at "markdown-app" @@ -102,7 +103,7 @@ Feature: Markdown (Redcarpet) support And a file named "config.rb" with: """ set :markdown_engine, :redcarpet - set :markdown, link_attributes: { target: "_blank" } + set :markdown, :link_attributes => { :target => "_blank" } """ And a file named "source/link.html.markdown" with: """ @@ -117,8 +118,8 @@ Feature: Markdown (Redcarpet) support And a file named "config.rb" with: """ set :markdown_engine, :redcarpet - set :markdown, xhtml: true, - hard_wrap: true + set :markdown, :xhtml => true, + :hard_wrap => true """ Given the Server is running at "markdown-app" When I go to "/hard_wrap.html" @@ -129,7 +130,7 @@ Feature: Markdown (Redcarpet) support And a file named "config.rb" with: """ set :markdown_engine, :redcarpet - set :markdown, smartypants: true + set :markdown, :smartypants => true """ Given the Server is running at "markdown-frontmatter-options-app" When I go to "/smarty_pants-default.html" diff --git a/middleman-core/features/markdown_redcarpet_in_haml.feature b/middleman-core/features/markdown_redcarpet_in_haml.feature index c8adfd73..a0f10160 100644 --- a/middleman-core/features/markdown_redcarpet_in_haml.feature +++ b/middleman-core/features/markdown_redcarpet_in_haml.feature @@ -1,3 +1,4 @@ +@nojava Feature: Markdown support in Haml In order to test support of the Haml markdown filter diff --git a/middleman-core/features/markdown_redcarpet_in_slim.feature b/middleman-core/features/markdown_redcarpet_in_slim.feature deleted file mode 100644 index 250c6857..00000000 --- a/middleman-core/features/markdown_redcarpet_in_slim.feature +++ /dev/null @@ -1,41 +0,0 @@ -Feature: Markdown support in Slim - In order to test support of the Slim markdown filter - - Scenario: Markdown filter in Slim works - Given a fixture app "markdown-in-slim-app" - And a file named "config.rb" with: - """ - set :markdown_engine, :redcarpet - activate :directory_indexes - """ - And a file named "source/markdown_filter.html.slim" with: - """ - markdown: - # H1 - - paragraph - """ - Given the Server is running at "markdown-in-slim-app" - When I go to "/markdown_filter/" - Then I should see ">H1" - Then I should see "

paragraph

" - - - Scenario: Markdown filter in Slim uses our link_to and image_tag helpers - Given a fixture app "markdown-in-slim-app" - And a file named "config.rb" with: - """ - set :markdown_engine, :redcarpet - activate :directory_indexes - """ - And a file named "source/link_and_image.html.slim" with: - """ - markdown: - [A link](/link_target.html) - - ![image](blank.gif) - """ - Given the Server is running at "markdown-in-slim-app" - When I go to "/link_and_image/" - Then I should see "/link_target/" - Then I should see 'src="/images/blank.gif"' diff --git a/middleman-core/features/minify_css.feature b/middleman-core/features/minify_css.feature index cbf03fe3..0c707861 100644 --- a/middleman-core/features/minify_css.feature +++ b/middleman-core/features/minify_css.feature @@ -5,19 +5,16 @@ Feature: Minify CSS Given a fixture app "minify-css-app" And a file named "config.rb" with: """ - config[:sass_source_maps] = false """ And the Server is running at "minify-css-app" When I go to "/stylesheets/site.css" - Then I should see "7" lines + Then I should see "50" lines And I should see "only screen and (device-width" - + Scenario: Rendering external css with the feature enabled Given a fixture app "minify-css-app" And a file named "config.rb" with: """ - config[:sass_source_maps] = false - activate :minify_css """ And the Server is running at "minify-css-app" @@ -28,44 +25,29 @@ Feature: Minify CSS Then I should see "1" lines When I go to "/stylesheets/report.css" Then I should see "p{border:1px solid #ff6600}" - - Scenario: Rendering external css in a proxied resource - Given a fixture app "minify-css-app" - And a file named "config.rb" with: - """ - config[:sass_source_maps] = false - - activate :minify_css - proxy '/css-proxy', '/stylesheets/site.css', ignore: true - """ - And the Server is running at "minify-css-app" - When I go to "/css-proxy" - Then I should see "1" lines - And I should see "only screen and (device-width" - + Scenario: Rendering external css with passthrough compressor Given a fixture app "passthrough-app" And a file named "config.rb" with: """ - config[:sass_source_maps] = false - module ::PassThrough def self.compress(data) data end end - activate :minify_css, compressor: ::PassThrough + activate :minify_css + + set :css_compressor, ::PassThrough """ And the Server is running at "passthrough-app" When I go to "/stylesheets/site.css" - Then I should see "5" lines + Then I should see "46" lines Scenario: Rendering inline css with the feature disabled Given a fixture app "minify-css-app" And a file named "config.rb" with: """ - config[:sass_source_maps] = false """ And the Server is running at "minify-css-app" When I go to "/inline-css.html" @@ -78,22 +60,22 @@ Feature: Minify CSS } """ - + Scenario: Rendering inline css with a passthrough minifier Given a fixture app "passthrough-app" And a file named "config.rb" with: """ - config[:sass_source_maps] = false - module ::PassThrough def self.compress(data) data end end - activate :minify_css, inline: true, compressor: ::PassThrough + activate :minify_css, :inline => true - page "/inline-css.html", layout: false + set :css_compressor, ::PassThrough + + page "/inline-css.html", :layout => false """ And the Server is running at "passthrough-app" When I go to "/inline-css.html" @@ -110,17 +92,15 @@ Feature: Minify CSS Given a fixture app "passthrough-app" And a file named "config.rb" with: """ - config[:sass_source_maps] = false - module ::HelloCompressor def self.compress(data) "Hello" end end - activate :minify_css, inline: true, compressor: ::HelloCompressor + activate :minify_css, :inline => true, :compressor => ::HelloCompressor - page "/inline-css.html", layout: false + page "/inline-css.html", :layout => false """ And the Server is running at "passthrough-app" When I go to "/inline-css.html" @@ -130,14 +110,12 @@ Feature: Minify CSS Hello """ - + Scenario: Rendering inline css with the feature enabled Given a fixture app "minify-css-app" And a file named "config.rb" with: """ - config[:sass_source_maps] = false - - activate :minify_css, inline: true + activate :minify_css, :inline => true """ And the Server is running at "minify-css-app" When I go to "/inline-css.html" @@ -146,60 +124,4 @@ Feature: Minify CSS - """ - - Scenario: Rendering inline css in a PHP document - Given a fixture app "minify-css-app" - And a file named "config.rb" with: - """ - config[:sass_source_maps] = false - - activate :minify_css, inline: true - """ - And the Server is running at "minify-css-app" - When I go to "/inline-css.php" - Then I should see: - """ - - - - """ - - Scenario: Rendering inline css in a proxied resource - Given a fixture app "minify-css-app" - And a file named "config.rb" with: - """ - config[:sass_source_maps] = false - - activate :minify_css, inline: true - proxy '/inline-css-proxy', '/inline-css.html', ignore: true - """ - And the Server is running at "minify-css-app" - When I go to "/inline-css-proxy" - Then I should see: - """ - - """ - - @preserve_mime_types - Scenario: Configuring content types of resources to be minified - Given a fixture app "minify-css-app" - And a file named "config.rb" with: - """ - config[:sass_source_maps] = false - - mime_type('.xcss', 'text/x-css') - activate :minify_css, content_types: ['text/x-css'], - inline: true, - inline_content_types: ['text/html'] - """ - And the Server is running at "minify-css-app" - When I go to "/stylesheets/site.xcss" - Then I should see "1" lines - And I should see "only screen and (device-width" - When I go to "/inline-css.php" - Then I should see "8" lines + """ \ No newline at end of file diff --git a/middleman-core/features/minify_javascript.feature b/middleman-core/features/minify_javascript.feature index 262d977a..7d6b71ff 100644 --- a/middleman-core/features/minify_javascript.feature +++ b/middleman-core/features/minify_javascript.feature @@ -38,7 +38,7 @@ Feature: Minify Javascript I'm a jQuery {{template}}. """ - + Scenario: Rendering inline js with a passthrough minifier Given a fixture app "passthrough-app" And a file named "config.rb" with: @@ -49,9 +49,11 @@ Feature: Minify Javascript end end - activate :minify_javascript, inline: true, compressor: ::PassThrough + activate :minify_javascript, :inline => true - page "/inline-js.html", layout: false + set :js_compressor, ::PassThrough + + page "/inline-js.html", :layout => false """ And the Server is running at "passthrough-app" When I go to "/inline-js.html" @@ -86,7 +88,7 @@ Feature: Minify Javascript """ - Scenario: Rendering inline JS with a passthrough minifier using activate-style compressor + Scenario: Rendering inline css with a passthrough minifier using activate-style compressor Given a fixture app "passthrough-app" And a file named "config.rb" with: """ @@ -96,9 +98,9 @@ Feature: Minify Javascript end end - activate :minify_javascript, inline: true, compressor: ::HelloCompressor + activate :minify_javascript, :inline => true, :compressor => ::HelloCompressor - page "/inline-js.html", layout: false + page "/inline-js.html", :layout => false """ And the Server is running at "passthrough-app" When I go to "/inline-js.html" @@ -119,12 +121,12 @@ Feature: Minify Javascript I'm a jQuery {{template}}. """ - + Scenario: Rendering inline js with the feature enabled Given a fixture app "minify-js-app" And a file named "config.rb" with: """ - activate :minify_javascript, inline: true + activate :minify_javascript, :inline => true """ And the Server is running at "minify-js-app" When I go to "/inline-js.html" @@ -138,50 +140,14 @@ Feature: Minify Javascript """ - - Scenario: Rendering inline js in a PHP document - Given a fixture app "minify-js-app" - And a file named "config.rb" with: - """ - activate :minify_javascript, inline: true - """ - And the Server is running at "minify-js-app" - When I go to "/inline-js.php" - Then I should see: - """ - - - - - - """ - - Scenario: Rendering inline js in a proxied resource - Given a fixture app "minify-js-app" - And a file named "config.rb" with: - """ - activate :minify_javascript, inline: true - proxy '/inline-js-proxy', '/inline-js.html', ignore: true - """ - And the Server is running at "minify-js-app" - When I go to "/inline-js-proxy" - Then I should see "14" lines - + Scenario: Rendering external js with the feature enabled Given a fixture app "minify-js-app" And a file named "config.rb" with: @@ -193,18 +159,7 @@ Feature: Minify Javascript Then I should see "1" lines When I go to "/more-js/other.js" Then I should see "1" lines - - Scenario: Rendering external js in a proxied resource - Given a fixture app "minify-js-app" - And a file named "config.rb" with: - """ - activate :minify_javascript - proxy '/js-proxy', '/javascripts/js_test.js', ignore: true - """ - And the Server is running at "minify-js-app" - When I go to "/js-proxy" - Then I should see "1" lines - + Scenario: Rendering external js with a passthrough minifier And the Server is running at "passthrough-app" When I go to "/javascripts/js_test.js" @@ -214,12 +169,12 @@ Feature: Minify Javascript Given a fixture app "minify-js-app" And a file named "config.rb" with: """ - activate :minify_javascript, inline: true + activate :minify_javascript, :inline => true """ And the Server is running at "minify-js-app" When I go to "/inline-coffeescript.html" Then I should see "3" lines - + Scenario: Rendering external js (coffeescript) with the feature enabled Given a fixture app "minify-js-app" And a file named "config.rb" with: @@ -229,7 +184,7 @@ Feature: Minify Javascript And the Server is running at "minify-js-app" When I go to "/javascripts/coffee_test.js" Then I should see "1" lines - + Scenario: Rendering inline js (coffeescript) with a passthrough minifier Given a fixture app "passthrough-app" And a file named "config.rb" with: @@ -240,14 +195,16 @@ Feature: Minify Javascript end end - activate :minify_javascript, inline: true, compressor: ::PassThrough + activate :minify_javascript, :inline => true - page "/inline-coffeescript.html", layout: false + set :js_compressor, ::PassThrough + + page "/inline-coffeescript.html", :layout => false """ And the Server is running at "passthrough-app" When I go to "/inline-coffeescript.html" Then I should see "13" lines - + Scenario: Rendering external js (coffeescript) with a passthrough minifier Given a fixture app "passthrough-app" And a file named "config.rb" with: @@ -258,9 +215,11 @@ Feature: Minify Javascript end end - activate :minify_javascript, compressor: ::PassThrough + activate :minify_javascript + + set :js_compressor, ::PassThrough """ And the Server is running at "passthrough-app" When I go to "/javascripts/coffee_test.js" Then I should see "11" lines - + \ No newline at end of file diff --git a/middleman-core/features/more-instance_vars.feature b/middleman-core/features/more-instance_vars.feature new file mode 100644 index 00000000..87fc3b0d --- /dev/null +++ b/middleman-core/features/more-instance_vars.feature @@ -0,0 +1,18 @@ +Feature: Instance Vars + In order to share data with layouts and partials via instance variables + + Scenario: Setting an instance var in a template should be visible in its layout + Given the Server is running at "more-instance-vars-app" + When I go to "/instance-var-set.html" + Then I should see "Var is 100" + + Scenario: Setting an instance var in a template should be visible in a partial + Given the Server is running at "more-instance-vars-app" + When I go to "/instance-var-set.html" + Then I should see "My var is here!" + + Scenario: Setting an instance var in one file should not be visible in another + Given the Server is running at "more-instance-vars-app" + When I go to "/instance-var-set.html" + When I go to "/no-instance-var.html" + Then I should see "No var..." diff --git a/middleman-core/features/more-sitemap_traversal.feature b/middleman-core/features/more-sitemap_traversal.feature index f935fbf0..224c2b8a 100644 --- a/middleman-core/features/more-sitemap_traversal.feature +++ b/middleman-core/features/more-sitemap_traversal.feature @@ -71,13 +71,3 @@ Feature: Step through sitemap as a tree (more) Then I should see "Child: directory-indexed/sibling2.html" Then I should see "Child: directory-indexed/sub2/index.html" Then I should see "Sibling: root.html" - - Scenario: Child pages can see their parent and siblings too in named directory - Given the Server is running at "more-traversal-app" - When I go to "/directory-indexed/sibling" - Then I should see "Path: directory-indexed/sibling.html" - Then I should see "Parent: directory-indexed.html" - Then I should see "Sibling: directory-indexed/fake.html" - Then I should see "Sibling: directory-indexed/fake2.html" - Then I should see "Sibling: directory-indexed/sibling2.html" - Then I should see "Sibling: directory-indexed/sub2/index.html" diff --git a/middleman-core/features/mount_rack.feature b/middleman-core/features/mount_rack.feature index dcb83146..b2dbe5a0 100644 --- a/middleman-core/features/mount_rack.feature +++ b/middleman-core/features/mount_rack.feature @@ -47,9 +47,11 @@ Feature: Support Rack apps mounted using map run MySinatra end - endpoint "sinatra/index2.html", path: "/sinatra/" + configure :build do + endpoint "sinatra/index2.html", :path => "/sinatra/" + end - endpoint "dedoo.html", path: "/sinatra/derp.html" + endpoint "dedoo.html", :path => "/sinatra/derp.html" endpoint "hello.html" do "world" diff --git a/middleman-core/features/move_files.feature b/middleman-core/features/move_files.feature deleted file mode 100644 index a6b1e975..00000000 --- a/middleman-core/features/move_files.feature +++ /dev/null @@ -1,44 +0,0 @@ -Feature: Move files - - Scenario: Move one path to another - Given a fixture app "large-build-app" - And a file named "config.rb" with: - """ - move_file "/static.html", "/static2.html" - """ - And the Server is running at "large-build-app" - When I go to "/static.html" - Then I should see 'Not Found' - When I go to "/static2.html" - Then I should see 'Static, no code!' - - Scenario: Move one path to another with directory indexes - Given a fixture app "large-build-app" - And a file named "config.rb" with: - """ - activate :directory_indexes - move_file "/static.html", "/static2.html" - """ - And the Server is running at "large-build-app" - When I go to "/static.html" - Then I should see 'Not Found' - When I go to "/static/index.html" - Then I should see 'Not Found' - When I go to "/static2.html" - Then I should see 'Static, no code!' - - Scenario: Move one path to another with directory indexes (using dest path) - Given a fixture app "large-build-app" - And a file named "config.rb" with: - """ - activate :directory_indexes - move_file "/static/index.html", "/static2.html" - """ - And the Server is running at "large-build-app" - When I go to "/static.html" - Then I should see 'Not Found' - When I go to "/static/index.html" - Then I should see 'Not Found' - When I go to "/static2.html" - Then I should see 'Static, no code!' - diff --git a/middleman-core/features/multiple-sources.feature b/middleman-core/features/multiple-sources.feature deleted file mode 100644 index 4f23474a..00000000 --- a/middleman-core/features/multiple-sources.feature +++ /dev/null @@ -1,35 +0,0 @@ -Feature: Allow multiple sources to be setup. - - Scenario: Three source directories. - Given the Server is running at "multiple-sources-app" - When I go to "/index.html" - Then I should see "Default Source" - - When I go to "/index1.html" - Then I should see "Source 1" - - When I go to "/index2.html" - Then I should see "Source 2" - - When I go to "/override-in-two.html" - Then I should see "Overridden 2" - - When I go to "/override-in-one.html" - Then I should see "Opposite 2" - - Scenario: Three data directories. - Given the Server is running at "multiple-data-sources-app" - When I go to "/index.html" - Then I should see "Default: Data Default" - Then I should see "Data 1: Data 1" - Then I should see "Data 2: Data 2" - Then I should see "Override in Two: Overridden 2" - Then I should see "Override in One: Opposite 2" - - Scenario: Set source with destination_dir - Given the Server is running at "multiple-sources-with-duplicate-file-names-app" - When I go to "/index.html" - Then I should see "Default Source" - - When I go to "/source2/index.html" - Then I should see "Second Source" diff --git a/middleman-core/features/nested_layouts.feature b/middleman-core/features/nested_layouts.feature index f51831fb..d70a7e23 100644 --- a/middleman-core/features/nested_layouts.feature +++ b/middleman-core/features/nested_layouts.feature @@ -5,37 +5,37 @@ Feature: Allow nesting of layouts When I go to "/index.html" Then I should see: """ - Master Erb + Master

Index Title

- I am Outer - I am Inner + Outer + Inner Template - + """ When I go to "/another.html" Then I should see: """ - Master Erb + Master

New Article Title

- I am Outer - I am Inner + Outer + Inner

The Article Content

""" - + Scenario: A page uses an inner layout when uses an outer layout (slim) Given the Server is running at "nested-layout-app" When I go to "/slim-test.html" - Then I should see "

Master Slim

New Article Title

I am Outer

I am Inner

The Article Content

" - + Then I should see "

Master

New Article Title

Outer

Inner

The Article Content

" + Scenario: A page uses an inner layout when uses an outer layout (haml) Given the Server is running at "nested-layout-app" When I go to "/haml-test.html" Then I should see: """ - Master Haml + Master

New Article Title

- I am Outer - I am Inner + Outer + Inner

The Article Content

""" @@ -43,16 +43,13 @@ Feature: Allow nesting of layouts Given the Server is running at "nested-layout-app" When I go to "/data-one.html" Then I should see "Page Number One" - And I should see "Page #1" - And I should see "I am Inner" - And I should see "I am Outer" - And I should see "Master Erb" + And I should see "Inner" When I go to "/data-two.html" Then I should see "Page Number Two" - And I should not see "I am Inner" + And I should not see "Inner" When I go to "/data-one.html" Then I should see "Page Number One" - And I should see "I am Inner" + And I should see "Inner" When I go to "/data-two.html" Then I should see "Page Number Two" - And I should not see "I am Inner" + And I should not see "Inner" diff --git a/middleman-core/features/page-id.feature b/middleman-core/features/page-id.feature deleted file mode 100644 index 74d08cb5..00000000 --- a/middleman-core/features/page-id.feature +++ /dev/null @@ -1,72 +0,0 @@ -Feature: Page IDs - - Scenario: link_to works with blocks (erb) - Given the Server is running at "page-id-app" - When I go to "/index.html" - Then I should see "I am: index" - And I should see "URL1: /fm.html" - And I should see "URL2: /2.html" - And I should see 'URL3: Hi' - And I should see 'URL4: Sym' - And I should see 'URL5: Imp' - And I should see 'URL6: Foldern' - And I should see 'URL7: Feed' - - When I go to "/fm.html" - Then I should see "I am: frontmatter" - When I go to "/implicit.html" - Then I should see "I am: implicit" - When I go to "/feed.xml" - Then I should see "I am: feed.xml" - When I go to "/folder/foldern.html" - Then I should see "I am: folder/foldern" - - When I go to "/1.html" - Then I should see "I am: page1" - When I go to "/2.html" - Then I should see "I am: page2" - When I go to "/3.html" - Then I should see "I am: page3" - - When I go to "/overwrites/from-default.html" - Then I should see "I am: something-else" - - When I go to "/overwrites/from-frontmatter.html" - Then I should see "I am: from_frontmatter" - - Scenario: Override page ID derivation with a proc - Given a fixture app "page-id-app" - And app "page-id-app" is using config "proc" - And the Server is running at "page-id-app" - - When I go to "/index.html" - Then I should see "I am: index.html-foo" - And I should see "URL1: /fm.html" - And I should see "URL2: /2.html" - And I should see 'URL3: Hi' - And I should see 'URL4: Sym' - And I should see 'URL8: Imp' - And I should see 'URL9: Foldern' - And I should see 'URL10: Feed' - - When I go to "/fm.html" - Then I should see "I am: frontmatter" - When I go to "/implicit.html" - Then I should see "I am: implicit.html-foo" - When I go to "/feed.xml" - Then I should see "I am: feed.xml-foo" - When I go to "/folder/foldern.html" - Then I should see "I am: folder/foldern.html-foo" - - When I go to "/1.html" - Then I should see "I am: page1" - When I go to "/2.html" - Then I should see "I am: page2" - When I go to "/3.html" - Then I should see "I am: page3" - - When I go to "/overwrites/from-default.html" - Then I should see "I am: something-else" - - When I go to "/overwrites/from-frontmatter.html" - Then I should see "I am: from_frontmatter" diff --git a/middleman-core/features/paginate.feature b/middleman-core/features/paginate.feature deleted file mode 100644 index 9338e019..00000000 --- a/middleman-core/features/paginate.feature +++ /dev/null @@ -1,204 +0,0 @@ -Feature: Pagination - Scenario: Basic configuration - Given a fixture app "paginate-app" - And a file named "config.rb" with: - """ - articles = resources.select { |r| - matcher = ::Middleman::Util::UriTemplates.uri_template('blog/2011-{remaining}') - ::Middleman::Util::UriTemplates.extract_params(matcher, ::Middleman::Util.normalize_path(r.url)) - } - - articles.sort { |a, b| - b.data.date <=> a.data.date - }.per_page(5) do |items, num, meta, is_last| - page_path = num == 1 ? '/2011/index.html' : "/2011/page/#{num}.html" - - prev_page = case num - when 1 - nil - when 2 - '/2011/index.html' - when 3 - "/2011/page/#{num-1}.html" - end - - next_page = is_last ? nil : "/2011/page/#{num+1}.html" - - proxy page_path, "/archive/2011/index.html", locals: { - items: items, - pagination: meta, - prev_page: prev_page, - next_page: next_page - } - end - - def get_tags(resource) - if resource.data.tags.is_a? String - resource.data.tags.split(',').map(&:strip) - else - resource.data.tags - end - end - - def group_lookup(resource, sum) - results = Array(get_tags(resource)).map(&:to_s).map(&:to_sym) - - results.each do |k| - sum[k] ||= [] - sum[k] << resource - end - end - - tags = articles - .select { |resource| resource.data.tags } - .each_with_object({}, &method(:group_lookup)) - - tags.each do |k, articles_in_tag| - articles_in_tag.sort { |a, b| - b.data.date <=> a.data.date - }.per_page(2).each do |items, num, meta, is_last| - page_path = num == 1 ? "/tags/#{k}.html" : "/tags/#{k}/page/#{num}.html" - - prev_page = case num - when 1 - nil - when 2 - "/tags/#{k}.html" - when 3 - "/tags/#{k}/page/#{num-1}.html" - end - - next_page = is_last ? nil : "/tags/#{k}/page/#{num+1}.html" - - proxy page_path, "/archive/2011/index.html", locals: { - items: items, - pagination: meta, - prev_page: prev_page, - next_page: next_page - } - end - end - """ - And the Server is running - When I go to "/2011/index.html" - Then I should see "Paginate: true" - Then I should see "Article Count: 5" - Then I should see "Page Num: 1" - Then I should see "Num Pages: 2" - Then I should see "Per Page: 5" - Then I should see "Page Start: 1" - Then I should see "Page End: 5" - Then I should see "Next Page: '/2011/page/2.html'" - Then I should see "Prev Page: ''" - Then I should not see "/blog/2011-01-01-test-article.html" - Then I should not see "/blog/2011-01-02-test-article.html" - Then I should see "/blog/2011-01-03-test-article.html" - Then I should see "/blog/2011-01-04-test-article.html" - Then I should see "/blog/2011-01-05-test-article.html" - Then I should see "/blog/2011-02-01-test-article.html" - Then I should see "/blog/2011-02-02-test-article.html" - - When I go to "/2011/page/2.html" - Then I should see "Article Count: 2" - Then I should see "Page Num: 2" - Then I should see "Page Start: 6" - Then I should see "Page End: 7" - Then I should see "Next Page: ''" - Then I should see "Prev Page: '/2011/'" - Then I should see "/2011-01-01-test-article.html" - Then I should see "/2011-01-02-test-article.html" - Then I should not see "/2011-01-03-test-article.html" - Then I should not see "/2011-01-04-test-article.html" - Then I should not see "/2011-01-05-test-article.html" - Then I should not see "/2011-02-01-test-article.html" - Then I should not see "/2011-02-02-test-article.html" - - When I go to "/tags/bar.html" - Then I should see "Paginate: true" - Then I should see "Article Count: 2" - Then I should see "Page Num: 1" - Then I should see "Num Pages: 3" - Then I should see "Per Page: 2" - Then I should see "Page Start: 1" - Then I should see "Page End: 2" - Then I should see "Next Page: '/tags/bar/page/2.html'" - Then I should see "Prev Page: ''" - Then I should see "/2011-02-02-test-article.html" - Then I should see "/2011-02-01-test-article.html" - Then I should not see "/2011-02-05-test-article.html" - Then I should not see "/2011-01-04-test-article.html" - Then I should not see "/2011-01-03-test-article.html" - - Scenario: Custom pager method - Given a fixture app "paginate-app" - And a file named "config.rb" with: - """ - def items_per_page(all_items) - [ - all_items.shift(2), - all_items - ] - end - - articles = resources.select { |r| - matcher = ::Middleman::Util::UriTemplates.uri_template('blog/2011-{remaining}') - ::Middleman::Util::UriTemplates.extract_params(matcher, ::Middleman::Util.normalize_path(r.url)) - } - - articles.sort { |a, b| - b.data.date <=> a.data.date - }.per_page(method(:items_per_page).to_proc).each do |items, num, meta, is_last| - page_path = num == 1 ? '/2011/index.html' : "/2011/page/#{num}.html" - - prev_page = case num - when 1 - nil - when 2 - '/2011/index.html' - when 3 - "/2011/page/#{num-1}.html" - end - - next_page = is_last ? nil : "/2011/page/#{num+1}.html" - - proxy page_path, "/archive/2011/index.html", locals: { - items: items, - pagination: meta, - prev_page: prev_page, - next_page: next_page - } - end - """ - And the Server is running - When I go to "/2011/index.html" - Then I should see "Paginate: true" - Then I should see "Article Count: 2" - Then I should see "Page Num: 1" - Then I should see "Num Pages: 2" - Then I should see "Per Page: 2" - Then I should see "Page Start: 1" - Then I should see "Page End: 2" - Then I should see "Next Page: '/2011/page/2.html'" - Then I should see "Prev Page: ''" - Then I should not see "/blog/2011-01-01-test-article.html" - Then I should not see "/blog/2011-01-02-test-article.html" - Then I should not see "/blog/2011-01-03-test-article.html" - Then I should not see "/blog/2011-01-04-test-article.html" - Then I should not see "/blog/2011-01-05-test-article.html" - Then I should see "/blog/2011-02-01-test-article.html" - Then I should see "/blog/2011-02-02-test-article.html" - - When I go to "/2011/page/2.html" - Then I should see "Article Count: 5" - Then I should see "Page Num: 2" - Then I should see "Page Start: 3" - Then I should see "Page End: 7" - Then I should see "Next Page: ''" - Then I should see "Prev Page: '/2011/'" - Then I should see "/2011-01-01-test-article.html" - Then I should see "/2011-01-02-test-article.html" - Then I should see "/2011-01-03-test-article.html" - Then I should see "/2011-01-04-test-article.html" - Then I should see "/2011-01-05-test-article.html" - Then I should not see "/2011-02-01-test-article.html" - Then I should not see "/2011-02-02-test-article.html" diff --git a/middleman-core/features/partials.feature b/middleman-core/features/partials.feature index 8a0154c2..d039bdcb 100644 --- a/middleman-core/features/partials.feature +++ b/middleman-core/features/partials.feature @@ -5,30 +5,30 @@ Feature: Provide Sane Defaults for Partial Behavior When I go to "/index.html" Then I should see "Header" And I should see "Footer" - + Scenario: Finds shared partials relative to the root (sub) Given the Server is running at "partials-app" When I go to "/sub/index.html" Then I should see "Header" And I should see "Footer" - Scenario: Flags error when partial is not found + Scenario: Finds shared partials without _ prefix Given the Server is running at "partials-app" - When I go to "/index_missing.html" - Then I should see "Error: Could not locate partial" - + When I go to "/using_snippet.html" + Then I should see "Snippet" + Scenario: Prefers partials of the same engine type Given the Server is running at "partials-app" When I go to "/index.html" Then I should see "ERb Main" - + Scenario: Prefers partials of the same engine type Given the Server is running at "partials-app" When I go to "/second.html" Then I should see "Str Main" And I should see "Header" And I should see "Footer" - + Scenario: Finds partial relative to template Given the Server is running at "partials-app" When I go to "/sub/index.html" @@ -38,27 +38,9 @@ Feature: Provide Sane Defaults for Partial Behavior Given the Server is running at "partials-app" When I go to "/locals.html" Then I should see "Local var is bar" - + Scenario: Partial and Layout use different engines Given the Server is running at "different-engine-partial" When I go to "/index.html" Then I should see "ERb Header" And I should see "Str Footer" - - Scenario: Works with non-template content (svg) - Given the Server is running at "partials-app" - When I go to "/svg.html" - Then I should see "Hello World

" - When I go to "/code_snippet.html" - Then I should see "File Not Found" - When I go to "/_code_snippet.html" - Then I should see "File Not Found" - -Scenario: Works with blocks - Given the Server is running at "partials-app" - When I go to "/block.html" - Then I should see "Start" - And I should see "Contents" - And I should see "End" diff --git a/middleman-core/features/partials_dir.feature b/middleman-core/features/partials_dir.feature new file mode 100644 index 00000000..8648c8e2 --- /dev/null +++ b/middleman-core/features/partials_dir.feature @@ -0,0 +1,30 @@ +Feature: Partials dir + Scenario: Find partials in a custom partials dir + Given a fixture app "partials-dir-app" + And a file named "config.rb" with: + """ + set :partials_dir, 'partials' + """ + And the Server is running + When I go to "/index.html" + Then I should see "contents of the partial" + + Scenario: Find partials in a nested custom partials dir + Given a fixture app "partials-dir-app" + And a file named "config.rb" with: + """ + set :partials_dir, 'nested/partials' + """ + And the Server is running + When I go to "/index.html" + Then I should see "contents of the nested partial" + + Scenario: Find partials in the default partials dir + Given a fixture app "default-partials-dir-app" + And a file named "config.rb" with: + """ + """ + And the Server is running + When I go to "/index.html" + Then I should see "contents of the partial" + diff --git a/middleman-core/features/queryable.feature b/middleman-core/features/queryable.feature new file mode 100644 index 00000000..1382db3f --- /dev/null +++ b/middleman-core/features/queryable.feature @@ -0,0 +1,35 @@ +Feature: Queryable Selector + Scenario: Basic Selector Tests + Then should initialize with an attribute and an operator + Then should raise an exception if the operator is not supported + Scenario: Using offset and limit + Given the Server is running at "queryable-app" + Then should limit the documents to the number specified + Then should offset the documents by the number specified + Then should support offset and limit at the same time + Then should not freak out about an offset higher than the document count + Scenario: Using where queries with an equal operator + Given the Server is running at "queryable-app" + Then should return the right documents + Then should be chainable + Then should not be confused by attributes not present in all documents + Scenario: Using where queries with a complex operator + Given the Server is running at "queryable-app" + Then with a gt operator should return the right documents + Then with a gte operator should return the right documents + Then with an in operator should return the right documents + Then with an lt operator should return the right documents + Then with an lte operator should return the right documents + Then with an include operator include should return the right documents + Then with mixed operators should return the right documents + Then using multiple constrains in one where should return the right documents + Scenario: Sorting documents + Given the Server is running at "queryable-app" + Then should support ordering by attribute ascending + Then should support ordering by attribute descending + Then should order by attribute ascending by default + Then should exclude documents that do not own the attribute + Scenario: Passing queries around + Given a simple 'where' query + When I chain a where clause onto that query + Then the original query should remain unchanged diff --git a/middleman-core/features/redirects.feature b/middleman-core/features/redirects.feature index c1549128..bcbe3baf 100644 --- a/middleman-core/features/redirects.feature +++ b/middleman-core/features/redirects.feature @@ -4,18 +4,17 @@ Feature: Meta redirects Given a fixture app "large-build-app" And a file named "config.rb" with: """ - redirect "hello.html", to: "world.html" + redirect "hello.html", :to => "world.html" """ And the Server is running at "large-build-app" When I go to "/hello.html" - Then I should see ' "http://example.com" """ And the Server is running at "large-build-app" When I go to "/hello.html" @@ -27,7 +26,7 @@ Feature: Meta redirects """ ready do r = sitemap.find_resource_by_path("static.html") - redirect "hello.html", to: r + redirect "hello.html", :to => r end """ And the Server is running at "large-build-app" @@ -39,8 +38,8 @@ Feature: Meta redirects And a file named "config.rb" with: """ activate :directory_indexes - redirect "hello.html", to: "link_test.html" - redirect "hello2.html", to: "services/index.html" + redirect "hello.html", :to => "link_test.html" + redirect "hello2.html", :to => "services/index.html" """ And the Server is running at "large-build-app" When I go to "/hello/index.html" @@ -52,7 +51,7 @@ Feature: Meta redirects Given a fixture app "large-build-app" And a file named "config.rb" with: """ - redirect "hello.html", to: "world.html" do |from, to| + redirect "hello.html", :to => "world.html" do |from, to| "#{from} to #{to}" end """ diff --git a/middleman-core/features/relative_assets.feature b/middleman-core/features/relative_assets.feature index ba131396..1ebafdfa 100644 --- a/middleman-core/features/relative_assets.feature +++ b/middleman-core/features/relative_assets.feature @@ -6,7 +6,7 @@ Feature: Relative Assets And the Server is running at "relative-assets-app" When I go to "/stylesheets/relative_assets.css" Then I should not see "url('../" - And I should see '/images/blank.gif")' + And I should see "/images/blank.gif')" Scenario: Building css with the feature disabled Given a fixture app "relative-assets-app" @@ -15,37 +15,19 @@ Feature: Relative Assets """ Given a successfully built app at "relative-assets-app" When I cd to "build" - Then the file "stylesheets/relative_assets.css" should contain 'url("/images/blank.gif")' + Then the file "stylesheets/relative_assets.css" should contain "url('/images/blank.gif')" Scenario: Rendering html with the feature disabled Given "relative_assets" feature is "disabled" And the Server is running at "relative-assets-app" When I go to "/relative_image.html" - Then I should see '"/stylesheets/relative_assets.css"' - Then I should see '"/javascripts/app.js"' - Then I should see "/images/blank.gif" - When I go to "/absolute_image_relative_css.html" - Then I should see '"stylesheets/relative_assets.css"' - Then I should see '"javascripts/app.js"' Then I should see "/images/blank.gif" Scenario: Rendering css with the feature enabled Given "relative_assets" feature is "enabled" And the Server is running at "relative-assets-app" When I go to "/stylesheets/relative_assets.css" - Then I should see 'url("../images/blank.gif' - When I go to "/javascripts/application.js" - Then I should not see "../" - When I go to "/stylesheets/fonts.css" - Then I should see 'url(../fonts/roboto/roboto-regular-webfont.eot' - And I should see 'url(../fonts/roboto/roboto-regular-webfont.woff' - And I should see 'url(../fonts/roboto/roboto-regular-webfont.ttf' - And I should see 'url(../fonts/roboto/roboto-regular-webfont.svg' - When I go to "/stylesheets/fonts2.css" - Then I should see 'url(../fonts/roboto/roboto-regular-webfont.eot' - And I should see 'url(../fonts/roboto/roboto-regular-webfont.woff' - And I should see 'url(../fonts/roboto/roboto-regular-webfont.ttf' - And I should see 'url(../fonts/roboto/roboto-regular-webfont.svg' + Then I should see "url('../images/blank.gif" Scenario: Building css with the feature enabled Given a fixture app "relative-assets-app" @@ -55,8 +37,7 @@ Feature: Relative Assets """ Given a successfully built app at "relative-assets-app" When I cd to "build" - Then the file "stylesheets/relative_assets.css" should contain 'url("../images/blank.gif")' - Then the file "javascripts/application.js" should not contain "../" + Then the file "stylesheets/relative_assets.css" should contain "url('../images/blank.gif')" Scenario: Relative css reference with directory indexes Given a fixture app "relative-assets-app" @@ -69,30 +50,55 @@ Feature: Relative Assets When I cd to "build" Then the file "relative_image/index.html" should contain "../stylesheets/relative_assets.css" - Scenario: Rendering html with the feature enabled (overrides relative option on helpers) + Scenario: Rendering html with the feature enabled Given "relative_assets" feature is "enabled" And the Server is running at "relative-assets-app" When I go to "/relative_image.html" - Then I should see '"stylesheets/relative_assets.css"' - Then I should see '"javascripts/app.js"' - When I go to "/relative_image_absolute_css.html" - Then I should see '"stylesheets/relative_assets.css"' - Then I should see '"javascripts/app.js"' Then I should not see "/images/blank.gif" And I should see "images/blank.gif" + Scenario: Rendering css with a custom images_dir + Given "relative_assets" feature is "enabled" + And "images_dir" is set to "img" + And the Server is running at "relative-assets-app" + When I go to "/stylesheets/relative_assets.css" + Then I should see "url('../img/blank.gif')" + + Scenario: Building css with a custom images_dir + Given a fixture app "relative-assets-app" + And a file named "config.rb" with: + """ + set :images_dir, "img" + activate :relative_assets + """ + Given a successfully built app at "relative-assets-app" + When I cd to "build" + Then the file "stylesheets/relative_assets.css" should contain "url('../img/blank.gif')" + + Scenario: Rendering html with a custom images_dir + Given "relative_assets" feature is "enabled" + And "images_dir" is set to "img" + And the Server is running at "relative-assets-app" + When I go to "/relative_image.html" + Then I should not see "/images/blank.gif" + Then I should not see "/img/blank.gif" + And I should see "img/blank.gif" + Scenario: Rendering scss with the feature enabled Given "relative_assets" feature is "enabled" And the Server is running at "fonts-app" When I go to "/stylesheets/fonts.css" - Then I should see: - """ - url("../fonts/StMarie-Thin.otf" - """ - And I should see: - """ - url("../fonts/blank/blank.otf" - """ + Then I should see "url('../fonts/StMarie-Thin.otf" + And I should see "url('../fonts/blank/blank.otf" + + Scenario: Rendering scss with the feature enabled and a custom fonts_dir + Given "relative_assets" feature is "enabled" + And "fonts_dir" is set to "otf" + And the Server is running at "fonts-app" + When I go to "/stylesheets/fonts.css" + Then I should not see "url('../fonts/StMarie-Thin.otf" + And I should see "url('../otf/StMarie-Thin.otf" + And I should see "url('../otf/blank/blank.otf" Scenario: Building scss with the feature enabled Given a fixture app "fonts-app" @@ -102,14 +108,21 @@ Feature: Relative Assets """ Given a successfully built app at "fonts-app" When I cd to "build" - Then the file "stylesheets/fonts.css" should contain: + Then the file "stylesheets/fonts.css" should contain "url('../fonts/StMarie-Thin.otf')" + And the file "stylesheets/fonts.css" should contain "url('../fonts/blank/blank.otf')" + + Scenario: Building scss with the feature enabled and a custom fonts_dir + Given a fixture app "fonts-app" + And a file named "config.rb" with: """ - url("../fonts/StMarie-Thin.otf") - """ - And the file "stylesheets/fonts.css" should contain: - """ - url("../fonts/blank/blank.otf") + set :fonts_dir, "otf" + activate :relative_assets """ + Given a successfully built app at "fonts-app" + When I cd to "build" + Then the file "stylesheets/fonts.css" should not contain "url('../fonts/StMarie-Thin.otf')" + And the file "stylesheets/fonts.css" should contain "url('../otf/StMarie-Thin.otf')" + And the file "stylesheets/fonts.css" should contain "url('../otf/blank/blank.otf')" Scenario: Relative assets via image_tag Given a fixture app "relative-assets-app" @@ -120,7 +133,7 @@ Feature: Relative Assets """ And the Server is running at "relative-assets-app" When I go to "/sub/image_tag.html" - Then I should see '' Scenario: Relative assets should not break data URIs in image_tag Given a fixture app "relative-assets-app" @@ -131,18 +144,4 @@ Feature: Relative Assets """ And the Server is running at "relative-assets-app" When I go to "/sub/image_tag.html" - Then I should see '' - - Scenario: URLs are not rewritten for rewrite ignored paths - Given a fixture app "relative-assets-app" - And a file named "config.rb" with: - """ - activate :relative_assets, rewrite_ignore: [ - '/stylesheets/fonts.css', - ] - """ - And the Server is running at "relative-assets-app" - When I go to "/stylesheets/relative_assets.css" - Then I should see 'url("../images/blank.gif' - When I go to "/stylesheets/fonts.css" - Then I should see 'url(/fonts/roboto/roboto-regular-webfont.eot' + Then I should see '' \ No newline at end of file diff --git a/middleman-core/features/relative_assets_helpers_only.feature b/middleman-core/features/relative_assets_helpers_only.feature deleted file mode 100644 index 194c8b37..00000000 --- a/middleman-core/features/relative_assets_helpers_only.feature +++ /dev/null @@ -1,123 +0,0 @@ -Feature: Relative Assets (Helpers Only) - - Scenario: Rendering css with the feature enabled - Given a fixture app "relative-assets-app" - And a file named "config.rb" with: - """ - activate :relative_assets, helpers_only: true - """ - And a file named "source/stylesheets/relative_assets.css.sass.erb" with: - """ - h1 - background: url("<%= asset_url('images/blank.gif') %>") - h2 - background: url("<%= asset_url('/images/blank2.gif') %>") - """ - And a file named "source/javascripts/application.js.erb" with: - """ - function foo() { - var img = document.createElement('img'); - img.src = '<%= asset_url("images/100px.jpg") %>'; - var body = document.getElementsByTagName('body')[0]; - body.insertBefore(img, body.firstChild); - } - - window.onload = foo; - """ - And a file named "source/stylesheets/fonts3.css.erb" with: - """ - @font-face { - font-family: 'Roboto2'; - src: url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.eot") %>); - src: url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.eot?#iefix") %>) format('embedded-opentype'), - url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.woff") %>) format('woff'), - url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.ttf") %>) format('truetype'), - url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.svg#robotoregular") %>) format('svg'); - font-weight: normal; - font-style: normal; - } - """ - And the Server is running at "relative-assets-app" - When I go to "/stylesheets/relative_assets.css" - Then I should see 'url("../images/blank.gif' - And I should see 'url("../images/blank2.gif' - When I go to "/javascripts/application.js" - Then I should not see "../" - When I go to "/stylesheets/fonts3.css" - Then I should see 'url(../fonts/roboto/roboto-regular-webfont.eot' - And I should see 'url(../fonts/roboto/roboto-regular-webfont.woff' - And I should see 'url(../fonts/roboto/roboto-regular-webfont.ttf' - And I should see 'url(../fonts/roboto/roboto-regular-webfont.svg' - - Scenario: Relative css reference with directory indexes - Given a fixture app "relative-assets-app" - And a file named "config.rb" with: - """ - activate :directory_indexes - activate :relative_assets, helpers_only: true - """ - And the Server is running at "relative-assets-app" - When I go to "/relative_image/index.html" - Then I should see "../stylesheets/relative_assets.css" - - Scenario: Relative assets via image_tag - Given a fixture app "relative-assets-app" - And a file named "config.rb" with: - """ - activate :relative_assets, helpers_only: true - """ - And a file named "source/sub/image_tag.html.erb" with: - """ - <%= image_tag '/img/blank.gif' %> - """ - And the Server is running at "relative-assets-app" - When I go to "/sub/image_tag.html" - Then I should see ' - """ - And the Server is running at "relative-assets-app" - When I go to "/sub/image_tag.html" - Then I should see '' - - Scenario: URLs are not rewritten for rewrite ignored paths - Given a fixture app "relative-assets-app" - And a file named "config.rb" with: - """ - activate :relative_assets, rewrite_ignore: [ - '/stylesheets/fonts3.css', - ], helpers_only: true - """ - And a file named "source/stylesheets/relative_assets.css.sass.erb" with: - """ - h1 - background: url("<%= asset_url('images/blank.gif') %>") - h2 - background: url("<%= asset_url('/images/blank2.gif') %>") - """ - And a file named "source/stylesheets/fonts3.css.erb" with: - """ - @font-face { - font-family: 'Roboto2'; - src: url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.eot") %>); - src: url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.eot?#iefix") %>) format('embedded-opentype'), - url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.woff") %>) format('woff'), - url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.ttf") %>) format('truetype'), - url(<%= asset_url("/fonts/roboto/roboto-regular-webfont.svg#robotoregular") %>) format('svg'); - font-weight: normal; - font-style: normal; - } - """ - And the Server is running at "relative-assets-app" - When I go to "/stylesheets/relative_assets.css" - Then I should see 'url("../images/blank.gif' - When I go to "/stylesheets/fonts3.css" - Then I should see 'url(/fonts/roboto/roboto-regular-webfont.eot' diff --git a/middleman-core/features/sass_in_slim.feature b/middleman-core/features/sass_in_slim.feature deleted file mode 100644 index d04055e4..00000000 --- a/middleman-core/features/sass_in_slim.feature +++ /dev/null @@ -1,40 +0,0 @@ -Feature: Sass/SCSS support in Slim - In order to test support of the Slim sass and scss filters - - Scenario: Sass filter in Slim works - Given a fixture app "sass-in-slim-app" - And a file named "config.rb" with: - """ - activate :directory_indexes - """ - And a file named "source/sass_filter.html.slim" with: - """ - sass: - .sass - margin: 0 - """ - Given the Server is running at "sass-in-slim-app" - When I go to "/sass_filter/" - Then I should see "text/css" - Then I should see ".sass" - Then I should see "margin:0" - - - Scenario: SCSS filter in Slim works - Given a fixture app "sass-in-slim-app" - And a file named "config.rb" with: - """ - activate :directory_indexes - """ - And a file named "source/scss_filter.html.slim" with: - """ - scss: - .scss { - margin: 0; - } - """ - Given the Server is running at "sass-in-slim-app" - When I go to "/scss_filter/" - Then I should see "text/css" - Then I should see ".scss" - Then I should see "margin:0" diff --git a/middleman-core/features/sitemap_traversal.feature b/middleman-core/features/sitemap_traversal.feature index d2fe581c..828a2507 100644 --- a/middleman-core/features/sitemap_traversal.feature +++ b/middleman-core/features/sitemap_traversal.feature @@ -71,13 +71,3 @@ Feature: Step through sitemap as a tree Then I should see "Child: directory-indexed/sibling2.html" Then I should see "Child: directory-indexed/sub2/index.html" Then I should see "Sibling: root.html" - - Scenario: Child pages can see their parent and siblings too in named directory - Given the Server is running at "traversal-app" - When I go to "/directory-indexed/sibling.html" - Then I should see "Path: directory-indexed/sibling.html" - Then I should see "Parent: directory-indexed.html" - Then I should see "Sibling: directory-indexed/fake.html" - Then I should see "Sibling: directory-indexed/fake2.html" - Then I should see "Sibling: directory-indexed/sibling2.html" - Then I should see "Sibling: directory-indexed/sub2/index.html" diff --git a/middleman-core/features/slim.feature b/middleman-core/features/slim.feature index 031120f3..acf8b82c 100644 --- a/middleman-core/features/slim.feature +++ b/middleman-core/features/slim.feature @@ -20,14 +20,6 @@ Feature: Support slim templating language When I go to "/slim.html" Then I should see "

Welcome to Slim

" - Scenario: Slim Content For - Given the Server is running at "slim-content-for-app" - When I go to "/index.html" - Then I should not see "Content AContent B" - Then I should see "Content for A:Content A" - Then I should see "Content for main:Content Main" - Then I should see "Content for B:Content B" - Scenario: Rendering Scss in a Slim filter Given an empty app And a file named "config.rb" with: @@ -40,11 +32,7 @@ Feature: Support slim templating language head meta charset="utf-8" scss: - @mixin global-reset { - html, body, div { - padding: 0; - } - } + @import "compass"; @include global-reset; body h1 Welcome to Slim @@ -56,8 +44,8 @@ Feature: Support slim templating language head meta charset="utf-8" sass: - html, body, div - padding: 0 + @import "compass" + +global-reset body h1 Welcome to Slim """ @@ -68,14 +56,14 @@ Feature: Support slim templating language head meta charset="utf-8" scss: - +global-reset2 + +global-reset body h1 Welcome to Slim """ And the Server is running at "empty_app" When I go to "/scss.html" - Then I should see "html,body,div" + Then I should see "html, body, div" When I go to "/sass.html" - Then I should see "html,body,div" + Then I should see "html, body, div" When I go to "/error.html" - Then I should see "Error:" + Then I should see "Syntax error" \ No newline at end of file diff --git a/middleman-core/features/step_definitions/page_layout_steps.rb b/middleman-core/features/step_definitions/page_layout_steps.rb new file mode 100644 index 00000000..9456d4cf --- /dev/null +++ b/middleman-core/features/step_definitions/page_layout_steps.rb @@ -0,0 +1,15 @@ +Given /^page "([^\"]*)" has layout "([^\"]*)"$/ do |url, layout| + @initialize_commands ||= [] + @initialize_commands << lambda { + page(url, :layout => layout.to_sym) + } +end + +Given /^"([^\"]*)" with_layout block has layout "([^\"]*)"$/ do |url, layout| + @initialize_commands ||= [] + @initialize_commands << lambda { + with_layout(layout.to_sym) do + page(url) + end + } +end diff --git a/middleman-core/features/step_definitions/queryable_steps.rb b/middleman-core/features/step_definitions/queryable_steps.rb new file mode 100644 index 00000000..995c3d33 --- /dev/null +++ b/middleman-core/features/step_definitions/queryable_steps.rb @@ -0,0 +1,135 @@ +Given /^a simple 'where' query$/ do + @query = Middleman::Sitemap::Queryable::Query.new({}).where(:foo => 'bar') +end + +When /^I chain a where clause onto that query$/ do + @new_query = @query.where(:baz => 'foo') +end + +Then /^the original query should remain unchanged$/ do + @query.opts({}).should_not eql @new_query.opts({}) +end + +Then /^should initialize with an attribute and an operator$/ do + selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :author, :operator => 'equal' + :author.should == selector.attribute + 'equal'.should == selector.operator +end + +Then /^should raise an exception if the operator is not supported$/ do + expect { + selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :author, :operator => 'zomg' + }.to raise_error(::Middleman::Sitemap::Queryable::OperatorNotSupportedError) +end + +Then /^should limit the documents to the number specified$/ do + @server_inst.sitemap.order_by(:id).limit(2).all.map { |r| r.raw_data[:id] }.sort.should == [1,2].sort +end + +Then /^should offset the documents by the number specified$/ do + @server_inst.sitemap.order_by(:id).offset(2).all.map { |r| r.raw_data[:id] }.sort.should == [3,4,5].sort +end + +Then /^should support offset and limit at the same time$/ do + @server_inst.sitemap.order_by(:id).offset(1).limit(2).all.map { |r| r.raw_data[:id] }.sort.should == [2,3].sort +end + +Then /^should not freak out about an offset higher than the document count$/ do + @server_inst.sitemap.order_by(:id).offset(5).all.should == [] +end + +Then /^should return the right documents$/ do + documents = @server_inst.sitemap.resources.select { |r| !r.raw_data.empty? } + document_1 = documents[0] + document_2 = documents[1] + + found_document = @server_inst.sitemap.where(:title => document_1.raw_data[:title]).first + document_1.should == found_document + + found_document = @server_inst.sitemap.where(:title => document_2.raw_data[:title]).first + document_2.should == found_document +end + +Then /^should be chainable$/ do + documents = @server_inst.sitemap.resources.select { |r| !r.raw_data.empty? } + document_1 = documents[0] + + document_proxy = @server_inst.sitemap.where(:title => document_1.raw_data[:title]) + document_proxy.where(:id => document_1.raw_data[:id]) + document_1.should == document_proxy.first +end + +Then /^should not be confused by attributes not present in all documents$/ do + result = @server_inst.sitemap.where(:seldom_attribute => 'is seldom').all + result.map { |r| r.raw_data[:id] }.should == [4] +end + +Then /^with a gt operator should return the right documents$/ do + selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'gt' + found_documents = @server_inst.sitemap.where(selector => 2).all + found_documents.map { |r| r.raw_data[:id] }.sort.should == [5,3,4].sort +end + +Then /^with a gte operator should return the right documents$/ do + selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'gte' + found_documents = @server_inst.sitemap.where(selector => 2).all + found_documents.map { |r| r.raw_data[:id] }.sort.should == [2,5,3,4].sort +end + +Then /^with an in operator should return the right documents$/ do + selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'in' + found_documents = @server_inst.sitemap.where(selector => [2,3]).all + found_documents.map { |r| r.raw_data[:id] }.sort.should == [2,3].sort +end + +Then /^with an lt operator should return the right documents$/ do + selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'lt' + found_documents = @server_inst.sitemap.where(selector => 2).all + found_documents.map { |r| r.raw_data[:id] }.should == [1] +end + +Then /^with an lte operator should return the right documents$/ do + selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'lte' + found_documents = @server_inst.sitemap.where(selector => 2).all + found_documents.map { |r| r.raw_data[:id] }.sort.should == [1,2].sort +end + +Then /^with an include operator include should return the right documents$/ do + selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :tags, :operator => 'include' + found_documents = @server_inst.sitemap.where(selector => 'ruby').all + found_documents.map { |r| r.raw_data[:id] }.sort.should == [1,2].sort +end + +Then /^with mixed operators should return the right documents$/ do + in_selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'in' + gt_selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'gt' + documents_proxy = @server_inst.sitemap.where(in_selector => [2,3]) + found_documents = documents_proxy.where(gt_selector => 2).all + found_documents.map { |r| r.raw_data[:id] }.should == [3] +end + +Then /^using multiple constrains in one where should return the right documents$/ do + selector = ::Middleman::Sitemap::Queryable::Selector.new :attribute => :id, :operator => 'lte' + found_documents = @server_inst.sitemap.where(selector => 2, :status => :published).all + found_documents.map { |r| r.raw_data[:id] }.sort.should == [1,2].sort +end + +Then /^should support ordering by attribute ascending$/ do + found_documents = @server_inst.sitemap.order_by(:title => :asc).all + found_documents.map { |r| r.raw_data[:id] }.should == [2,3,1,5,4] +end + +Then /^should support ordering by attribute descending$/ do + found_documents = @server_inst.sitemap.order_by(:title => :desc).all + found_documents.map { |r| r.raw_data[:id] }.should == [4,5,1,3,2] +end + +Then /^should order by attribute ascending by default$/ do + found_documents = @server_inst.sitemap.order_by(:title).all + found_documents.map { |r| r.raw_data[:id] }.should == [2,3,1,5,4] +end + +Then /^should exclude documents that do not own the attribute$/ do + found_documents = @server_inst.sitemap.order_by(:status).all + found_documents.map { |r| r.raw_data[:id] }.to_set.should == [1,2].to_set +end diff --git a/middleman-core/features/stylus.feature b/middleman-core/features/stylus.feature index 15b44f18..df17962b 100644 --- a/middleman-core/features/stylus.feature +++ b/middleman-core/features/stylus.feature @@ -1,3 +1,4 @@ +@nojava Feature: Stylus Updates and Partials Scenario: The preview server should update stylesheets when Stylus changes Given the Server is running at "stylus-preview-app" diff --git a/middleman-core/features/support/env.rb b/middleman-core/features/support/env.rb index 77cfbb06..ba524651 100644 --- a/middleman-core/features/support/env.rb +++ b/middleman-core/features/support/env.rb @@ -1,19 +1,12 @@ ENV["TEST"] = "true" - -require 'sassc' +ENV["AUTOLOAD_SPROCKETS"] = "false" require 'simplecov' SimpleCov.root(File.expand_path(File.dirname(__FILE__) + '/../..')) -require 'phantomjs/poltergeist' -Capybara.javascript_driver = :poltergeist - require 'coveralls' Coveralls.wear! -require 'codeclimate-test-reporter' -CodeClimate::TestReporter.start - PROJECT_ROOT_PATH = File.dirname(File.dirname(File.dirname(__FILE__))) require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-core') require File.join(PROJECT_ROOT_PATH, 'lib', 'middleman-core', 'step_definitions') diff --git a/middleman-core/features/support/preserve_mime_types.rb b/middleman-core/features/support/preserve_mime_types.rb deleted file mode 100644 index a791e49c..00000000 --- a/middleman-core/features/support/preserve_mime_types.rb +++ /dev/null @@ -1,7 +0,0 @@ -Around('@preserve_mime_types') do |_scenario, block| - mime_types = ::Rack::Mime::MIME_TYPES.clone - - block.call - - ::Rack::Mime::MIME_TYPES.replace mime_types -end diff --git a/middleman-core/features/template-key-collision.feature b/middleman-core/features/template-key-collision.feature deleted file mode 100644 index 9e530dc1..00000000 --- a/middleman-core/features/template-key-collision.feature +++ /dev/null @@ -1,26 +0,0 @@ -Feature: Don't allow template locals to overwrite template helpers - - Scenario: Normal Template - Given an empty app - And a file named "config.rb" with: - """ - class TestExt < ::Middleman::Extension - expose_to_template foo: :foo - - def foo - "bar" - end - end - - ::Middleman::Extensions.register :test, TestExt - - activate :test - - page "/index.html", locals: { foo: false } - """ - And a file named "source/index.html.erb" with: - """ - <%= foo %> - """ - Given a built app at "empty_app" - Then the exit status should be 1 diff --git a/middleman-core/features/twitter-bootstrap-compile.feature b/middleman-core/features/twitter-bootstrap-compile.feature new file mode 100644 index 00000000..994cf11c --- /dev/null +++ b/middleman-core/features/twitter-bootstrap-compile.feature @@ -0,0 +1,6 @@ +@nojava +Feature: Compile a complicated Twitter bootstrap app + + Scenario: User drops Twitter Bootstrap source into an app + + Given a successfully built app at "twitter-bootstrap-app" \ No newline at end of file diff --git a/middleman-core/fixtures/asset-hash-app/config.rb b/middleman-core/fixtures/asset-hash-app/config.rb index 1327d8f0..cee0d36f 100644 --- a/middleman-core/fixtures/asset-hash-app/config.rb +++ b/middleman-core/fixtures/asset-hash-app/config.rb @@ -4,3 +4,5 @@ activate :asset_hash activate :relative_assets activate :directory_indexes + +#page '/foo.html', :directory_index => false diff --git a/middleman-core/fixtures/asset-hash-app/source/api.json.erb b/middleman-core/fixtures/asset-hash-app/source/api.json.erb deleted file mode 100644 index bc2af59a..00000000 --- a/middleman-core/fixtures/asset-hash-app/source/api.json.erb +++ /dev/null @@ -1 +0,0 @@ -<%= {gif: image_path('100px.gif'), jpg: image_path('100px.jpg'), png: image_path('100px.png')}.to_json %> diff --git a/middleman-core/fixtures/asset-hash-app/source/fonts/fontawesome-webfont.woff b/middleman-core/fixtures/asset-hash-app/source/fonts/fontawesome-webfont.woff deleted file mode 100644 index 8b280b98..00000000 Binary files a/middleman-core/fixtures/asset-hash-app/source/fonts/fontawesome-webfont.woff and /dev/null differ diff --git a/middleman-core/fixtures/asset-hash-app/source/fonts/fontawesome-webfont.woff2 b/middleman-core/fixtures/asset-hash-app/source/fonts/fontawesome-webfont.woff2 deleted file mode 100644 index 3311d585..00000000 Binary files a/middleman-core/fixtures/asset-hash-app/source/fonts/fontawesome-webfont.woff2 and /dev/null differ diff --git a/middleman-core/fixtures/asset-hash-app/source/images/200px.jpg b/middleman-core/fixtures/asset-hash-app/source/images/200px.jpg deleted file mode 100644 index 1a236747..00000000 Binary files a/middleman-core/fixtures/asset-hash-app/source/images/200px.jpg and /dev/null differ diff --git a/middleman-core/fixtures/asset-hash-app/source/images/300px.jpg b/middleman-core/fixtures/asset-hash-app/source/images/300px.jpg deleted file mode 100644 index 5a1d9e03..00000000 Binary files a/middleman-core/fixtures/asset-hash-app/source/images/300px.jpg and /dev/null differ diff --git a/middleman-core/fixtures/asset-hash-app/source/index.html.erb b/middleman-core/fixtures/asset-hash-app/source/index.html.erb index de017654..fe58ad66 100644 --- a/middleman-core/fixtures/asset-hash-app/source/index.html.erb +++ b/middleman-core/fixtures/asset-hash-app/source/index.html.erb @@ -3,10 +3,7 @@ <% end %>

Image url:

- -<%= image_tag('100px.jpg?test') %> -<%= image_tag('100px.jpg?#test') %> -<%= image_tag('100px.jpg#test') %> +

Ignored path:

diff --git a/middleman-core/fixtures/asset-hash-app/source/layout.erb b/middleman-core/fixtures/asset-hash-app/source/layout.erb index 3a1079a7..a21259a3 100644 --- a/middleman-core/fixtures/asset-hash-app/source/layout.erb +++ b/middleman-core/fixtures/asset-hash-app/source/layout.erb @@ -3,16 +3,16 @@ - <%= stylesheet_link_tag "site", "fragment" %> + <%= stylesheet_link_tag "site" %> <%= javascript_include_tag "application" %> <%= yield_content :head %> - +
<%= yield %>
- + diff --git a/middleman-core/fixtures/asset-hash-app/source/other.html.erb b/middleman-core/fixtures/asset-hash-app/source/other.html.erb index cc258936..2e6f276f 100644 --- a/middleman-core/fixtures/asset-hash-app/source/other.html.erb +++ b/middleman-core/fixtures/asset-hash-app/source/other.html.erb @@ -1,5 +1,2 @@

Image url:

- - - diff --git a/middleman-core/fixtures/asset-hash-app/source/slim.html.slim b/middleman-core/fixtures/asset-hash-app/source/slim.html.slim deleted file mode 100644 index dc74a5ee..00000000 --- a/middleman-core/fixtures/asset-hash-app/source/slim.html.slim +++ /dev/null @@ -1,8 +0,0 @@ ---- -directory_index: false -layout: false ---- - -= image_tag '100px.jpg', srcset: "100px.jpg 1x, 200px.jpg 2x, 300px.jpg 3x" - -= image_tag "300px.jpg" \ No newline at end of file diff --git a/middleman-core/fixtures/asset-hash-app/source/stylesheets/fragment.css.scss b/middleman-core/fixtures/asset-hash-app/source/stylesheets/fragment.css.scss deleted file mode 100644 index 4e175489..00000000 --- a/middleman-core/fixtures/asset-hash-app/source/stylesheets/fragment.css.scss +++ /dev/null @@ -1,7 +0,0 @@ -#main { - padding: 50px; - background-image: image-url('100px.jpg'); - background-image: image-url('100px.jpg?test'); - background-image: image-url('100px.jpg?#test'); - background-image: image-url('100px.jpg#test'); -} diff --git a/middleman-core/fixtures/asset-hash-app/source/stylesheets/site.css.scss b/middleman-core/fixtures/asset-hash-app/source/stylesheets/site.css.scss index 58d760bc..0d193a5c 100644 --- a/middleman-core/fixtures/asset-hash-app/source/stylesheets/site.css.scss +++ b/middleman-core/fixtures/asset-hash-app/source/stylesheets/site.css.scss @@ -1,4 +1,4 @@ #main { padding: 50px; - background-image: url('/images/100px.jpg'); -} + background-image: image-url('100px.jpg'); +} \ No newline at end of file diff --git a/middleman-core/fixtures/asset-hash-app/source/stylesheets/uses_fonts.css b/middleman-core/fixtures/asset-hash-app/source/stylesheets/uses_fonts.css deleted file mode 100644 index 629429d0..00000000 --- a/middleman-core/fixtures/asset-hash-app/source/stylesheets/uses_fonts.css +++ /dev/null @@ -1,4 +0,0 @@ -@font-face { - font-family: 'FontAwesome'; - src: url('../fonts/fontawesome-webfont.woff2') format('woff2'), url('../fonts/fontawesome-webfont.woff') format('woff'); -} diff --git a/middleman-core/fixtures/asset-hash-app/source/subdir/api.json.erb b/middleman-core/fixtures/asset-hash-app/source/subdir/api.json.erb deleted file mode 100644 index bc2af59a..00000000 --- a/middleman-core/fixtures/asset-hash-app/source/subdir/api.json.erb +++ /dev/null @@ -1 +0,0 @@ -<%= {gif: image_path('100px.gif'), jpg: image_path('100px.jpg'), png: image_path('100px.png')}.to_json %> diff --git a/middleman-core/fixtures/asset-hash-app/source/subdir/index.html.erb b/middleman-core/fixtures/asset-hash-app/source/subdir/index.html.erb index 79f12390..e9c2889c 100644 --- a/middleman-core/fixtures/asset-hash-app/source/subdir/index.html.erb +++ b/middleman-core/fixtures/asset-hash-app/source/subdir/index.html.erb @@ -2,17 +2,8 @@ The Middleman! <% end %> -

Abs

-

http://example.com/test.jpg

-

Image url:

-

- -

Image url2:

-

<%= image_tag('200px.jpg') %>

- -

Image url3:

-

+

<%= image_path('100px.jpg') %>

Autogenerated tests:

images/100px.jpg

diff --git a/middleman-core/fixtures/asset-hash-host-app/config.rb b/middleman-core/fixtures/asset-hash-host-app/config.rb new file mode 100644 index 00000000..f40e1c63 --- /dev/null +++ b/middleman-core/fixtures/asset-hash-host-app/config.rb @@ -0,0 +1,6 @@ + +activate :asset_hash +activate :directory_indexes +activate :asset_host + +set :asset_host, 'http://middlemanapp.com' diff --git a/middleman-core/fixtures/asset-hash-host-app/source/index.html.erb b/middleman-core/fixtures/asset-hash-host-app/source/index.html.erb index c9fefc2a..3616ba64 100644 --- a/middleman-core/fixtures/asset-hash-host-app/source/index.html.erb +++ b/middleman-core/fixtures/asset-hash-host-app/source/index.html.erb @@ -3,7 +3,4 @@ <% end %>

Image url:

- -<%= image_tag('100px.jpg?test') %> -<%= image_tag('100px.jpg?#test') %> -<%= image_tag('100px.jpg#test') %> +<%= image_tag('100px.jpg') %> diff --git a/middleman-core/fixtures/asset-hash-host-app/source/layout.erb b/middleman-core/fixtures/asset-hash-host-app/source/layout.erb index a6aa4a0c..443b3645 100644 --- a/middleman-core/fixtures/asset-hash-host-app/source/layout.erb +++ b/middleman-core/fixtures/asset-hash-host-app/source/layout.erb @@ -3,15 +3,15 @@ - <%= stylesheet_link_tag "site", "fragment" %> + <%= stylesheet_link_tag "site" %> <%= yield_content :head %> - +
<%= yield %>
- + diff --git a/middleman-core/fixtures/asset-hash-host-app/source/other.html.erb b/middleman-core/fixtures/asset-hash-host-app/source/other.html.erb index cc258936..2e6f276f 100644 --- a/middleman-core/fixtures/asset-hash-host-app/source/other.html.erb +++ b/middleman-core/fixtures/asset-hash-host-app/source/other.html.erb @@ -1,5 +1,2 @@

Image url:

- - - diff --git a/middleman-core/fixtures/asset-hash-host-app/source/stylesheets/fragment.css.scss b/middleman-core/fixtures/asset-hash-host-app/source/stylesheets/fragment.css.scss index 4e175489..b169b432 100644 --- a/middleman-core/fixtures/asset-hash-host-app/source/stylesheets/fragment.css.scss +++ b/middleman-core/fixtures/asset-hash-host-app/source/stylesheets/fragment.css.scss @@ -1,7 +1,4 @@ #main { padding: 50px; - background-image: image-url('100px.jpg'); - background-image: image-url('100px.jpg?test'); - background-image: image-url('100px.jpg?#test'); background-image: image-url('100px.jpg#test'); } diff --git a/middleman-core/fixtures/asset-hash-minified-app/config.rb b/middleman-core/fixtures/asset-hash-minified-app/config.rb deleted file mode 100644 index 94db1542..00000000 --- a/middleman-core/fixtures/asset-hash-minified-app/config.rb +++ /dev/null @@ -1,5 +0,0 @@ -configure :build do - # Minify Javascript on build - activate :minify_javascript - activate :asset_hash -end diff --git a/middleman-core/fixtures/asset-hash-minified-app/source/images/100px.jpg b/middleman-core/fixtures/asset-hash-minified-app/source/images/100px.jpg deleted file mode 100644 index 557d0278..00000000 Binary files a/middleman-core/fixtures/asset-hash-minified-app/source/images/100px.jpg and /dev/null differ diff --git a/middleman-core/fixtures/asset-hash-minified-app/source/javascripts/jquery.min.js b/middleman-core/fixtures/asset-hash-minified-app/source/javascripts/jquery.min.js deleted file mode 100644 index 0f60b7bd..00000000 --- a/middleman-core/fixtures/asset-hash-minified-app/source/javascripts/jquery.min.js +++ /dev/null @@ -1,5 +0,0 @@ -/*! jQuery v1.11.3 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */ -!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l="1.11.3",m=function(a,b){return new m.fn.init(a,b)},n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,o=/^-ms-/,p=/-([\da-z])/gi,q=function(a,b){return b.toUpperCase()};m.fn=m.prototype={jquery:l,constructor:m,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=m.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return m.each(this,a,b)},map:function(a){return this.pushStack(m.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},m.extend=m.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||m.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(e=arguments[h]))for(d in e)a=g[d],c=e[d],g!==c&&(j&&c&&(m.isPlainObject(c)||(b=m.isArray(c)))?(b?(b=!1,f=a&&m.isArray(a)?a:[]):f=a&&m.isPlainObject(a)?a:{},g[d]=m.extend(j,f,c)):void 0!==c&&(g[d]=c));return g},m.extend({expando:"jQuery"+(l+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===m.type(a)},isArray:Array.isArray||function(a){return"array"===m.type(a)},isWindow:function(a){return null!=a&&a==a.window},isNumeric:function(a){return!m.isArray(a)&&a-parseFloat(a)+1>=0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},isPlainObject:function(a){var b;if(!a||"object"!==m.type(a)||a.nodeType||m.isWindow(a))return!1;try{if(a.constructor&&!j.call(a,"constructor")&&!j.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}if(k.ownLast)for(b in a)return j.call(a,b);for(b in a);return void 0===b||j.call(a,b)},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(b){b&&m.trim(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(o,"ms-").replace(p,q)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=r(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(n,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(r(Object(a))?m.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){var d;if(b){if(g)return g.call(b,a,c);for(d=b.length,c=c?0>c?Math.max(0,d+c):c:0;d>c;c++)if(c in b&&b[c]===a)return c}return-1},merge:function(a,b){var c=+b.length,d=0,e=a.length;while(c>d)a[e++]=b[d++];if(c!==c)while(void 0!==b[d])a[e++]=b[d++];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=r(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(f=a[b],b=a,a=f),m.isFunction(a)?(c=d.call(arguments,2),e=function(){return a.apply(b||this,c.concat(d.call(arguments)))},e.guid=a.guid=a.guid||m.guid++,e):void 0},now:function(){return+new Date},support:k}),m.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function r(a){var b="length"in a&&a.length,c=m.type(a);return"function"===c||m.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var s=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+1*new Date,v=a.document,w=0,x=0,y=ha(),z=ha(),A=ha(),B=function(a,b){return a===b&&(l=!0),0},C=1<<31,D={}.hasOwnProperty,E=[],F=E.pop,G=E.push,H=E.push,I=E.slice,J=function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},K="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",L="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",N=M.replace("w","w#"),O="\\["+L+"*("+M+")(?:"+L+"*([*^$|!~]?=)"+L+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+N+"))|)"+L+"*\\]",P=":("+M+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+O+")*)|.*)\\)|)",Q=new RegExp(L+"+","g"),R=new RegExp("^"+L+"+|((?:^|[^\\\\])(?:\\\\.)*)"+L+"+$","g"),S=new RegExp("^"+L+"*,"+L+"*"),T=new RegExp("^"+L+"*([>+~]|"+L+")"+L+"*"),U=new RegExp("="+L+"*([^\\]'\"]*?)"+L+"*\\]","g"),V=new RegExp(P),W=new RegExp("^"+N+"$"),X={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+O),PSEUDO:new RegExp("^"+P),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+L+"*(even|odd|(([+-]|)(\\d*)n|)"+L+"*(?:([+-]|)"+L+"*(\\d+)|))"+L+"*\\)|)","i"),bool:new RegExp("^(?:"+K+")$","i"),needsContext:new RegExp("^"+L+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+L+"*((?:-\\d)?\\d*)"+L+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,aa=/[+~]/,ba=/'|\\/g,ca=new RegExp("\\\\([\\da-f]{1,6}"+L+"?|("+L+")|.)","ig"),da=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)},ea=function(){m()};try{H.apply(E=I.call(v.childNodes),v.childNodes),E[v.childNodes.length].nodeType}catch(fa){H={apply:E.length?function(a,b){G.apply(a,I.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function ga(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],k=b.nodeType,"string"!=typeof a||!a||1!==k&&9!==k&&11!==k)return d;if(!e&&p){if(11!==k&&(f=_.exec(a)))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return H.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName)return H.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=1!==k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(ba,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+ra(o[l]);w=aa.test(a)&&pa(b.parentNode)||b,x=o.join(",")}if(x)try{return H.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function ha(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function ia(a){return a[u]=!0,a}function ja(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function ka(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function la(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||C)-(~a.sourceIndex||C);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function ma(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function na(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function oa(a){return ia(function(b){return b=+b,ia(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function pa(a){return a&&"undefined"!=typeof a.getElementsByTagName&&a}c=ga.support={},f=ga.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=ga.setDocument=function(a){var b,e,g=a?a.ownerDocument||a:v;return g!==n&&9===g.nodeType&&g.documentElement?(n=g,o=g.documentElement,e=g.defaultView,e&&e!==e.top&&(e.addEventListener?e.addEventListener("unload",ea,!1):e.attachEvent&&e.attachEvent("onunload",ea)),p=!f(g),c.attributes=ja(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ja(function(a){return a.appendChild(g.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(g.getElementsByClassName),c.getById=ja(function(a){return o.appendChild(a).id=u,!g.getElementsByName||!g.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if("undefined"!=typeof b.getElementById&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(ca,da);return function(a){var c="undefined"!=typeof a.getAttributeNode&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return"undefined"!=typeof b.getElementsByTagName?b.getElementsByTagName(a):c.qsa?b.querySelectorAll(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(g.querySelectorAll))&&(ja(function(a){o.appendChild(a).innerHTML="",a.querySelectorAll("[msallowcapture^='']").length&&q.push("[*^$]="+L+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+L+"*(?:value|"+K+")"),a.querySelectorAll("[id~="+u+"-]").length||q.push("~="),a.querySelectorAll(":checked").length||q.push(":checked"),a.querySelectorAll("a#"+u+"+*").length||q.push(".#.+[+~]")}),ja(function(a){var b=g.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+L+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ja(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",P)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===g||a.ownerDocument===v&&t(v,a)?-1:b===g||b.ownerDocument===v&&t(v,b)?1:k?J(k,a)-J(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,e=a.parentNode,f=b.parentNode,h=[a],i=[b];if(!e||!f)return a===g?-1:b===g?1:e?-1:f?1:k?J(k,a)-J(k,b):0;if(e===f)return la(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?la(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},g):n},ga.matches=function(a,b){return ga(a,null,null,b)},ga.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return ga(b,n,null,[a]).length>0},ga.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},ga.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&D.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},ga.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},ga.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=ga.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=ga.selectors={cacheLength:50,createPseudo:ia,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(ca,da),a[3]=(a[3]||a[4]||a[5]||"").replace(ca,da),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||ga.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&ga.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(ca,da).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+L+")"+a+"("+L+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||"undefined"!=typeof a.getAttribute&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=ga.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e.replace(Q," ")+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||ga.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?ia(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=J(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:ia(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?ia(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),b[0]=null,!c.pop()}}),has:ia(function(a){return function(b){return ga(a,b).length>0}}),contains:ia(function(a){return a=a.replace(ca,da),function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:ia(function(a){return W.test(a||"")||ga.error("unsupported lang: "+a),a=a.replace(ca,da).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:oa(function(){return[0]}),last:oa(function(a,b){return[b-1]}),eq:oa(function(a,b,c){return[0>c?c+b:c]}),even:oa(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:oa(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:oa(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:oa(function(a,b,c){for(var d=0>c?c+b:c;++db;b++)d+=a[b].value;return d}function sa(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function ta(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function ua(a,b,c){for(var d=0,e=b.length;e>d;d++)ga(a,b[d],c);return c}function va(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function wa(a,b,c,d,e,f){return d&&!d[u]&&(d=wa(d)),e&&!e[u]&&(e=wa(e,f)),ia(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||ua(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:va(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=va(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?J(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=va(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):H.apply(g,r)})}function xa(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=sa(function(a){return a===b},h,!0),l=sa(function(a){return J(b,a)>-1},h,!0),m=[function(a,c,d){var e=!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d));return b=null,e}];f>i;i++)if(c=d.relative[a[i].type])m=[sa(ta(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return wa(i>1&&ta(m),i>1&&ra(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&xa(a.slice(i,e)),f>e&&xa(a=a.slice(e)),f>e&&ra(a))}m.push(c)}return ta(m)}function ya(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=F.call(i));s=va(s)}H.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&ga.uniqueSort(i)}return k&&(w=v,j=t),r};return c?ia(f):f}return h=ga.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=xa(b[c]),f[u]?d.push(f):e.push(f);f=A(a,ya(e,d)),f.selector=a}return f},i=ga.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(ca,da),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(ca,da),aa.test(j[0].type)&&pa(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&ra(j),!a)return H.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,aa.test(a)&&pa(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ja(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ja(function(a){return a.innerHTML="","#"===a.firstChild.getAttribute("href")})||ka("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ja(function(a){return a.innerHTML="",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||ka("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ja(function(a){return null==a.getAttribute("disabled")})||ka(K,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),ga}(a);m.find=s,m.expr=s.selectors,m.expr[":"]=m.expr.pseudos,m.unique=s.uniqueSort,m.text=s.getText,m.isXMLDoc=s.isXML,m.contains=s.contains;var t=m.expr.match.needsContext,u=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,v=/^.[^:#\[\.,]*$/;function w(a,b,c){if(m.isFunction(b))return m.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return m.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(v.test(b))return m.filter(b,a,c);b=m.filter(b,a)}return m.grep(a,function(a){return m.inArray(a,b)>=0!==c})}m.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?m.find.matchesSelector(d,a)?[d]:[]:m.find.matches(a,m.grep(b,function(a){return 1===a.nodeType}))},m.fn.extend({find:function(a){var b,c=[],d=this,e=d.length;if("string"!=typeof a)return this.pushStack(m(a).filter(function(){for(b=0;e>b;b++)if(m.contains(d[b],this))return!0}));for(b=0;e>b;b++)m.find(a,d[b],c);return c=this.pushStack(e>1?m.unique(c):c),c.selector=this.selector?this.selector+" "+a:a,c},filter:function(a){return this.pushStack(w(this,a||[],!1))},not:function(a){return this.pushStack(w(this,a||[],!0))},is:function(a){return!!w(this,"string"==typeof a&&t.test(a)?m(a):a||[],!1).length}});var x,y=a.document,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=m.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a.charAt(0)&&">"===a.charAt(a.length-1)&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||x).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof m?b[0]:b,m.merge(this,m.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:y,!0)),u.test(c[1])&&m.isPlainObject(b))for(c in b)m.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}if(d=y.getElementById(c[2]),d&&d.parentNode){if(d.id!==c[2])return x.find(a);this.length=1,this[0]=d}return this.context=y,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):m.isFunction(a)?"undefined"!=typeof x.ready?x.ready(a):a(m):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),m.makeArray(a,this))};A.prototype=m.fn,x=m(y);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};m.extend({dir:function(a,b,c){var d=[],e=a[b];while(e&&9!==e.nodeType&&(void 0===c||1!==e.nodeType||!m(e).is(c)))1===e.nodeType&&d.push(e),e=e[b];return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),m.fn.extend({has:function(a){var b,c=m(a,this),d=c.length;return this.filter(function(){for(b=0;d>b;b++)if(m.contains(this,c[b]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=t.test(a)||"string"!=typeof a?m(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&m.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?m.unique(f):f)},index:function(a){return a?"string"==typeof a?m.inArray(this[0],m(a)):m.inArray(a.jquery?a[0]:a,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(m.unique(m.merge(this.get(),m(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){do a=a[b];while(a&&1!==a.nodeType);return a}m.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return m.dir(a,"parentNode")},parentsUntil:function(a,b,c){return m.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return m.dir(a,"nextSibling")},prevAll:function(a){return m.dir(a,"previousSibling")},nextUntil:function(a,b,c){return m.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return m.dir(a,"previousSibling",c)},siblings:function(a){return m.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return m.sibling(a.firstChild)},contents:function(a){return m.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:m.merge([],a.childNodes)}},function(a,b){m.fn[a]=function(c,d){var e=m.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=m.filter(d,e)),this.length>1&&(C[a]||(e=m.unique(e)),B.test(a)&&(e=e.reverse())),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return m.each(a.match(E)||[],function(a,c){b[c]=!0}),b}m.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):m.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(c=a.memory&&l,d=!0,f=g||0,g=0,e=h.length,b=!0;h&&e>f;f++)if(h[f].apply(l[0],l[1])===!1&&a.stopOnFalse){c=!1;break}b=!1,h&&(i?i.length&&j(i.shift()):c?h=[]:k.disable())},k={add:function(){if(h){var d=h.length;!function f(b){m.each(b,function(b,c){var d=m.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this},remove:function(){return h&&m.each(arguments,function(a,c){var d;while((d=m.inArray(c,h,d))>-1)h.splice(d,1),b&&(e>=d&&e--,f>=d&&f--)}),this},has:function(a){return a?m.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],e=0,this},disable:function(){return h=i=c=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,c||k.disable(),this},locked:function(){return!i},fireWith:function(a,c){return!h||d&&!i||(c=c||[],c=[a,c.slice?c.slice():c],b?i.push(c):j(c)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!d}};return k},m.extend({Deferred:function(a){var b=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return m.Deferred(function(c){m.each(b,function(b,f){var g=m.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&m.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?m.extend(a,d):d}},e={};return d.pipe=d.then,m.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&m.isFunction(a.promise)?e:0,g=1===f?a:m.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&m.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;m.fn.ready=function(a){return m.ready.promise().done(a),this},m.extend({isReady:!1,readyWait:1,holdReady:function(a){a?m.readyWait++:m.ready(!0)},ready:function(a){if(a===!0?!--m.readyWait:!m.isReady){if(!y.body)return setTimeout(m.ready);m.isReady=!0,a!==!0&&--m.readyWait>0||(H.resolveWith(y,[m]),m.fn.triggerHandler&&(m(y).triggerHandler("ready"),m(y).off("ready")))}}});function I(){y.addEventListener?(y.removeEventListener("DOMContentLoaded",J,!1),a.removeEventListener("load",J,!1)):(y.detachEvent("onreadystatechange",J),a.detachEvent("onload",J))}function J(){(y.addEventListener||"load"===event.type||"complete"===y.readyState)&&(I(),m.ready())}m.ready.promise=function(b){if(!H)if(H=m.Deferred(),"complete"===y.readyState)setTimeout(m.ready);else if(y.addEventListener)y.addEventListener("DOMContentLoaded",J,!1),a.addEventListener("load",J,!1);else{y.attachEvent("onreadystatechange",J),a.attachEvent("onload",J);var c=!1;try{c=null==a.frameElement&&y.documentElement}catch(d){}c&&c.doScroll&&!function e(){if(!m.isReady){try{c.doScroll("left")}catch(a){return setTimeout(e,50)}I(),m.ready()}}()}return H.promise(b)};var K="undefined",L;for(L in m(k))break;k.ownLast="0"!==L,k.inlineBlockNeedsLayout=!1,m(function(){var a,b,c,d;c=y.getElementsByTagName("body")[0],c&&c.style&&(b=y.createElement("div"),d=y.createElement("div"),d.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px",c.appendChild(d).appendChild(b),typeof b.style.zoom!==K&&(b.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1",k.inlineBlockNeedsLayout=a=3===b.offsetWidth,a&&(c.style.zoom=1)),c.removeChild(d))}),function(){var a=y.createElement("div");if(null==k.deleteExpando){k.deleteExpando=!0;try{delete a.test}catch(b){k.deleteExpando=!1}}a=null}(),m.acceptData=function(a){var b=m.noData[(a.nodeName+" ").toLowerCase()],c=+a.nodeType||1;return 1!==c&&9!==c?!1:!b||b!==!0&&a.getAttribute("classid")===b};var M=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,N=/([A-Z])/g;function O(a,b,c){if(void 0===c&&1===a.nodeType){var d="data-"+b.replace(N,"-$1").toLowerCase();if(c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:M.test(c)?m.parseJSON(c):c}catch(e){}m.data(a,b,c)}else c=void 0}return c}function P(a){var b;for(b in a)if(("data"!==b||!m.isEmptyObject(a[b]))&&"toJSON"!==b)return!1; - -return!0}function Q(a,b,d,e){if(m.acceptData(a)){var f,g,h=m.expando,i=a.nodeType,j=i?m.cache:a,k=i?a[h]:a[h]&&h;if(k&&j[k]&&(e||j[k].data)||void 0!==d||"string"!=typeof b)return k||(k=i?a[h]=c.pop()||m.guid++:h),j[k]||(j[k]=i?{}:{toJSON:m.noop}),("object"==typeof b||"function"==typeof b)&&(e?j[k]=m.extend(j[k],b):j[k].data=m.extend(j[k].data,b)),g=j[k],e||(g.data||(g.data={}),g=g.data),void 0!==d&&(g[m.camelCase(b)]=d),"string"==typeof b?(f=g[b],null==f&&(f=g[m.camelCase(b)])):f=g,f}}function R(a,b,c){if(m.acceptData(a)){var d,e,f=a.nodeType,g=f?m.cache:a,h=f?a[m.expando]:m.expando;if(g[h]){if(b&&(d=c?g[h]:g[h].data)){m.isArray(b)?b=b.concat(m.map(b,m.camelCase)):b in d?b=[b]:(b=m.camelCase(b),b=b in d?[b]:b.split(" ")),e=b.length;while(e--)delete d[b[e]];if(c?!P(d):!m.isEmptyObject(d))return}(c||(delete g[h].data,P(g[h])))&&(f?m.cleanData([a],!0):k.deleteExpando||g!=g.window?delete g[h]:g[h]=null)}}}m.extend({cache:{},noData:{"applet ":!0,"embed ":!0,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(a){return a=a.nodeType?m.cache[a[m.expando]]:a[m.expando],!!a&&!P(a)},data:function(a,b,c){return Q(a,b,c)},removeData:function(a,b){return R(a,b)},_data:function(a,b,c){return Q(a,b,c,!0)},_removeData:function(a,b){return R(a,b,!0)}}),m.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=m.data(f),1===f.nodeType&&!m._data(f,"parsedAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=m.camelCase(d.slice(5)),O(f,d,e[d])));m._data(f,"parsedAttrs",!0)}return e}return"object"==typeof a?this.each(function(){m.data(this,a)}):arguments.length>1?this.each(function(){m.data(this,a,b)}):f?O(f,a,m.data(f,a)):void 0},removeData:function(a){return this.each(function(){m.removeData(this,a)})}}),m.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=m._data(a,b),c&&(!d||m.isArray(c)?d=m._data(a,b,m.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=m.queue(a,b),d=c.length,e=c.shift(),f=m._queueHooks(a,b),g=function(){m.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return m._data(a,c)||m._data(a,c,{empty:m.Callbacks("once memory").add(function(){m._removeData(a,b+"queue"),m._removeData(a,c)})})}}),m.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.lengthh;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f},W=/^(?:checkbox|radio)$/i;!function(){var a=y.createElement("input"),b=y.createElement("div"),c=y.createDocumentFragment();if(b.innerHTML="
a",k.leadingWhitespace=3===b.firstChild.nodeType,k.tbody=!b.getElementsByTagName("tbody").length,k.htmlSerialize=!!b.getElementsByTagName("link").length,k.html5Clone="<:nav>"!==y.createElement("nav").cloneNode(!0).outerHTML,a.type="checkbox",a.checked=!0,c.appendChild(a),k.appendChecked=a.checked,b.innerHTML="",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue,c.appendChild(b),b.innerHTML="",k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,k.noCloneEvent=!0,b.attachEvent&&(b.attachEvent("onclick",function(){k.noCloneEvent=!1}),b.cloneNode(!0).click()),null==k.deleteExpando){k.deleteExpando=!0;try{delete b.test}catch(d){k.deleteExpando=!1}}}(),function(){var b,c,d=y.createElement("div");for(b in{submit:!0,change:!0,focusin:!0})c="on"+b,(k[b+"Bubbles"]=c in a)||(d.setAttribute(c,"t"),k[b+"Bubbles"]=d.attributes[c].expando===!1);d=null}();var X=/^(?:input|select|textarea)$/i,Y=/^key/,Z=/^(?:mouse|pointer|contextmenu)|click/,$=/^(?:focusinfocus|focusoutblur)$/,_=/^([^.]*)(?:\.(.+)|)$/;function aa(){return!0}function ba(){return!1}function ca(){try{return y.activeElement}catch(a){}}m.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m._data(a);if(r){c.handler&&(i=c,c=i.handler,e=i.selector),c.guid||(c.guid=m.guid++),(g=r.events)||(g=r.events={}),(k=r.handle)||(k=r.handle=function(a){return typeof m===K||a&&m.event.triggered===a.type?void 0:m.event.dispatch.apply(k.elem,arguments)},k.elem=a),b=(b||"").match(E)||[""],h=b.length;while(h--)f=_.exec(b[h])||[],o=q=f[1],p=(f[2]||"").split(".").sort(),o&&(j=m.event.special[o]||{},o=(e?j.delegateType:j.bindType)||o,j=m.event.special[o]||{},l=m.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&m.expr.match.needsContext.test(e),namespace:p.join(".")},i),(n=g[o])||(n=g[o]=[],n.delegateCount=0,j.setup&&j.setup.call(a,d,p,k)!==!1||(a.addEventListener?a.addEventListener(o,k,!1):a.attachEvent&&a.attachEvent("on"+o,k))),j.add&&(j.add.call(a,l),l.handler.guid||(l.handler.guid=c.guid)),e?n.splice(n.delegateCount++,0,l):n.push(l),m.event.global[o]=!0);a=null}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,n,o,p,q,r=m.hasData(a)&&m._data(a);if(r&&(k=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=_.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=m.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,n=k[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=f=n.length;while(f--)g=n[f],!e&&q!==g.origType||c&&c.guid!==g.guid||h&&!h.test(g.namespace)||d&&d!==g.selector&&("**"!==d||!g.selector)||(n.splice(f,1),g.selector&&n.delegateCount--,l.remove&&l.remove.call(a,g));i&&!n.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||m.removeEvent(a,o,r.handle),delete k[o])}else for(o in k)m.event.remove(a,o+b[j],c,d,!0);m.isEmptyObject(k)&&(delete r.handle,m._removeData(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,l,n,o=[d||y],p=j.call(b,"type")?b.type:b,q=j.call(b,"namespace")?b.namespace.split("."):[];if(h=l=d=d||y,3!==d.nodeType&&8!==d.nodeType&&!$.test(p+m.event.triggered)&&(p.indexOf(".")>=0&&(q=p.split("."),p=q.shift(),q.sort()),g=p.indexOf(":")<0&&"on"+p,b=b[m.expando]?b:new m.Event(p,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=q.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+q.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:m.makeArray(c,[b]),k=m.event.special[p]||{},e||!k.trigger||k.trigger.apply(d,c)!==!1)){if(!e&&!k.noBubble&&!m.isWindow(d)){for(i=k.delegateType||p,$.test(i+p)||(h=h.parentNode);h;h=h.parentNode)o.push(h),l=h;l===(d.ownerDocument||y)&&o.push(l.defaultView||l.parentWindow||a)}n=0;while((h=o[n++])&&!b.isPropagationStopped())b.type=n>1?i:k.bindType||p,f=(m._data(h,"events")||{})[b.type]&&m._data(h,"handle"),f&&f.apply(h,c),f=g&&h[g],f&&f.apply&&m.acceptData(h)&&(b.result=f.apply(h,c),b.result===!1&&b.preventDefault());if(b.type=p,!e&&!b.isDefaultPrevented()&&(!k._default||k._default.apply(o.pop(),c)===!1)&&m.acceptData(d)&&g&&d[p]&&!m.isWindow(d)){l=d[g],l&&(d[g]=null),m.event.triggered=p;try{d[p]()}catch(r){}m.event.triggered=void 0,l&&(d[g]=l)}return b.result}},dispatch:function(a){a=m.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(m._data(this,"events")||{})[a.type]||[],k=m.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=m.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,g=0;while((e=f.handlers[g++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(e.namespace))&&(a.handleObj=e,a.data=e.data,c=((m.event.special[e.origType]||{}).handle||e.handler).apply(f.elem,i),void 0!==c&&(a.result=c)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!=this;i=i.parentNode||this)if(1===i.nodeType&&(i.disabled!==!0||"click"!==a.type)){for(e=[],f=0;h>f;f++)d=b[f],c=d.selector+" ",void 0===e[c]&&(e[c]=d.needsContext?m(c,this).index(i)>=0:m.find(c,this,null,[i]).length),e[c]&&e.push(d);e.length&&g.push({elem:i,handlers:e})}return h]","i"),ha=/^\s+/,ia=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ja=/<([\w:]+)/,ka=/\s*$/g,ra={option:[1,""],legend:[1,"
","
"],area:[1,"",""],param:[1,"",""],thead:[1,"","
"],tr:[2,"","
"],col:[2,"","
"],td:[3,"","
"],_default:k.htmlSerialize?[0,"",""]:[1,"X
","
"]},sa=da(y),ta=sa.appendChild(y.createElement("div"));ra.optgroup=ra.option,ra.tbody=ra.tfoot=ra.colgroup=ra.caption=ra.thead,ra.th=ra.td;function ua(a,b){var c,d,e=0,f=typeof a.getElementsByTagName!==K?a.getElementsByTagName(b||"*"):typeof a.querySelectorAll!==K?a.querySelectorAll(b||"*"):void 0;if(!f)for(f=[],c=a.childNodes||a;null!=(d=c[e]);e++)!b||m.nodeName(d,b)?f.push(d):m.merge(f,ua(d,b));return void 0===b||b&&m.nodeName(a,b)?m.merge([a],f):f}function va(a){W.test(a.type)&&(a.defaultChecked=a.checked)}function wa(a,b){return m.nodeName(a,"table")&&m.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function xa(a){return a.type=(null!==m.find.attr(a,"type"))+"/"+a.type,a}function ya(a){var b=pa.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function za(a,b){for(var c,d=0;null!=(c=a[d]);d++)m._data(c,"globalEval",!b||m._data(b[d],"globalEval"))}function Aa(a,b){if(1===b.nodeType&&m.hasData(a)){var c,d,e,f=m._data(a),g=m._data(b,f),h=f.events;if(h){delete g.handle,g.events={};for(c in h)for(d=0,e=h[c].length;e>d;d++)m.event.add(b,c,h[c][d])}g.data&&(g.data=m.extend({},g.data))}}function Ba(a,b){var c,d,e;if(1===b.nodeType){if(c=b.nodeName.toLowerCase(),!k.noCloneEvent&&b[m.expando]){e=m._data(b);for(d in e.events)m.removeEvent(b,d,e.handle);b.removeAttribute(m.expando)}"script"===c&&b.text!==a.text?(xa(b).text=a.text,ya(b)):"object"===c?(b.parentNode&&(b.outerHTML=a.outerHTML),k.html5Clone&&a.innerHTML&&!m.trim(b.innerHTML)&&(b.innerHTML=a.innerHTML)):"input"===c&&W.test(a.type)?(b.defaultChecked=b.checked=a.checked,b.value!==a.value&&(b.value=a.value)):"option"===c?b.defaultSelected=b.selected=a.defaultSelected:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}}m.extend({clone:function(a,b,c){var d,e,f,g,h,i=m.contains(a.ownerDocument,a);if(k.html5Clone||m.isXMLDoc(a)||!ga.test("<"+a.nodeName+">")?f=a.cloneNode(!0):(ta.innerHTML=a.outerHTML,ta.removeChild(f=ta.firstChild)),!(k.noCloneEvent&&k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||m.isXMLDoc(a)))for(d=ua(f),h=ua(a),g=0;null!=(e=h[g]);++g)d[g]&&Ba(e,d[g]);if(b)if(c)for(h=h||ua(a),d=d||ua(f),g=0;null!=(e=h[g]);g++)Aa(e,d[g]);else Aa(a,f);return d=ua(f,"script"),d.length>0&&za(d,!i&&ua(a,"script")),d=h=e=null,f},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,l,n=a.length,o=da(b),p=[],q=0;n>q;q++)if(f=a[q],f||0===f)if("object"===m.type(f))m.merge(p,f.nodeType?[f]:f);else if(la.test(f)){h=h||o.appendChild(b.createElement("div")),i=(ja.exec(f)||["",""])[1].toLowerCase(),l=ra[i]||ra._default,h.innerHTML=l[1]+f.replace(ia,"<$1>")+l[2],e=l[0];while(e--)h=h.lastChild;if(!k.leadingWhitespace&&ha.test(f)&&p.push(b.createTextNode(ha.exec(f)[0])),!k.tbody){f="table"!==i||ka.test(f)?""!==l[1]||ka.test(f)?0:h:h.firstChild,e=f&&f.childNodes.length;while(e--)m.nodeName(j=f.childNodes[e],"tbody")&&!j.childNodes.length&&f.removeChild(j)}m.merge(p,h.childNodes),h.textContent="";while(h.firstChild)h.removeChild(h.firstChild);h=o.lastChild}else p.push(b.createTextNode(f));h&&o.removeChild(h),k.appendChecked||m.grep(ua(p,"input"),va),q=0;while(f=p[q++])if((!d||-1===m.inArray(f,d))&&(g=m.contains(f.ownerDocument,f),h=ua(o.appendChild(f),"script"),g&&za(h),c)){e=0;while(f=h[e++])oa.test(f.type||"")&&c.push(f)}return h=null,o},cleanData:function(a,b){for(var d,e,f,g,h=0,i=m.expando,j=m.cache,l=k.deleteExpando,n=m.event.special;null!=(d=a[h]);h++)if((b||m.acceptData(d))&&(f=d[i],g=f&&j[f])){if(g.events)for(e in g.events)n[e]?m.event.remove(d,e):m.removeEvent(d,e,g.handle);j[f]&&(delete j[f],l?delete d[i]:typeof d.removeAttribute!==K?d.removeAttribute(i):d[i]=null,c.push(f))}}}),m.fn.extend({text:function(a){return V(this,function(a){return void 0===a?m.text(this):this.empty().append((this[0]&&this[0].ownerDocument||y).createTextNode(a))},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=wa(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?m.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||m.cleanData(ua(c)),c.parentNode&&(b&&m.contains(c.ownerDocument,c)&&za(ua(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++){1===a.nodeType&&m.cleanData(ua(a,!1));while(a.firstChild)a.removeChild(a.firstChild);a.options&&m.nodeName(a,"select")&&(a.options.length=0)}return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return m.clone(this,a,b)})},html:function(a){return V(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a)return 1===b.nodeType?b.innerHTML.replace(fa,""):void 0;if(!("string"!=typeof a||ma.test(a)||!k.htmlSerialize&&ga.test(a)||!k.leadingWhitespace&&ha.test(a)||ra[(ja.exec(a)||["",""])[1].toLowerCase()])){a=a.replace(ia,"<$1>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(m.cleanData(ua(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,m.cleanData(ua(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,n=this,o=l-1,p=a[0],q=m.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&na.test(p))return this.each(function(c){var d=n.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(i=m.buildFragment(a,this[0].ownerDocument,!1,this),c=i.firstChild,1===i.childNodes.length&&(i=c),c)){for(g=m.map(ua(i,"script"),xa),f=g.length;l>j;j++)d=i,j!==o&&(d=m.clone(d,!0,!0),f&&m.merge(g,ua(d,"script"))),b.call(this[j],d,j);if(f)for(h=g[g.length-1].ownerDocument,m.map(g,ya),j=0;f>j;j++)d=g[j],oa.test(d.type||"")&&!m._data(d,"globalEval")&&m.contains(h,d)&&(d.src?m._evalUrl&&m._evalUrl(d.src):m.globalEval((d.text||d.textContent||d.innerHTML||"").replace(qa,"")));i=c=null}return this}}),m.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){m.fn[a]=function(a){for(var c,d=0,e=[],g=m(a),h=g.length-1;h>=d;d++)c=d===h?this:this.clone(!0),m(g[d])[b](c),f.apply(e,c.get());return this.pushStack(e)}});var Ca,Da={};function Ea(b,c){var d,e=m(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:m.css(e[0],"display");return e.detach(),f}function Fa(a){var b=y,c=Da[a];return c||(c=Ea(a,b),"none"!==c&&c||(Ca=(Ca||m("