blog/tasks/staging.rake

21 lines
555 B
Ruby
Raw Normal View History

2019-03-31 11:00:21 +00:00
#!/usr/bin/env rake
require 'find'
desc 'Deploy the hugo contents to the server'
2019-06-29 08:25:33 +00:00
task :stag => [:prep] do
sh 'hugo -e staging -v --minify'
2019-06-29 08:25:33 +00:00
2019-03-31 11:00:21 +00:00
sh 'find public -type f -name "*.gz" -delete'
Find.find("#{Dir::pwd}/public") do |f|
2020-04-30 14:59:23 +00:00
if f =~ /\.(css|js|png|jpg|html|JPG|PNG|CSS|JS|HTML)$/ && FileTest.file?(f)
2019-03-31 11:00:21 +00:00
sh "gzip -c #{f} > #{f}.gz"
2020-04-30 14:59:23 +00:00
# sh "rm #{f}"
2019-03-31 11:00:21 +00:00
end
end
sh 'ssh -p 10022 webadm@10.0.1.166 "rm -rf /var/www/test/*"'
sh 'rsync -e "ssh -p 10022" -rltvz --omit-dir-times --delete public/ webadm@10.0.1.166:/var/www/test'
2019-03-31 11:00:21 +00:00
end