Skip to content

Commit

Permalink
Merge pull request jekyll#4032 from jekyll/refactor-cleaner-for-expre…
Browse files Browse the repository at this point in the history
…ssiveness

Make a constant for the regex to find hidden files
  • Loading branch information
envygeeks committed Oct 17, 2015
2 parents ff55da7 + b72556f commit 271dc42
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/jekyll/cleaner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
module Jekyll
# Handles the cleanup of a site's destination before it is built.
class Cleaner
HIDDEN_FILE_REGEX = /\/\.{1,2}$/
attr_reader :site

def initialize(site)
Expand Down Expand Up @@ -40,7 +41,7 @@ def existing_files
dirs = keep_dirs

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
end

Expand Down

0 comments on commit 271dc42

Please sign in to comment.