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.
This commit is contained in:
commit
a064ba93b3
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"
|
|
@ -167,7 +167,7 @@ module Middleman::Cli
|
||||||
paths = ::Middleman::Util.all_files_under(@build_dir).map(&:realpath).select(&:file?)
|
paths = ::Middleman::Util.all_files_under(@build_dir).map(&:realpath).select(&:file?)
|
||||||
|
|
||||||
@to_clean += paths.select do |path|
|
@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
|
end
|
||||||
|
|
||||||
return unless RUBY_PLATFORM =~ /darwin/
|
return unless RUBY_PLATFORM =~ /darwin/
|
||||||
|
|
Loading…
Reference in a new issue