Merge pull request #1613 from ne-sachirou/fix/clean_under_hidden_dir

Fix: Can't clean files when the project is under a hidden directory.
v3-stable
Thomas Reynolds 2015-09-30 23:57:05 -07:00
commit a064ba93b3
4 changed files with 25 additions and 1 deletions

View File

@ -42,3 +42,21 @@ Feature: Build Clean
Then the following files should not exist:
| sub/dir/about.html |
| sub/dir/nested/nested.html |
Scenario: Build and clean an app under a hidden directory
Given a fixture app "clean-app"
And app "clean-app" is using config "hidden-dir-before"
And a built app at "clean-app"
Then the following files should exist:
| .build/index.html |
| .build/should_be_ignored.html |
| .build/should_be_ignored2.html |
| .build/should_be_ignored3.html |
Given app "clean-app" is using config "hidden-dir-after"
And a built app at "clean-app"
Then the following files should exist:
| .build/index.html |
And the following files should not exist:
| .build/should_be_ignored.html |
| .build/should_be_ignored2.html |
| .build/should_be_ignored3.html |

View File

@ -0,0 +1,5 @@
set :build_dir, ".build"
ignore "/should_be_ignored.html"
page "/should_be_ignored2.html", :ignore => true
page "/target_ignore.html", :proxy => "/should_be_ignored3.html", :ignore => true

View File

@ -0,0 +1 @@
set :build_dir, ".build"

View File

@ -167,7 +167,7 @@ module Middleman::Cli
paths = ::Middleman::Util.all_files_under(@build_dir).map(&:realpath).select(&:file?)
@to_clean += paths.select do |path|
path.to_s !~ /\/\./ || path.to_s =~ /\.(htaccess|htpasswd)/
path.relative_path_from(@build_dir.realpath).to_s !~ /\/\./ || path.to_s =~ /\.(htaccess|htpasswd)/
end
return unless RUBY_PLATFORM =~ /darwin/