From a118ec13bc7059c942b758c248d262b20a9fa989 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 585244a49f6..4f11680f548 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")