I'm included content.-
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..5d126348 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,13 @@ +# 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/CONTRIBUTING.md b/.github/CONTRIBUTING.md similarity index 96% rename from CONTRIBUTING.md rename to .github/CONTRIBUTING.md index b1b005ec..2cb5a0ac 100644 --- a/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -29,6 +29,9 @@ 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/.gitignore b/.gitignore index 535aec06..aabe272b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +.byebug_history +npm-debug.log +manifest.yaml /.bundle .DS_Store coverage @@ -10,6 +13,7 @@ Gemfile.lock docs .rbenv-* .ruby-version +.ruby-gemset .*.swp build doc @@ -20,4 +24,4 @@ Makefile .idea *.sublime-workspace /bin -middleman-core/fixtures/compass-sprites-app/source/images/icon-s0de2218f58.png \ No newline at end of file +middleman-core/fixtures/compass-sprites-app/source/images/icon-s0de2218f58.png diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 4f5e8fa4..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "middleman-core/lib/middleman-more/templates/smacss"] - path = middleman-core/lib/middleman-more/templates/smacss - url = git@github.com:nsteiner/middleman-smacss.git diff --git a/.rubocop.yml b/.rubocop.yml index 836f048b..c92b709f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -10,11 +10,15 @@ AllCops: - '**/tmp/**/*' - '**/bin/**/*' - 'middleman-core/lib/middleman-core/step_definitions/**/*' - - 'middleman-core/lib/vendored-middleman-deps/**/*' - 'middleman-core/fixtures/**/*' - 'middleman-core/features/**/*' - 'middleman-core/spec/**/*' - DisplayCopNames: true + - 'middleman-cli/lib/middleman-cli/templates/**/*' + - 'middleman-cli/fixtures/**/*' + - 'middleman-cli/features/**/*' + - 'middleman-cli/spec/**/*' +DoubleNegation: + Enabled: false LineLength: Enabled: false MethodLength: @@ -47,7 +51,21 @@ 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 diff --git a/.travis.yml b/.travis.yml index 7bc8a3be..ac5a7f06 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,22 +1,23 @@ language: ruby -bundler_args: --without development +sudo: false +cache: bundler +before_script: + - bundle update rvm: - ruby-head - - 2.2 - - 2.1 - - 2.0 - - 1.9.3 + - 2.3.1 + - 2.2.4 os: - linux # - osx -cache: bundler -sudo: false matrix: fast_finish: true allow_failures: - rvm: ruby-head -env: TEST=true -before_install: git submodule update --init --recursive +env: + global: + - TEST=true + - CODECLIMATE_REPO_TOKEN=81787f7b1c3bfa937edadcafbc94f807bf5af5c1142c7b793f2d9969a271de1f script: bundle exec rake test notifications: - slack: middleman:JW9OvXmn1m3XrSERe8866nBR \ No newline at end of file + slack: middleman:JW9OvXmn1m3XrSERe8866nBR diff --git a/.yardopts b/.yardopts index 40867ad0..8a5eba70 100644 --- a/.yardopts +++ b/.yardopts @@ -1,10 +1,11 @@ middleman-*/lib/**/*.rb --exclude middleman-core/lib/vendored-middleman-deps/ --exclude middleman-core/lib/middleman-core/step_definitions ---exclude middleman-core/lib/middleman-core/templates/default/ ---exclude middleman-core/lib/middleman-core/templates/html5/ ---exclude middleman-core/lib/middleman-core/templates/mobile/ ---exclude middleman-core/lib/middleman-core/templates/shared/ ---exclude middleman-core/lib/middleman-core/templates/extension/ +--exclude middleman-cli/lib/middleman-cli/templates/default/ +--exclude middleman-cli/lib/middleman-cli/templates/html5/ +--exclude middleman-cli/lib/middleman-cli/templates/mobile/ +--exclude middleman-cli/lib/middleman-cli/templates/shared/ +--exclude middleman-cli/lib/middleman-cli/templates/extension/ --no-private ---hide-void-return \ No newline at end of file +--hide-void-return +--markup=markdown \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a461146..148aa2e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,541 +1,161 @@ master === -3.4.0 -=== +# 4.1.13 -* Fix webrick restarts on Ruby 2.2 -* Empower link_to in a i18n context. -* Add retina files support on automatic_image_sizes -* Fix woff/woff2 confusion in asset hashing. -* Support `relative: false` on `stylesheet_link_tag` and `javascript_include_tag` -* New host detection in preview server. Provides better externally accessible host/ip information for connecting from mobile devices and virtual machines. +* Change how config options are passed to Thor. Removes new Thor warnings from #2017 -3.3.12 -=== +# 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" +* Remove 'upgrade' and 'install' CLI commands. +* Gemfile may be in a parent directory of your Middleman project root (where 'config.rb' is). +* All dependencies for your Middleman project must be expressed in `Gemfile` - Bundler is no longer optional. +* Asciidoc information now available with the `asciidoc` local, which is a normal hash. +* Remove `page` template local. Use `current_resource` instead. +* Dropped support for providing a block to `page` & `proxy`. +* Dropped support for instance variables inside templates. +* Moved all rendering into `TemplateRenderer` and `FileRenderer` +* Placed all template evaluation inside the `TemplateContext` class +* 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` -* The preview server URL will use the local hostname rather than '0.0.0.0'. It will also print out a URL based on the host's public IP in case that's useful. -* The `--host` flag and `config.rb` setting have been removed - the preview server will always bind to all interfaces. - -3.3.11 -=== -* Add `srcset` option to `image_tag`. Also enables them in Markdown. -* Add jruby to the list of envs requiring tzinfo-data. -* Don't lookup resource for path if the path is absolute. Fixes #1195 -* Make preview host and port configurable in config.rb and also expose those variables to extensions which are curious. Closes #1477 -* Append assets hash to .woff2 files -* Rack support has been broken since v3.3.9, fix that. #1501 - -3.3.10 -=== -* Fixes #1469, missing `cattr_accessor` in Redcarpet support. -* Fix slim >= 3.0.0 deprecation warning - -3.3.9 -=== -* Moved main `Application` from requiring to autoloading to work around some double-loading issues in Docker. - -3.3.8 -=== -* Define a mime type for sourcemaps. #1451 -* Asset hashing for image references in srcset -* Import patch to bugfix from Padrino Helpers #1401 -* Better URI encoding and decoding #1406 -* Update version of i18n - -3.3.7 -=== -* Update new project template Gemfile to use HTTPS by default. #1372 - -3.3.6 -=== - -* Use full paths instead of relative for `listen` gem. Fixes #1374 -* Add force option to "middleman init". #1369 -* Configuration addition for compass 1 compatibility. -* Catch File read exceptions in frontmatter. -* Remove duplicate attr_accessor. Closes #1352 -* Update sass dependency to >= 3.4.0. -* Update compass dependency to >= 1.0.0, < 2.0.0 -* Accept pandoc-style YAML frontmatter. #1350 -* Add webp to image type lists. - -3.3.5 -=== - -* Update Padrino to ~> 0.12.3 (removed breadcrumb helper) -* Update compass-import-once to 1.0.5 -* Fix issue with Slim partials. #1327 - -3.3.4 -=== - -* Fix `automatic_alt_tags` error. #1341 -* `partial` now looks for i18n suffixed filenames. #1333 -* Allow excluding paths from `gzip`. #1268 -* Let LiveReload work on 404 pages. -* Update `listen` dependency. - -3.3.3 -=== - -* Fix thread-safety issue #501 which could cause excepts when livereloading. -* Update to support Hooks 0.4.x dep. -* Update to support Padrino 0.12.2+ dep. -* Fix `after_render` manipulation of content. #1278 -* Fix combo of compass-import-once and sass-globs. middleman/middleman-sprockets#56 - -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/Gemfile b/Gemfile index 08de2a54..db4043a0 100644 --- a/Gemfile +++ b/Gemfile @@ -5,36 +5,48 @@ gem 'rake', '~> 10.3', require: false gem 'yard', '~> 0.8', require: false # Test tools -gem 'pry', '~> 0.10', group: :development -gem 'aruba', '~> 0.7.4' -gem 'rspec', '~> 3.0' -gem 'cucumber', '~> 2.0' +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' # Optional middleman dependencies, included for tests -gem 'less', '2.3', require: false +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', '>= 1.4', require: false -gem 'redcarpet', '>= 3.1', require: false unless RUBY_ENGINE == 'jruby' -gem 'asciidoctor', '~> 0.1', require: false +gem 'sinatra', '>= 2.0.0.beta2', require: false +gem 'redcarpet', '>= 3.1', require: false # Dns server to test preview server gem 'rubydns', '~> 1.0.1', require: false # To test javascript -gem 'poltergeist', '~> 1.6.0', require: false +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 'therubyracer', '>= 0.12', platforms: :ruby gem 'therubyrhino', '>= 2.0', platforms: :jruby +gem 'therubyracer', '>= 0.12', platforms: :ruby # 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 # Middleman itself -gem 'middleman', path: 'middleman' +gem 'middleman-cli', path: 'middleman-cli' gem 'middleman-core', path: 'middleman-core' -gem 'middleman-sprockets', github: 'middleman/middleman-sprockets', branch: 'v3-stable-real' + +# gem 'middleman-compass', github: 'middleman/middleman-compass', require: false +# gem 'middleman-sprockets', github: 'middleman/middleman-sprockets', require: false diff --git a/ISSUE_TEMPLATE.md b/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..6d2dc0e0 --- /dev/null +++ b/ISSUE_TEMPLATE.md @@ -0,0 +1,9 @@ +## 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 540ca969..df4497f7 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,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/sstephenson/sprockets) +* Multiple asset management solutions, including [Sprockets](https://github.com/rails/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 +19,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]. +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. ``` gem install middleman @@ -91,7 +91,7 @@ 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://spacebox.io/s/4dXbHBorC3) +[Click here to lend your support to Middleman](https://plasso.co/s/4dXbHBorC3) ## Versioning @@ -104,7 +104,7 @@ 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', '~> 3.0' + spec.add_dependency 'middleman-core', '~> 4.0' [semver]: http://semver.org/ [pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint @@ -121,5 +121,6 @@ Copyright (c) 2010-2015 Thomas Reynolds. MIT Licensed, see [LICENSE] for details [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 d1fe239e..508c3a1d 100644 --- a/Rakefile +++ b/Rakefile @@ -1,12 +1,11 @@ -require 'rubygems' unless defined?(Gem) require 'rake' require File.expand_path('../middleman-core/lib/middleman-core/version.rb', __FILE__) ROOT = File.expand_path(File.dirname(__FILE__)) -GEM_NAME = 'middleman' +GEM_NAME = 'middleman'.freeze -middleman_gems = %w(middleman-core middleman) +middleman_gems = %w(middleman-core middleman-cli middleman) GEM_PATHS = middleman_gems.freeze def sh_rake(command) @@ -37,7 +36,7 @@ end desc 'Generate documentation for all middleman gems' task :doc do GEM_PATHS.each do |g| - Dir.chdir("#{File.join(ROOT, g)}") { sh "#{Gem.ruby} -S rake yard" } + Dir.chdir(File.join(ROOT, g).to_s) { sh "#{Gem.ruby} -S rake yard" } end end @@ -46,14 +45,14 @@ task :test do Rake::Task['rubocop'].invoke GEM_PATHS.each do |g| - Dir.chdir("#{File.join(ROOT, g)}") { sh "#{Gem.ruby} -S rake test" } + Dir.chdir(File.join(ROOT, g).to_s) { 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)}") { sh "#{Gem.ruby} -S rake spec" } + Dir.chdir(File.join(ROOT, g).to_s) { sh "#{Gem.ruby} -S rake spec" } end end diff --git a/gem_rake_helper.rb b/gem_rake_helper.rb index ff7a592d..ea46e6a7 100644 --- a/gem_rake_helper.rb +++ b/gem_rake_helper.rb @@ -1,4 +1,3 @@ -require 'rubygems' unless defined?(Gem) require 'rake' require 'yard' @@ -21,15 +20,14 @@ Cucumber::Rake::Task.new do |t| 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 = "--require features --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 = "--color #{exempt_tags.join(' ')} --strict"# --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}" + t.cucumber_opts = "--require features --color #{exempt_tags.join(' ')} --strict" # --format #{ENV['CUCUMBER_FORMAT'] || 'Fivemat'}" end require 'rspec/core/rake_task' diff --git a/middleman-core/fixtures/asciidoc-app/config.rb b/middleman-cli/.gemtest similarity index 100% rename from middleman-core/fixtures/asciidoc-app/config.rb rename to middleman-cli/.gemtest diff --git a/middleman-cli/.simplecov b/middleman-cli/.simplecov new file mode 100644 index 00000000..1e7f68e2 --- /dev/null +++ b/middleman-cli/.simplecov @@ -0,0 +1,7 @@ +SimpleCov.start do + add_filter '/fixtures/' + add_filter '/features/' + add_filter '/spec/' + add_filter '/step_definitions/' + add_filter '/lib/vendored-middleman-deps/' +end \ No newline at end of file diff --git a/middleman-cli/.yardopts b/middleman-cli/.yardopts new file mode 100644 index 00000000..b816052e --- /dev/null +++ b/middleman-cli/.yardopts @@ -0,0 +1,9 @@ +lib/**/*.rb +--exclude lib/middleman-cli/templates/default/ +--exclude lib/middleman-cli/templates/html5/ +--exclude lib/middleman-cli/templates/mobile/ +--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 diff --git a/middleman-cli/Rakefile b/middleman-cli/Rakefile new file mode 100644 index 00000000..db0d1cb8 --- /dev/null +++ b/middleman-cli/Rakefile @@ -0,0 +1,4 @@ +# coding:utf-8 +RAKE_ROOT = __FILE__.freeze +GEM_NAME = 'middleman-cli'.freeze +require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper') diff --git a/middleman-cli/bin/middleman b/middleman-cli/bin/middleman new file mode 100755 index 00000000..8b381a08 --- /dev/null +++ b/middleman-cli/bin/middleman @@ -0,0 +1,70 @@ +#!/usr/bin/env ruby + +require 'middleman-core/profiling' +if ARGV.include? '--profile' + Middleman::Profiling.profiler = Middleman::Profiling::RubyProfProfiler.new +end +# 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) diff --git a/middleman-core/features/cli_extension.feature b/middleman-cli/features/cli_extension.feature similarity index 91% rename from middleman-core/features/cli_extension.feature rename to middleman-cli/features/cli_extension.feature index b762664c..5385a622 100644 --- a/middleman-core/features/cli_extension.feature +++ b/middleman-cli/features/cli_extension.feature @@ -9,6 +9,6 @@ Feature: Middleman New Extension CLI | Rakefile | | my-extension-library.gemspec | | features/support/env.rb | - | lib/middleman_extension.rb | + | lib/my-extension-library/extension.rb | | lib/my-extension-library.rb | | .gitignore | diff --git a/middleman-cli/features/cli_init.feature b/middleman-cli/features/cli_init.feature new file mode 100644 index 00000000..96595422 --- /dev/null +++ b/middleman-cli/features/cli_init.feature @@ -0,0 +1,93 @@ +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 new file mode 100644 index 00000000..15f6cba0 --- /dev/null +++ b/middleman-cli/features/preview_server-hook.feature @@ -0,0 +1,17 @@ +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-core/features/cli/preview_server.feature b/middleman-cli/features/preview_server.feature similarity index 92% rename from middleman-core/features/cli/preview_server.feature rename to middleman-cli/features/preview_server.feature index f82a0a1f..94ecc5b2 100644 --- a/middleman-core/features/cli/preview_server.feature +++ b/middleman-cli/features/preview_server.feature @@ -31,7 +31,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to ":::4567", "0.0.0.0:4567" + The Middleman preview server is bound to ":::4567", "0.0.0.0:4567" """ And the output should contain: """ @@ -42,7 +42,7 @@ Feature: Run the preview server Inspect your site configuration at "http:// """ - @ruby-2.1 + @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 @@ -52,7 +52,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to ":::4567", "0.0.0.0:4567" + The Middleman preview server is bound to ":::4567", "0.0.0.0:4567" """ And the output should contain: """ @@ -76,7 +76,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to "127.0.0.1:4567" + The Middleman preview server is bound to "127.0.0.1:4567" """ And the output should contain: """ @@ -104,7 +104,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to "127.0.0.1:4567" + The Middleman preview server is bound to "127.0.0.1:4567" """ And the output should contain: """ @@ -115,6 +115,7 @@ Feature: Run the preview server 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 @@ -127,7 +128,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to "127.0.0.5:4567" + The Middleman preview server is bound to "127.0.0.5:4567" """ And the output should contain: """ @@ -151,7 +152,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to "::1:4567" + The Middleman preview server is bound to "::1:4567" """ And the output should contain: """ @@ -170,7 +171,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to "0.0.0.0:4567" + The Middleman preview server is bound to "0.0.0.0:4567" """ And the output should contain: """ @@ -189,7 +190,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to ":::4567" + The Middleman preview server is bound to ":::4567" """ And the output should contain: """ @@ -213,7 +214,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to "127.0.0.1:4567" + The Middleman preview server is bound to "127.0.0.1:4567" """ And the output should contain: """ @@ -241,7 +242,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to "127.0.0.1:4567" + The Middleman preview server is bound to "127.0.0.1:4567" """ And the output should contain: """ @@ -265,7 +266,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to "127.0.0.1:4567" + The Middleman preview server is bound to "127.0.0.1:4567" """ And the output should contain: """ @@ -284,7 +285,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to "127.0.0.1:4567" + The Middleman preview server is bound to "127.0.0.1:4567" """ And the output should contain: """ @@ -303,7 +304,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to "::1:4567" + The Middleman preview server is bound to "::1:4567" """ And the output should contain: """ @@ -322,7 +323,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to ":::4567", "0.0.0.0:4567" + The Middleman preview server is bound to ":::4567", "0.0.0.0:4567" """ And the output should contain: """ @@ -341,7 +342,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to ":::65432", "0.0.0.0:65432" + The Middleman preview server is bound to ":::65432", "0.0.0.0:65432" """ Scenario: Start the server with port 65432 configured via config.rb @@ -356,9 +357,10 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to ":::65432", "0.0.0.0:65432" + 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 @@ -456,7 +458,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to "127.0.0.1:4567" + The Middleman preview server is bound to "127.0.0.1:4567" """ And the output should contain: """ @@ -467,7 +469,8 @@ Feature: Run the preview server Inspect your site configuration at "http://www.example.com:4567/__middleman", "http://127.0.0.1:4567/__middleman" """ - @ruby-2.1 + @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". @@ -488,7 +491,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to "127.0.0.1:4567" + The Middleman preview server is bound to "127.0.0.1:4567" """ And the output should contain: """ @@ -499,7 +502,8 @@ Feature: Run the preview server Inspect your site configuration at "http://host.local:4567/__middleman", "http://127.0.0.1:4567/__middleman" """ - @ruby-2.1 + @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 @@ -520,7 +524,7 @@ Feature: Run the preview server """ Then the output should contain: """ - The Middleman preview server is bind to "127.0.0.1:4567" + The Middleman preview server is bound to "127.0.0.1:4567" """ And the output should contain: """ diff --git a/middleman-cli/features/support/env.rb b/middleman-cli/features/support/env.rb new file mode 100644 index 00000000..8044deab --- /dev/null +++ b/middleman-cli/features/support/env.rb @@ -0,0 +1,19 @@ +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/preview-server-app/bin/dns_server.rb b/middleman-cli/fixtures/preview-server-app/bin/dns_server.rb similarity index 92% rename from middleman-core/fixtures/preview-server-app/bin/dns_server.rb rename to middleman-cli/fixtures/preview-server-app/bin/dns_server.rb index 78726f59..f4f16455 100755 --- a/middleman-core/fixtures/preview-server-app/bin/dns_server.rb +++ b/middleman-cli/fixtures/preview-server-app/bin/dns_server.rb @@ -24,7 +24,7 @@ interfaces = [ # Start the RubyDNS server -RubyDNS::run_server(:listen => interfaces) do +RubyDNS::run_server(listen: interfaces) do db.each do |matcher, result| match(matcher, Resolv::DNS::Resource::IN::A) do |transaction| transaction.respond!(result) diff --git a/middleman-core/fixtures/compass-sprites-app/config.rb b/middleman-cli/fixtures/preview-server-app/config.rb similarity index 100% rename from middleman-core/fixtures/compass-sprites-app/config.rb rename to middleman-cli/fixtures/preview-server-app/config.rb diff --git a/middleman-core/fixtures/preview-server-app/source/index.html.erb b/middleman-cli/fixtures/preview-server-app/source/index.html.erb similarity index 100% rename from middleman-core/fixtures/preview-server-app/source/index.html.erb rename to middleman-cli/fixtures/preview-server-app/source/index.html.erb diff --git a/middleman-core/fixtures/preview-server-app/source/layout.erb b/middleman-cli/fixtures/preview-server-app/source/layout.erb similarity index 100% rename from middleman-core/fixtures/preview-server-app/source/layout.erb rename to middleman-cli/fixtures/preview-server-app/source/layout.erb diff --git a/middleman-core/fixtures/preview-server-app/source/layouts/custom.erb b/middleman-cli/fixtures/preview-server-app/source/layouts/custom.erb similarity index 100% rename from middleman-core/fixtures/preview-server-app/source/layouts/custom.erb rename to middleman-cli/fixtures/preview-server-app/source/layouts/custom.erb diff --git a/middleman-core/fixtures/preview-server-app/source/real.html b/middleman-cli/fixtures/preview-server-app/source/real.html similarity index 100% rename from middleman-core/fixtures/preview-server-app/source/real.html rename to middleman-cli/fixtures/preview-server-app/source/real.html diff --git a/middleman-core/fixtures/preview-server-app/source/real/index.html.erb b/middleman-cli/fixtures/preview-server-app/source/real/index.html.erb similarity index 100% rename from middleman-core/fixtures/preview-server-app/source/real/index.html.erb rename to middleman-cli/fixtures/preview-server-app/source/real/index.html.erb diff --git a/middleman-core/fixtures/preview-server-app/source/should_be_ignored.html b/middleman-cli/fixtures/preview-server-app/source/should_be_ignored.html similarity index 100% rename from middleman-core/fixtures/preview-server-app/source/should_be_ignored.html rename to middleman-cli/fixtures/preview-server-app/source/should_be_ignored.html diff --git a/middleman-core/fixtures/preview-server-app/source/should_be_ignored2.html b/middleman-cli/fixtures/preview-server-app/source/should_be_ignored2.html similarity index 100% rename from middleman-core/fixtures/preview-server-app/source/should_be_ignored2.html rename to middleman-cli/fixtures/preview-server-app/source/should_be_ignored2.html diff --git a/middleman-core/fixtures/preview-server-app/source/should_be_ignored3.html b/middleman-cli/fixtures/preview-server-app/source/should_be_ignored3.html similarity index 100% rename from middleman-core/fixtures/preview-server-app/source/should_be_ignored3.html rename to middleman-cli/fixtures/preview-server-app/source/should_be_ignored3.html diff --git a/middleman-core/fixtures/preview-server-app/source/static.html b/middleman-cli/fixtures/preview-server-app/source/static.html similarity index 100% rename from middleman-core/fixtures/preview-server-app/source/static.html rename to middleman-cli/fixtures/preview-server-app/source/static.html diff --git a/middleman-cli/fixtures/preview-server-hook-app/config.rb b/middleman-cli/fixtures/preview-server-hook-app/config.rb new file mode 100644 index 00000000..9892009e --- /dev/null +++ b/middleman-cli/fixtures/preview-server-hook-app/config.rb @@ -0,0 +1,19 @@ +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 new file mode 100644 index 00000000..ca390d46 --- /dev/null +++ b/middleman-cli/fixtures/preview-server-hook-app/source/index.html.erb @@ -0,0 +1,9 @@ + +
+ +Hello, AsciiDoc! - Middleman, I am in you.
-Hello, AsciiDoc! - Middleman, I am in you.
-Hello, AsciiDoc!
-Hello, AsciiDoc!
-Hello, AsciiDoc!
-Hello, AsciiDoc!
-I'm included content.-
puts "Is this mic on?"
- Paragraph 1
" diff --git a/middleman-core/features/default-layout.feature b/middleman-core/features/default-layout.feature new file mode 100644 index 00000000..82fbeeff --- /dev/null +++ b/middleman-core/features/default-layout.feature @@ -0,0 +1,90 @@ +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: + """ +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) + + {: 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 7eec709b..c0f744ac 100644 --- a/middleman-core/features/markdown_redcarpet.feature +++ b/middleman-core/features/markdown_redcarpet.feature @@ -1,4 +1,3 @@ -@nojava Feature: Markdown (Redcarpet) support In order to test included Redcarpet support @@ -7,14 +6,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" @@ -42,9 +41,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" @@ -59,7 +58,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" @@ -70,13 +69,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" @@ -103,7 +102,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: """ @@ -118,8 +117,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" @@ -130,7 +129,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 a0f10160..c8adfd73 100644 --- a/middleman-core/features/markdown_redcarpet_in_haml.feature +++ b/middleman-core/features/markdown_redcarpet_in_haml.feature @@ -1,4 +1,3 @@ -@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 new file mode 100644 index 00000000..250c6857 --- /dev/null +++ b/middleman-core/features/markdown_redcarpet_in_slim.feature @@ -0,0 +1,41 @@ +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) + +  + """ + 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 29c3e8c6..cbf03fe3 100644 --- a/middleman-core/features/minify_css.feature +++ b/middleman-core/features/minify_css.feature @@ -5,16 +5,19 @@ 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 "50" lines + Then I should see "7" 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" @@ -25,11 +28,13 @@ 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 """ @@ -42,24 +47,25 @@ Feature: Minify CSS 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 - - set :css_compressor, ::PassThrough + activate :minify_css, compressor: ::PassThrough """ And the Server is running at "passthrough-app" When I go to "/stylesheets/site.css" - Then I should see "46" lines + Then I should see "5" 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" @@ -72,22 +78,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 + activate :minify_css, inline: true, compressor: ::PassThrough - set :css_compressor, ::PassThrough - - 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" @@ -104,15 +110,17 @@ 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" @@ -122,12 +130,14 @@ 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: """ - activate :minify_css, :inline => true + 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.html" @@ -142,7 +152,9 @@ Feature: Minify CSS Given a fixture app "minify-css-app" And a file named "config.rb" with: """ - activate :minify_css, :inline => true + 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" @@ -159,7 +171,9 @@ Feature: Minify CSS Given a fixture app "minify-css-app" And a file named "config.rb" with: """ - activate :minify_css, :inline => true + 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" @@ -176,6 +190,8 @@ Feature: Minify CSS 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, diff --git a/middleman-core/features/minify_javascript.feature b/middleman-core/features/minify_javascript.feature index a8235368..262d977a 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,11 +49,9 @@ Feature: Minify Javascript end end - activate :minify_javascript, :inline => true + activate :minify_javascript, inline: true, compressor: ::PassThrough - set :js_compressor, ::PassThrough - - 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" @@ -98,9 +96,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" @@ -121,12 +119,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" @@ -152,7 +150,7 @@ 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-js.php" @@ -177,7 +175,7 @@ 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 proxy '/inline-js-proxy', '/inline-js.html', ignore: true """ And the Server is running at "minify-js-app" @@ -195,7 +193,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: @@ -216,12 +214,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: @@ -231,7 +229,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: @@ -242,16 +240,14 @@ Feature: Minify Javascript end end - activate :minify_javascript, :inline => true + activate :minify_javascript, inline: true, compressor: ::PassThrough - set :js_compressor, ::PassThrough - - page "/inline-coffeescript.html", :layout => false + 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: @@ -262,11 +258,9 @@ Feature: Minify Javascript end end - activate :minify_javascript - - set :js_compressor, ::PassThrough + activate :minify_javascript, 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-implied_extensions.feature b/middleman-core/features/more-implied_extensions.feature deleted file mode 100644 index 10ee5b20..00000000 --- a/middleman-core/features/more-implied_extensions.feature +++ /dev/null @@ -1,44 +0,0 @@ -Feature: More default extensions - - Scenario: Default extensions preview - Given the Server is running at "more-implied-extensions-app" - When I go to "/test.html" - Then I should see "Hello" - When I go to "/test2.html" - Then I should see "World" - When I go to "/test3.html" - Then I should see "Howdy" - When I go to "/test4.html" - Then I should see "HELLO" - When I go to "/javascripts/app.js" - Then I should see "derp" - Then I should not see "I am in the layout" - When I go to "/stylesheets/style.css" - Then I should see "section" - Then I should not see "I am in the layout" - When I go to "/stylesheets/style2.css" - Then I should see "section" - Then I should not see "I am in the layout" - - Scenario: Default extensions build - Given a fixture app "more-implied-extensions-app" - And a successfully built app at "more-implied-extensions-app" - When I cd to "build" - Then the following files should exist: - | test.html | - | test2.html | - | test3.html | - | test4.html | - | javascripts/app.js | - | stylesheets/style.css | - | stylesheets/style2.css | - And the file "test.html" should contain "Hello" - And the file "test2.html" should contain "World" - And the file "test3.html" should contain "Howdy" - And the file "test4.html" should contain "HELLO" - And the file "javascripts/app.js" should contain "derp" - And the file "javascripts/app.js" should not contain "I am in the layout" - And the file "stylesheets/style.css" should contain "section" - And the file "stylesheets/style.css" should not contain "I am in the layout" - And the file "stylesheets/style2.css" should contain "section" - And the file "stylesheets/style2.css" should not contain "I am in the layout" diff --git a/middleman-core/features/more-instance_vars.feature b/middleman-core/features/more-instance_vars.feature deleted file mode 100644 index 87fc3b0d..00000000 --- a/middleman-core/features/more-instance_vars.feature +++ /dev/null @@ -1,18 +0,0 @@ -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/mount_rack.feature b/middleman-core/features/mount_rack.feature index b2dbe5a0..dcb83146 100644 --- a/middleman-core/features/mount_rack.feature +++ b/middleman-core/features/mount_rack.feature @@ -47,11 +47,9 @@ Feature: Support Rack apps mounted using map run MySinatra end - configure :build do - endpoint "sinatra/index2.html", :path => "/sinatra/" - end + endpoint "sinatra/index2.html", path: "/sinatra/" - 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 new file mode 100644 index 00000000..a6b1e975 --- /dev/null +++ b/middleman-core/features/move_files.feature @@ -0,0 +1,44 @@ +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 new file mode 100644 index 00000000..4f23474a --- /dev/null +++ b/middleman-core/features/multiple-sources.feature @@ -0,0 +1,35 @@ +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 d70a7e23..f51831fb 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 + Master ErbThe 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 "New Article Title
The Article Content
" - + Then I should see "New Article Title
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 + Master HamlThe Article Content
""" @@ -43,13 +43,16 @@ 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 "Inner" + 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" When I go to "/data-two.html" Then I should see "Page Number Two" - And I should not see "Inner" + And I should not see "I am Inner" When I go to "/data-one.html" Then I should see "Page Number One" - And I should see "Inner" + And I should see "I am Inner" When I go to "/data-two.html" Then I should see "Page Number Two" - And I should not see "Inner" + And I should not see "I am Inner" diff --git a/middleman-core/features/page-id.feature b/middleman-core/features/page-id.feature new file mode 100644 index 00000000..74d08cb5 --- /dev/null +++ b/middleman-core/features/page-id.feature @@ -0,0 +1,72 @@ +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 new file mode 100644 index 00000000..9338e019 --- /dev/null +++ b/middleman-core/features/paginate.feature @@ -0,0 +1,204 @@ +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 965215a9..8a0154c2 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: Finds shared partials without _ prefix + Scenario: Flags error when partial is not found Given the Server is running at "partials-app" - When I go to "/using_snippet.html" - Then I should see "Snippet" - + When I go to "/index_missing.html" + Then I should see "Error: Could not locate partial" + 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,7 +38,7 @@ 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" @@ -55,3 +55,10 @@ Feature: Provide Sane Defaults for Partial Behavior 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 deleted file mode 100644 index 8648c8e2..00000000 --- a/middleman-core/features/partials_dir.feature +++ /dev/null @@ -1,30 +0,0 @@ -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/proxy_pages.feature b/middleman-core/features/proxy_pages.feature index 522f1eb8..4a22727c 100644 --- a/middleman-core/features/proxy_pages.feature +++ b/middleman-core/features/proxy_pages.feature @@ -15,8 +15,6 @@ Feature: Proxy Pages (using proxy rather than page) | fake2/two.html | | fake3/one.html | | fake3/two.html | - | fake4/one.html | - | fake4/two.html | | target_ignore.html | | target_ignore2.html | | target_ignore3.html | @@ -35,8 +33,6 @@ Feature: Proxy Pages (using proxy rather than page) Then I should see "I am real" When I go to "/fake3.html" 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 "proxy-pages-app" @@ -49,9 +45,6 @@ Feature: Proxy Pages (using proxy rather than page) When I go to "/fake3/one.html" Then I should see "I am real: one" - When I go to "/fake4/one.html" - Then I should see "I am real: one" - Scenario: Preview proxy with variable two Given the Server is running at "proxy-pages-app" When I go to "/fake/two.html" @@ -62,9 +55,6 @@ Feature: Proxy Pages (using proxy rather than page) When I go to "/fake3/two.html" Then I should see "I am real: two" - - When I go to "/fake4/two.html" - Then I should see "I am real: two" Scenario: Build proxy with variable one Given a successfully built app at "proxy-pages-app" diff --git a/middleman-core/features/queryable.feature b/middleman-core/features/queryable.feature deleted file mode 100644 index 1382db3f..00000000 --- a/middleman-core/features/queryable.feature +++ /dev/null @@ -1,35 +0,0 @@ -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 f01e9aac..c1549128 100644 --- a/middleman-core/features/redirects.feature +++ b/middleman-core/features/redirects.feature @@ -4,7 +4,7 @@ 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" @@ -15,7 +15,7 @@ Feature: Meta redirects Given a fixture app "large-build-app" And a file named "config.rb" with: """ - redirect "hello.html", :to => "http://example.com" + redirect "hello.html", to: "http://example.com" """ And the Server is running at "large-build-app" When I go to "/hello.html" @@ -27,7 +27,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 +39,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 +52,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 e0c6b16f..ba131396 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,7 +15,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 "stylesheets/relative_assets.css" should contain 'url("/images/blank.gif")' Scenario: Rendering html with the feature disabled Given "relative_assets" feature is "disabled" @@ -33,7 +33,19 @@ Feature: Relative Assets 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" + 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' Scenario: Building css with the feature enabled Given a fixture app "relative-assets-app" @@ -43,7 +55,8 @@ 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")' + Then the file "javascripts/application.js" should not contain "../" Scenario: Relative css reference with directory indexes Given a fixture app "relative-assets-app" @@ -56,60 +69,30 @@ 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 + Scenario: Rendering html with the feature enabled (overrides relative option on helpers) 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 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" - - 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" + Then I should see: + """ + url("../fonts/StMarie-Thin.otf" + """ + And I should see: + """ + url("../fonts/blank/blank.otf" + """ Scenario: Building scss with the feature enabled Given a fixture app "fonts-app" @@ -119,21 +102,14 @@ Feature: Relative Assets """ Given a successfully built app at "fonts-app" When I cd to "build" - 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: + Then the file "stylesheets/fonts.css" should contain: """ - set :fonts_dir, "otf" - activate :relative_assets + url("../fonts/StMarie-Thin.otf") + """ + And the file "stylesheets/fonts.css" should contain: + """ + url("../fonts/blank/blank.otf") """ - 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" @@ -144,7 +120,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 '