assets rake task: gzip and brotli exit codes exist for a reason - to be checked

This commit is contained in:
Michael Brown 2017-11-24 09:52:08 -05:00
parent f2c7f39066
commit 3c60702663
1 changed files with 5 additions and 2 deletions

View File

@ -109,15 +109,18 @@ def compress_ruby(from, to)
end
def gzip(path)
STDERR.puts "gzip #{path}"
STDERR.puts "gzip -f -c -9 #{path} > #{path}.gz"
STDERR.puts `gzip -f -c -9 #{path} > #{path}.gz`
raise "gzip compression failed: exit code #{$?.exitstatus}" if $?.exitstatus != 0
end
def brotli(path)
if ENV['COMPRESS_BROTLI']&.to_i == 1
STDERR.puts "brotli #{path}"
STDERR.puts "brotli --quality 11 --input #{path} --output #{path}.br"
STDERR.puts `brotli --quality 11 --input #{path} --output #{path}.br`
raise "brotli compression failed: exit code #{$?.exitstatus}" if $?.exitstatus != 0
STDERR.puts `chmod +r #{path}.br`
raise "chmod failed: exit code #{$?.exitstatus}" if $?.exitstatus != 0
end
end