Use FileList instead of Dir.glob

This commit is contained in:
Alan Scherger 2015-01-04 20:46:43 -08:00
parent 2f06f4aad7
commit fc0ea20a85
1 changed files with 13 additions and 9 deletions

View File

@ -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