From 167b213a07b279ad85d044a76f1487a860bdf859 Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Wed, 30 Nov 2011 22:55:09 -0800 Subject: [PATCH] Fix build --clean when the build directory doesn't exist. Before this fix, "build --clean" with no build directory would do nothing. Now it behaves just like a normal build. --- features/clean_build.feature | 5 +++++ lib/middleman/builder.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/features/clean_build.feature b/features/clean_build.feature index fe719571..268d65db 100644 --- a/features/clean_build.feature +++ b/features/clean_build.feature @@ -13,3 +13,8 @@ Feature: Build Clean Then "about/index.html" should exist at "clean-dir-app" Given a built app at "clean-dir-app" with flags "--clean" Then "about/index.html" should exist at "clean-dir-app" + Then cleanup built app at "clean-dir-app" + + Scenario: Clean build an app that's never been built + Given a built app at "clean-dir-app" with flags "--clean" + Then "about/index.html" should exist at "clean-dir-app" diff --git a/lib/middleman/builder.rb b/lib/middleman/builder.rb index 5b433626..9bee25d6 100644 --- a/lib/middleman/builder.rb +++ b/lib/middleman/builder.rb @@ -138,7 +138,7 @@ module Middleman unless path == destination @cleaning_queue << path.sub(@destination, destination[/([^\/]+?)$/]) end - end + end if File.exist?(@destination) end def execute!