Use FileList instead of Dir.glob
This commit is contained in:
parent
2f06f4aad7
commit
fc0ea20a85
22
Rakefile
22
Rakefile
|
@ -191,20 +191,24 @@ namespace :site do
|
||||||
|
|
||||||
# Proceed to purge all files in case we removed a file in this release.
|
# Proceed to purge all files in case we removed a file in this release.
|
||||||
puts "Cleaning gh-pages directory..."
|
puts "Cleaning gh-pages directory..."
|
||||||
Dir.glob("gh-pages/{*,.*}") do |path|
|
purge_exclude = %w[
|
||||||
next if path.eql? "gh-pages/."
|
gh-pages/.
|
||||||
next if path.eql? "gh-pages/.."
|
gh-pages/..
|
||||||
next if path.eql? "gh-pages/.git"
|
gh-pages/.git
|
||||||
|
]
|
||||||
|
FileList["gh-pages/{*,.*}"].exclude(*purge_exclude).each do |path|
|
||||||
sh "rm -rf #{path}"
|
sh "rm -rf #{path}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Copy site to gh-pages dir.
|
# Copy site to gh-pages dir.
|
||||||
puts "Copying site to gh-pages branch..."
|
puts "Copying site to gh-pages branch..."
|
||||||
Dir.glob("site/{*,.*}") do |path|
|
copy_exclude = %w[
|
||||||
next if path.eql? "site/."
|
site/.
|
||||||
next if path.eql? "site/.."
|
site/..
|
||||||
next if path.eql? "site/.jekyll-metadata"
|
site/.jekyll-metadata
|
||||||
next if path.eql? "site/_site"
|
site/_site
|
||||||
|
]
|
||||||
|
FileList["site/{*,.*}"].exclude(*copy_exclude).each do |path|
|
||||||
sh "cp -R #{path} gh-pages/"
|
sh "cp -R #{path} gh-pages/"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue