Fix: Can't clean files when the project is under a hidden directory.
This commit is contained in:
parent
fd6a2376bd
commit
67fc3d0c05
4 changed files with 25 additions and 1 deletions
|
@ -42,3 +42,21 @@ Feature: Build Clean
|
||||||
Then the following files should not exist:
|
Then the following files should not exist:
|
||||||
| sub/dir/about.html |
|
| sub/dir/about.html |
|
||||||
| sub/dir/nested/nested.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 |
|
||||||
|
|
|
@ -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
|
|
@ -0,0 +1 @@
|
||||||
|
set :build_dir, ".build"
|
|
@ -213,7 +213,7 @@ module Middleman
|
||||||
end
|
end
|
||||||
|
|
||||||
@to_clean = paths.select do |path|
|
@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
|
end
|
||||||
|
|
||||||
# handle UTF-8-MAC filename on MacOS
|
# handle UTF-8-MAC filename on MacOS
|
||||||
|
|
Loading…
Add table
Reference in a new issue