diff --git a/middleman-core/features/clean_build.feature b/middleman-core/features/clean_build.feature index ba93ae0e..fd8e1c4a 100644 --- a/middleman-core/features/clean_build.feature +++ b/middleman-core/features/clean_build.feature @@ -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 | - diff --git a/middleman-core/lib/middleman-core/cli/build.rb b/middleman-core/lib/middleman-core/cli/build.rb index b6dedfcb..772eb674 100644 --- a/middleman-core/lib/middleman-core/cli/build.rb +++ b/middleman-core/lib/middleman-core/cli/build.rb @@ -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) diff --git a/middleman-more/features/clean_build.feature b/middleman-more/features/clean_build.feature index f9ef15dc..a7a0b84c 100644 --- a/middleman-more/features/clean_build.feature +++ b/middleman-more/features/clean_build.feature @@ -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 | \ No newline at end of file