Modify & create `rake` tasks.
This commit is contained in:
parent
f3e5cd5587
commit
33247773f4
|
@ -0,0 +1,15 @@
|
||||||
|
#!/usr/bin/env rake
|
||||||
|
|
||||||
|
URL = 'https://github.com/yuru7/HackGen/releases/download/v2.3.0/HackGenNerd_v2.3.0.zip'
|
||||||
|
TMP_FILE = '/tmp/font.zip'
|
||||||
|
TMP_DIR = '/tmp/font'
|
||||||
|
TARGET = 'assets/font/'
|
||||||
|
|
||||||
|
desc 'Download the necessary assets.'
|
||||||
|
task :init do
|
||||||
|
unless File.exist?('assets/font/HackGen35Nerd-Bold.ttf')
|
||||||
|
sh "wget #{URL} -O #{TMP_FILE}"
|
||||||
|
sh "rm -rf #{TMP_DIR} && unzip #{TMP_FILE} -d #{TMP_DIR}"
|
||||||
|
sh "find #{TMP_DIR} -type f -name *.ttf | xargs -I% -n 1 cp -p % #{TARGET}"
|
||||||
|
end
|
||||||
|
end
|
|
@ -3,7 +3,7 @@
|
||||||
require 'find'
|
require 'find'
|
||||||
|
|
||||||
desc 'Deploy the hugo contents to the server'
|
desc 'Deploy the hugo contents to the server'
|
||||||
task :prod => [:prep] do
|
task :prod => [:init, :prep, :tcard] do
|
||||||
sh 'hugo -v --minify'
|
sh 'hugo -v --minify'
|
||||||
|
|
||||||
sh 'find public -type f -name "*.gz" -delete'
|
sh 'find public -type f -name "*.gz" -delete'
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
require 'find'
|
require 'find'
|
||||||
|
|
||||||
desc 'Deploy the hugo contents to the server'
|
desc 'Deploy the hugo contents to the server'
|
||||||
task :stag => [:prep] do
|
task :stag => [:init, :prep, :tcard] do
|
||||||
sh 'hugo -e staging -v --minify'
|
sh 'hugo -e staging -v --minify'
|
||||||
|
|
||||||
sh 'find public -type f -name "*.gz" -delete'
|
sh 'find public -type f -name "*.gz" -delete'
|
||||||
|
|
|
@ -24,4 +24,6 @@ task :tcard do
|
||||||
|
|
||||||
sh "img2webp -lossy -q 50 #{src} -o #{dest}"
|
sh "img2webp -lossy -q 50 #{src} -o #{dest}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sh "find #{OGP_DIR} -type f -name '*.png' | xargs -t --no-run-if-empty rm"
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue