Merge pull request #4032 from jekyll/refactor-cleaner-for-expressiveness

Make a constant for the regex to find hidden files
This commit is contained in:
Jordon Bedwell 2015-10-17 06:56:55 -05:00
commit 271dc42724
1 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@ require 'set'
module Jekyll module Jekyll
# Handles the cleanup of a site's destination before it is built. # Handles the cleanup of a site's destination before it is built.
class Cleaner class Cleaner
HIDDEN_FILE_REGEX = /\/\.{1,2}$/
attr_reader :site attr_reader :site
def initialize(site) def initialize(site)
@ -40,7 +41,7 @@ module Jekyll
dirs = keep_dirs dirs = keep_dirs
Dir.glob(site.in_dest_dir("**", "*"), File::FNM_DOTMATCH) do |file| Dir.glob(site.in_dest_dir("**", "*"), File::FNM_DOTMATCH) do |file|
next if file =~ /\/\.{1,2}$/ || file =~ regex || dirs.include?(file) next if file =~ HIDDEN_FILE_REGEX || file =~ regex || dirs.include?(file)
files << file files << file
end end