Merge pull request #36 from kazu634/task-modify
Create the deploy tasks for production and staging
This commit is contained in:
commit
9d6d065efe
|
@ -18,8 +18,8 @@ def os
|
|||
)
|
||||
end
|
||||
|
||||
desc 'Generate the HTML pages'
|
||||
task :build do
|
||||
desc 'Preparation for Generating the HTML Pages'
|
||||
task :prep do
|
||||
cd 'content/' do
|
||||
if os == :linux
|
||||
sh 'grep -l -r ecx.images-amazon.com | sort | uniq | xargs --no-run-if-empty sed -ie "s/http:\/\/ecx.images-amazon.com/https:\/\/images-na.ssl-images-amazon.com/g"'
|
||||
|
@ -37,6 +37,4 @@ task :build do
|
|||
cd 'public' do
|
||||
sh 'rm -rf *'
|
||||
end
|
||||
|
||||
sh 'hugo -e staging -v'
|
||||
end
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env rake
|
||||
|
||||
require 'find'
|
||||
|
||||
desc 'Deploy the hugo contents to the server'
|
||||
task :prod => [:prep] do
|
||||
sh 'hugo -v'
|
||||
|
||||
sh 'find public -type f -name "*.gz" -delete'
|
||||
|
||||
Find.find("#{Dir::pwd}/public") do |f|
|
||||
if f =~ /\.(css|js|png|jpg|JPG|PNG|CSS|JS)$/ && FileTest.file?(f)
|
||||
sh "gzip -c #{f} > #{f}.gz"
|
||||
sh "rm #{f}"
|
||||
end
|
||||
end
|
||||
|
||||
sh 'ssh -p 10022 webadm@10.0.1.234 "rm -rf /var/www/blog/*"'
|
||||
sh 'rsync -e "ssh -p 10022" -rltvz --omit-dir-times --delete public/ webadm@10.0.1.234:/var/www/blog'
|
||||
end
|
|
@ -3,12 +3,15 @@
|
|||
require 'find'
|
||||
|
||||
desc 'Deploy the hugo contents to the server'
|
||||
task :deploy => [:build] do
|
||||
task :stag => [:prep] do
|
||||
sh 'hugo -e staging -v'
|
||||
|
||||
sh 'find public -type f -name "*.gz" -delete'
|
||||
|
||||
Find.find("#{Dir::pwd}/public") do |f|
|
||||
if f =~ /\.(css|js|png|jpg|JPG|PNG|CSS|JS)$/ && FileTest.file?(f)
|
||||
sh "gzip -c #{f} > #{f}.gz"
|
||||
sh "rm #{f}"
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue