mirror of
https://github.com/Shopify/liquid.git
synced 2026-09-15 08:50:45 -07:00
Don't automatically load hooks
This commit is contained in:
@@ -41,10 +41,6 @@ module Liquid
|
||||
|
||||
singleton_class.send(:attr_accessor, :cache_classes)
|
||||
self.cache_classes = true
|
||||
|
||||
def self.load_profiler_hooks
|
||||
require 'liquid/profiler/hooks'
|
||||
end
|
||||
end
|
||||
|
||||
require "liquid/version"
|
||||
|
||||
@@ -71,7 +71,13 @@ module Liquid
|
||||
end
|
||||
|
||||
def self.hooks_loaded
|
||||
false
|
||||
@hooks_loaded
|
||||
end
|
||||
|
||||
def self.load_hooks
|
||||
return if @hooks_loaded
|
||||
require 'liquid/profiler/hooks'
|
||||
@hooks_loaded = true
|
||||
end
|
||||
|
||||
def self.profile_token_render(token)
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
module Liquid
|
||||
class Profiler
|
||||
def self.hooks_loaded
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
class BlockBody
|
||||
def render_token_with_profiling(token, context)
|
||||
Profiler.profile_token_render(token) do
|
||||
|
||||
@@ -250,7 +250,7 @@ module Liquid
|
||||
|
||||
def with_profiling
|
||||
if @profiling && !@options[:included]
|
||||
Liquid.load_profiler_hooks unless Profiler.hooks_loaded
|
||||
raise "Profiler hooks not loaded, call Liquid::Profiler.load_hooks first" unless Profiler.hooks_loaded
|
||||
|
||||
@profiler = Profiler.new
|
||||
@profiler.start
|
||||
|
||||
@@ -12,6 +12,7 @@ if env_mode = ENV['LIQUID_PARSER_MODE']
|
||||
mode = env_mode.to_sym
|
||||
end
|
||||
Liquid::Template.error_mode = mode
|
||||
Liquid::Profiler.load_hooks
|
||||
|
||||
if Minitest.const_defined?('Test')
|
||||
# We're on Minitest 5+. Nothing to do here.
|
||||
|
||||
Reference in New Issue
Block a user