Fix: Can't clean files when the project is under a hidden directory.

feature/livereload-locales-data
inoue_sachiro 2015-09-30 21:23:27 +09:00 committed by Thomas Reynolds
parent fd6a2376bd
commit 67fc3d0c05
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

@ -213,7 +213,7 @@ module Middleman
end
@to_clean = paths.select do |path|
path.to_s !~ /\/\./ || path.to_s =~ /\.(htaccess|htpasswd)/
path.realpath.relative_path_from(@build_dir.realpath).to_s !~ /\/\./ || path.to_s =~ /\.(htaccess|htpasswd)/
end
# handle UTF-8-MAC filename on MacOS