about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2023-02-09 12:46:12 +0100
committerClaire <claire.github-309c@sitedethib.com>2023-02-09 12:46:12 +0100
commit85558a5e18a58247606954050a5866e62c877f91 (patch)
tree982808241c0f64c20f8eec9b1ce5651b3c5195da /lib
parent76b4e7727b7497c1b68e06133831701f8950ae19 (diff)
parentc5a4d8c82ddd5265abc830959a58cdaf1f061a43 (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `README.md`:
  Minor upstream change, our README is completely different.
  Kept ours.
- `lib/tasks/assets.rake`:
  glitch-soc has extra code to deal with its theming system,
  upstream changed a line that exists in glitch-soc.
  Applied upstream changes.
Diffstat (limited to 'lib')
-rw-r--r--lib/active_record/database_tasks_extensions.rb2
-rw-r--r--lib/mastodon/premailer_webpack_strategy.rb2
-rw-r--r--lib/mastodon/statuses_cli.rb4
-rw-r--r--lib/rails/engine_extensions.rb2
-rw-r--r--lib/tasks/assets.rake2
-rw-r--r--lib/tasks/branding.rake4
-rw-r--r--lib/tasks/emojis.rake6
-rw-r--r--lib/tasks/mastodon.rake12
8 files changed, 17 insertions, 17 deletions
diff --git a/lib/active_record/database_tasks_extensions.rb b/lib/active_record/database_tasks_extensions.rb
index e274f476d..d52186113 100644
--- a/lib/active_record/database_tasks_extensions.rb
+++ b/lib/active_record/database_tasks_extensions.rb
@@ -11,7 +11,7 @@ module ActiveRecord
         ActiveRecord::Base.establish_connection(db_config)
         Mastodon::Snowflake.define_timestamp_id
 
-        original_load_schema.bind(self).call(db_config, *args)
+        original_load_schema.bind_call(self, db_config, *args)
 
         Mastodon::Snowflake.ensure_id_sequences_exist
       end
diff --git a/lib/mastodon/premailer_webpack_strategy.rb b/lib/mastodon/premailer_webpack_strategy.rb
index 56ef09c1a..4356b7285 100644
--- a/lib/mastodon/premailer_webpack_strategy.rb
+++ b/lib/mastodon/premailer_webpack_strategy.rb
@@ -13,7 +13,7 @@ module PremailerWebpackStrategy
             HTTP.get(url).to_s
           else
             url = url[1..-1] if url.start_with?('/')
-            File.read(Rails.root.join('public', url))
+            File.read(Rails.public_path.join(url))
           end
 
     css.gsub(/url\(\//, "url(#{asset_host}/")
diff --git a/lib/mastodon/statuses_cli.rb b/lib/mastodon/statuses_cli.rb
index d4c2e6cf2..baab83e29 100644
--- a/lib/mastodon/statuses_cli.rb
+++ b/lib/mastodon/statuses_cli.rb
@@ -93,7 +93,7 @@ module Mastodon
         c.table_name = 'statuses_to_be_deleted'
       end
 
-      Object.const_set('StatusToBeDeleted', klass)
+      Object.const_set(:StatusToBeDeleted, klass)
 
       scope     = StatusToBeDeleted
       processed = 0
@@ -175,7 +175,7 @@ module Mastodon
         c.table_name = 'conversations_to_be_deleted'
       end
 
-      Object.const_set('ConversationsToBeDeleted', klass)
+      Object.const_set(:ConversationsToBeDeleted, klass)
 
       scope     = ConversationsToBeDeleted
       processed = 0
diff --git a/lib/rails/engine_extensions.rb b/lib/rails/engine_extensions.rb
index 4848b15f2..4e3767db9 100644
--- a/lib/rails/engine_extensions.rb
+++ b/lib/rails/engine_extensions.rb
@@ -2,7 +2,7 @@ module Rails
   module EngineExtensions
     # Rewrite task loading code to filter digitalocean.rake task
     def run_tasks_blocks(app)
-      Railtie.instance_method(:run_tasks_blocks).bind(self).call(app)
+      Railtie.instance_method(:run_tasks_blocks).bind_call(self, app)
       paths["lib/tasks"].existent.reject { |ext| ext.end_with?('digitalocean.rake') }.sort.each { |ext| load(ext) }
     end
   end
diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake
index 5931aae61..e1102af33 100644
--- a/lib/tasks/assets.rake
+++ b/lib/tasks/assets.rake
@@ -14,7 +14,7 @@ namespace :assets do
       File.write(dest, html)
     end
 
-    render_static_page 'errors/500', layout: 'error', dest: Rails.root.join('public', 'assets', '500.html')
+    render_static_page 'errors/500', layout: 'error', dest: Rails.public_path.join('assets', '500.html')
   end
 end
 
diff --git a/lib/tasks/branding.rake b/lib/tasks/branding.rake
index 2eec7c9e1..d1c1c9ded 100644
--- a/lib/tasks/branding.rake
+++ b/lib/tasks/branding.rake
@@ -54,7 +54,7 @@ namespace :branding do
       rsvg_convert.run(size: size, input: favicon_source, output: output_path)
     end
 
-    convert.run(input: favicons, output: Rails.root.join('public', 'favicon.ico'))
+    convert.run(input: favicons, output: Rails.public_path.join('favicon.ico'))
 
     apple_icon_sizes.each do |size|
       rsvg_convert.run(size: size, input: app_icon_source, output: output_dest.join("apple-touch-icon-#{size}x#{size}.png"))
@@ -69,7 +69,7 @@ namespace :branding do
   task generate_app_badge: :environment do
     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')
-    output_dest  = Rails.root.join('public')
+    output_dest  = Rails.public_path
     stylesheet   = Rails.root.join('lib', 'assets', 'wordmark.light.css')
 
     rsvg_convert.run(stylesheet: stylesheet, input: badge_source, size: 192, output: output_dest.join('badge.png'))
diff --git a/lib/tasks/emojis.rake b/lib/tasks/emojis.rake
index 473aee9cc..02d772b48 100644
--- a/lib/tasks/emojis.rake
+++ b/lib/tasks/emojis.rake
@@ -1,8 +1,8 @@
 # frozen_string_literal: true
 
 def gen_border(codepoint, color)
-  input = Rails.root.join('public', 'emoji', "#{codepoint}.svg")
-  dest = Rails.root.join('public', 'emoji', "#{codepoint}_border.svg")
+  input = Rails.public_path.join('emoji', "#{codepoint}.svg")
+  dest = Rails.public_path.join('emoji', "#{codepoint}_border.svg")
   doc = File.open(input) { |f| Nokogiri::XML(f) }
   svg = doc.at_css('svg')
   if svg.key?('viewBox')
@@ -69,7 +69,7 @@ namespace :emojis do
       end
     end
 
-    existence_maps = grouped_codes.map { |c| c.index_with { |cc| File.exist?(Rails.root.join('public', 'emoji', "#{codepoints_to_filename(cc)}.svg")) } }
+    existence_maps = grouped_codes.map { |c| c.index_with { |cc| File.exist?(Rails.public_path.join('emoji', "#{codepoints_to_filename(cc)}.svg")) } }
     map = {}
 
     existence_maps.each do |group|
diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake
index 876383d7f..1184e5273 100644
--- a/lib/tasks/mastodon.rake
+++ b/lib/tasks/mastodon.rake
@@ -463,10 +463,10 @@ namespace :mastodon do
           prompt.say 'Running `RAILS_ENV=production rails db:setup` ...'
           prompt.say "\n\n"
 
-          if !system(env.transform_values(&:to_s).merge({ 'RAILS_ENV' => 'production', 'SAFETY_ASSURED' => '1' }), 'rails db:setup')
-            prompt.error 'That failed! Perhaps your configuration is not right'
-          else
+          if system(env.transform_values(&:to_s).merge({ 'RAILS_ENV' => 'production', 'SAFETY_ASSURED' => '1' }), 'rails db:setup')
             prompt.ok 'Done!'
+          else
+            prompt.error 'That failed! Perhaps your configuration is not right'
           end
         end
 
@@ -479,10 +479,10 @@ namespace :mastodon do
             prompt.say 'Running `RAILS_ENV=production rails assets:precompile` ...'
             prompt.say "\n\n"
 
-            if !system(env.transform_values(&:to_s).merge({ 'RAILS_ENV' => 'production' }), 'rails assets:precompile')
-              prompt.error 'That failed! Maybe you need swap space?'
-            else
+            if system(env.transform_values(&:to_s).merge({ 'RAILS_ENV' => 'production' }), 'rails assets:precompile')
               prompt.say 'Done!'
+            else
+              prompt.error 'That failed! Maybe you need swap space?'
             end
           end
         end