Merge pull request #862 from middleman/default_clean_true

Default build to --clean
This commit is contained in:
Ben Hollis 2013-04-13 16:37:51 -07:00
commit daf1756300
3 changed files with 10 additions and 12 deletions

View file

@ -2,14 +2,14 @@ Feature: Build Clean
Scenario: Build and Clean an app
Given a fixture app "clean-app"
And app "clean-app" is using config "empty"
And a successfully built app at "clean-app"
And a successfully built app at "clean-app" with flags "--no-clean"
Then the following files should exist:
| build/index.html |
| build/should_be_ignored.html |
| build/should_be_ignored2.html |
| build/should_be_ignored3.html |
And app "clean-app" is using config "complications"
Given a successfully built app at "clean-app" with flags "--clean"
Given a successfully built app at "clean-app"
Then the following files should not exist:
| build/should_be_ignored.html |
| build/should_be_ignored2.html |
@ -17,12 +17,11 @@ Feature: Build Clean
And the file "build/index.html" should contain "Comment in layout"
Scenario: Clean build an app with newly ignored files and a nested output directory
Given a built app at "clean-nested-app"
Given a built app at "clean-nested-app" with flags "--no-clean"
Then a directory named "sub/dir" should exist
Then the following files should exist:
| sub/dir/about.html |
When I append to "config.rb" with "ignore 'about.html'"
Given a built app at "clean-nested-app" with flags "--clean"
Given a built app at "clean-nested-app"
Then the following files should not exist:
| sub/dir/about.html |

View file

@ -15,11 +15,10 @@ module Middleman::Cli
namespace :build
desc "build [options]", "Builds the static site for deployment"
method_option :clean,
method_option :no_clean,
:type => :boolean,
:aliases => "-c",
:default => false,
:desc => 'Removes orphaned files or directories from build'
:desc => 'Do not remove orphaned files from build'
method_option :glob,
:type => :string,
:aliases => "-g",
@ -60,7 +59,7 @@ module Middleman::Cli
opts = {}
opts[:glob] = options["glob"] if options.has_key?("glob")
opts[:clean] = options["clean"] if options.has_key?("clean")
opts[:clean] = !options["no_clean"] if options.has_key?("no_clean")
action GlobAction.new(self, opts)

View file

@ -1,14 +1,14 @@
Feature: Build Clean
Scenario: Clean an app with directory indexes
Given a successfully built app at "clean-dir-app"
Given a successfully built app at "clean-dir-app" with flags "--no-clean"
Then the following files should exist:
| build/about/index.html |
Given a successfully built app at "clean-dir-app" with flags "--clean"
Given a successfully built app at "clean-dir-app"
Then the following files should exist:
| build/about/index.html |
Scenario: Clean build an app that's never been built
Given a successfully built app at "clean-dir-app" with flags "--clean"
Given a successfully built app at "clean-dir-app"
Then the following files should exist:
| build/about/index.html |