From fc0ea20a8550c927c6753c73f3eecb29197e6b1d Mon Sep 17 00:00:00 2001 From: Alan Scherger Date: Sun, 4 Jan 2015 20:46:43 -0800 Subject: [PATCH] Use FileList instead of Dir.glob --- Rakefile | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Rakefile b/Rakefile index 1f566860..31434cd4 100644 --- a/Rakefile +++ b/Rakefile @@ -191,20 +191,24 @@ namespace :site do # Proceed to purge all files in case we removed a file in this release. puts "Cleaning gh-pages directory..." - Dir.glob("gh-pages/{*,.*}") do |path| - next if path.eql? "gh-pages/." - next if path.eql? "gh-pages/.." - next if path.eql? "gh-pages/.git" + purge_exclude = %w[ + gh-pages/. + gh-pages/.. + gh-pages/.git + ] + FileList["gh-pages/{*,.*}"].exclude(*purge_exclude).each do |path| sh "rm -rf #{path}" end # Copy site to gh-pages dir. puts "Copying site to gh-pages branch..." - Dir.glob("site/{*,.*}") do |path| - next if path.eql? "site/." - next if path.eql? "site/.." - next if path.eql? "site/.jekyll-metadata" - next if path.eql? "site/_site" + copy_exclude = %w[ + site/. + site/.. + site/.jekyll-metadata + site/_site + ] + FileList["site/{*,.*}"].exclude(*copy_exclude).each do |path| sh "cp -R #{path} gh-pages/" end