mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 09:23:39 +08:00
30990006a9
This reduces chances of errors where consumers of strings mutate inputs and reduces memory usage of the app. Test suite passes now, but there may be some stuff left, so we will run a few sites on a branch prior to merging
41 lines
762 B
Ruby
41 lines
762 B
Ruby
# frozen_string_literal: true
|
|
|
|
def vendor_svgs
|
|
"#{Rails.root}/vendor/assets/svg-icons"
|
|
end
|
|
|
|
def library_src
|
|
"#{Rails.root}/node_modules"
|
|
end
|
|
|
|
task 'svgicons:update' do
|
|
|
|
yarn = system("yarn install")
|
|
abort('Unable to run "yarn install"') unless yarn
|
|
|
|
dependencies = [
|
|
{
|
|
source: '@fortawesome/fontawesome-free/sprites',
|
|
destination: 'fontawesome',
|
|
}
|
|
]
|
|
|
|
start = Time.now
|
|
|
|
dependencies.each do |f|
|
|
src = "#{library_src}/#{f[:source]}/."
|
|
|
|
unless f[:destination]
|
|
filename = f[:source].split("/").last
|
|
else
|
|
filename = f[:destination]
|
|
end
|
|
|
|
dest = "#{vendor_svgs}/#{filename}"
|
|
|
|
FileUtils.cp_r(src, dest)
|
|
end
|
|
|
|
STDERR.puts "Completed copying dependencies: #{(Time.now - start).round(2)} secs"
|
|
end
|