1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/discourse_ynh.git synced 2024-09-03 18:26:18 +02:00

Remove support for <1.0 versions of brotli

This commit is contained in:
Félix Piédallu 2024-08-30 11:44:58 +02:00
parent 74f05908e4
commit bd1620cd9e

View file

@ -1,29 +0,0 @@
diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake
index 7b47f21658..ea6d0da2c4 100644
--- a/lib/tasks/assets.rake
+++ b/lib/tasks/assets.rake
@@ -116,9 +116,21 @@ def gzip(path)
end
# different brotli versions use different parameters
-def brotli_command(path, max_compress)
- compression_quality = max_compress ? "11" : "6"
- "brotli -f --quality=#{compression_quality} #{path} --output=#{path}.br"
+ver_out, _ver_err, ver_status = Open3.capture3('brotli --version')
+if !ver_status.success?
+ # old versions of brotli don't respond to --version
+ def brotli_command(path, max_compress)
+ compression_quality = max_compress ? "11" : "6"
+ "brotli --quality 11 --input #{path} --output #{path}.br"
+ end
+elsif ver_out >= "brotli 1.0.0"
+ def brotli_command(path, max_compress)
+ compression_quality = max_compress ? "11" : "6"
+ "brotli -f --quality=11 #{path} --output=#{path}.br"
+ end
+else
+ # not sure what to do here, not expecting this
+ raise "cannot determine brotli version"
end
def brotli(path, max_compress)