mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-23 21:15:05 +01:00
Apply Rubocop Rails/RootPublicPath (#23447)
This commit is contained in:
parent
0d1f192c54
commit
11557d1c5a
@ -13,7 +13,7 @@ module PremailerWebpackStrategy
|
|||||||
HTTP.get(url).to_s
|
HTTP.get(url).to_s
|
||||||
else
|
else
|
||||||
url = url[1..-1] if url.start_with?('/')
|
url = url[1..-1] if url.start_with?('/')
|
||||||
File.read(Rails.root.join('public', url))
|
File.read(Rails.public_path.join(url))
|
||||||
end
|
end
|
||||||
|
|
||||||
css.gsub(/url\(\//, "url(#{asset_host}/")
|
css.gsub(/url\(\//, "url(#{asset_host}/")
|
||||||
|
@ -8,7 +8,7 @@ end
|
|||||||
namespace :assets do
|
namespace :assets do
|
||||||
desc 'Generate static pages'
|
desc 'Generate static pages'
|
||||||
task generate_static_pages: :environment do
|
task generate_static_pages: :environment do
|
||||||
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
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ namespace :branding do
|
|||||||
rsvg_convert.run(size: size, input: favicon_source, output: output_path)
|
rsvg_convert.run(size: size, input: favicon_source, output: output_path)
|
||||||
end
|
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|
|
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"))
|
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
|
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')
|
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')
|
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')
|
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'))
|
rsvg_convert.run(stylesheet: stylesheet, input: badge_source, size: 192, output: output_dest.join('badge.png'))
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
def gen_border(codepoint, color)
|
def gen_border(codepoint, color)
|
||||||
input = Rails.root.join('public', 'emoji', "#{codepoint}.svg")
|
input = Rails.public_path.join('emoji', "#{codepoint}.svg")
|
||||||
dest = Rails.root.join('public', 'emoji', "#{codepoint}_border.svg")
|
dest = Rails.public_path.join('emoji', "#{codepoint}_border.svg")
|
||||||
doc = File.open(input) { |f| Nokogiri::XML(f) }
|
doc = File.open(input) { |f| Nokogiri::XML(f) }
|
||||||
svg = doc.at_css('svg')
|
svg = doc.at_css('svg')
|
||||||
if svg.key?('viewBox')
|
if svg.key?('viewBox')
|
||||||
@ -69,7 +69,7 @@ namespace :emojis do
|
|||||||
end
|
end
|
||||||
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 = {}
|
map = {}
|
||||||
|
|
||||||
existence_maps.each do |group|
|
existence_maps.each do |group|
|
||||||
|
Loading…
Reference in New Issue
Block a user