From 27440ec5611978e5387feb9e974cac4791e68b4b Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 23 Nov 2020 12:59:45 +1100 Subject: [PATCH] FIX: stop including GlobalPath in default context (#11323) We do not want these method names to clash, instead encapsulate the helpers so we do not add methods to Kernel Correct a but exposed by Ruby 2.7 --- lib/tasks/assets.rake | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake index 87a32da0c5c..250049ae17b 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake @@ -36,11 +36,6 @@ task 'assets:precompile:before' do require 'sprockets' require 'digest/sha1' - - # Needed for proper source maps with a CDN - load "#{Rails.root}/lib/global_path.rb" - include GlobalPath - end task 'assets:precompile:css' => 'environment' do @@ -80,6 +75,20 @@ def assets_path "#{Rails.root}/public/assets" end +def global_path_klass + @global_path_klass ||= Class.new do + extend GlobalPath + end +end + +def cdn_path(p) + global_path_klass.cdn_relative_path(p) +end + +def cdn_relative_path(p) + global_path_klass.cdn_relative_path(p) +end + def compress_node(from, to) to_path = "#{assets_path}/#{to}" assets = cdn_relative_path("/assets")