about summary refs log tree commit diff
path: root/lib/tasks
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-06-21 08:28:59 +0200
committerClaire <claire.github-309c@sitedethib.com>2022-06-21 08:28:59 +0200
commit0e74d4da592d6ac5e3c52b0f9c6b1906376aa707 (patch)
tree66ae31bd3fd0228ebc6f92325cf43c7f02e4263d /lib/tasks
parent7a75bce1b43df290baf6842e2bb3d3eb0acd76d5 (diff)
parent27f41768e8d66d97c8d705d764e534e52ea13af9 (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `.github/dependabot.yml`:
  Changed upstream, while we modified it in glitch-soc to not get spammed
  by dependabot.
  Kept it removed.
- `README.md`:
  Changed upstream, which has a very different version.
  Discarded upstream changes.
Diffstat (limited to 'lib/tasks')
-rw-r--r--lib/tasks/branding.rake21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/tasks/branding.rake b/lib/tasks/branding.rake
index d513465ed..2eec7c9e1 100644
--- a/lib/tasks/branding.rake
+++ b/lib/tasks/branding.rake
@@ -9,28 +9,28 @@ namespace :branding do
 
   desc 'Generate PNG icons and logos for e-mail templates'
   task generate_mailer_assets: :environment do
-    rsvg_convert = Terrapin::CommandLine.new('rsvg-convert', '-w :w -h :h :input -o :output')
+    rsvg_convert = Terrapin::CommandLine.new('rsvg-convert', '-h :size --keep-aspect-ratio :input -o :output')
     output_dest  = Rails.root.join('app', 'javascript', 'images', 'mailer')
 
     # Displayed size is 64px, at 3x it's 192px
     Dir[Rails.root.join('app', 'javascript', 'images', 'icons', '*.svg')].each do |path|
-      rsvg_convert.run(input: path, w: 192, h: 192, output: output_dest.join("#{File.basename(path, '.svg')}.png"))
+      rsvg_convert.run(input: path, size: 192, output: output_dest.join("#{File.basename(path, '.svg')}.png"))
     end
 
     # Displayed size is 34px, at 3x it's 102px
-    rsvg_convert.run(input: Rails.root.join('app', 'javascript', 'images', 'logo-symbol-wordmark.svg'), w: (102 * (261.0 / 66)).ceil, h: 102, output: output_dest.join('wordmark.png'))
+    rsvg_convert.run(input: Rails.root.join('app', 'javascript', 'images', 'logo-symbol-wordmark.svg'), size: 102, output: output_dest.join('wordmark.png'))
 
     # Displayed size is 24px, at 3x it's 72px
-    rsvg_convert.run(input: Rails.root.join('app', 'javascript', 'images', 'logo-symbol-icon.svg'), w: (72 * (79.0 / 75)).ceil, h: 72, output: output_dest.join('logo.png'))
+    rsvg_convert.run(input: Rails.root.join('app', 'javascript', 'images', 'logo-symbol-icon.svg'), size: 72, output: output_dest.join('logo.png'))
   end
 
   desc 'Generate light/dark logotypes for GitHub'
   task generate_github_assets: :environment do
-    rsvg_convert = Terrapin::CommandLine.new('rsvg-convert', '--stylesheet :stylesheet -w :w -h :h :input -o :output')
+    rsvg_convert = Terrapin::CommandLine.new('rsvg-convert', '--stylesheet :stylesheet -h :size --keep-aspect-ratio :input -o :output')
     output_dest  = Rails.root.join('lib', 'assets')
 
-    rsvg_convert.run(stylesheet: Rails.root.join('lib', 'assets', 'wordmark.dark.css'), input: Rails.root.join('app', 'javascript', 'images', 'logo-symbol-wordmark.svg'), w: (102 * (261.0 / 66)).ceil, h: 102, output: output_dest.join('wordmark.dark.png'))
-    rsvg_convert.run(stylesheet: Rails.root.join('lib', 'assets', 'wordmark.light.css'), input: Rails.root.join('app', 'javascript', 'images', 'logo-symbol-wordmark.svg'), w: (102 * (261.0 / 66)).ceil, h: 102, output: output_dest.join('wordmark.light.png'))
+    rsvg_convert.run(stylesheet: Rails.root.join('lib', 'assets', 'wordmark.dark.css'), input: Rails.root.join('app', 'javascript', 'images', 'logo-symbol-wordmark.svg'), size: 102, output: output_dest.join('wordmark.dark.png'))
+    rsvg_convert.run(stylesheet: Rails.root.join('lib', 'assets', 'wordmark.light.css'), input: Rails.root.join('app', 'javascript', 'images', 'logo-symbol-wordmark.svg'), size: 102, output: output_dest.join('wordmark.light.png'))
   end
 
   desc 'Generate favicons and app icons from SVG source files'
@@ -39,7 +39,7 @@ namespace :branding do
     app_icon_source = Rails.root.join('app', 'javascript', 'images', 'app-icon.svg')
     output_dest     = Rails.root.join('app', 'javascript', 'icons')
 
-    rsvg_convert = Terrapin::CommandLine.new('rsvg-convert', '-w :size -h :size :input -o :output')
+    rsvg_convert = Terrapin::CommandLine.new('rsvg-convert', '-w :size -h :size --keep-aspect-ratio :input -o :output')
     convert = Terrapin::CommandLine.new('convert', ':input :output')
 
     favicon_sizes      = [16, 32, 48]
@@ -67,12 +67,11 @@ namespace :branding do
 
   desc 'Generate badge icon from SVG source files'
   task generate_app_badge: :environment do
-    rsvg_convert = Terrapin::CommandLine.new('rsvg-convert', '--stylesheet :stylesheet -w :w -h :h :input -o :output')
+    rsvg_convert = Terrapin::CommandLine.new('rsvg-convert', '--stylesheet :stylesheet -w :size -h :size --keep-aspect-ratio :input -o :output')
     badge_source = Rails.root.join('app', 'javascript', 'images', 'logo-symbol-icon.svg')
-    source_ratio = 79.0 / 75
     output_dest  = Rails.root.join('public')
     stylesheet   = Rails.root.join('lib', 'assets', 'wordmark.light.css')
 
-    rsvg_convert.run(stylesheet: stylesheet, input: badge_source, w: (192 * source_ratio).ceil, h: 192, output: output_dest.join('badge.png'))
+    rsvg_convert.run(stylesheet: stylesheet, input: badge_source, size: 192, output: output_dest.join('badge.png'))
   end
 end