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
|
end
|
||||||
|
|
||||||
desc 'Generate the HTML pages'
|
desc 'Preparation for Generating the HTML Pages'
|
||||||
task :build do
|
task :prep do
|
||||||
cd 'content/' do
|
cd 'content/' do
|
||||||
if os == :linux
|
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"'
|
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
|
cd 'public' do
|
||||||
sh 'rm -rf *'
|
sh 'rm -rf *'
|
||||||
end
|
end
|
||||||
|
|
||||||
sh 'hugo -e staging -v'
|
|
||||||
end
|
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'
|
require 'find'
|
||||||
|
|
||||||
desc 'Deploy the hugo contents to the server'
|
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'
|
sh 'find public -type f -name "*.gz" -delete'
|
||||||
|
|
||||||
Find.find("#{Dir::pwd}/public") do |f|
|
Find.find("#{Dir::pwd}/public") do |f|
|
||||||
if f =~ /\.(css|js|png|jpg|JPG|PNG|CSS|JS)$/ && FileTest.file?(f)
|
if f =~ /\.(css|js|png|jpg|JPG|PNG|CSS|JS)$/ && FileTest.file?(f)
|
||||||
sh "gzip -c #{f} > #{f}.gz"
|
sh "gzip -c #{f} > #{f}.gz"
|
||||||
|
sh "rm #{f}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue