From 1aac97ea1ffefce3bd0416ea8de3be4425d21d16 Mon Sep 17 00:00:00 2001 From: Ian Yang Date: Fri, 23 Mar 2012 22:52:54 +0800 Subject: [PATCH] do not populate the global Sprockets environment --- lib/jasmine/headless/files_list.rb | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/lib/jasmine/headless/files_list.rb b/lib/jasmine/headless/files_list.rb index 28a9d68..6a6589c 100644 --- a/lib/jasmine/headless/files_list.rb +++ b/lib/jasmine/headless/files_list.rb @@ -36,18 +36,7 @@ module Jasmine::Headless end end - # ...and unregister ones we don't want/need - Sprockets.instance_eval do - EXCLUDED_FORMATS.each do |extension| - register_engine ".#{extension}", Jasmine::Headless::NilTemplate - end - - register_engine '.coffee', Jasmine::Headless::CoffeeTemplate - register_engine '.js', Jasmine::Headless::JSTemplate - register_engine '.css', Jasmine::Headless::CSSTemplate - register_engine '.jst', Jasmine::Headless::JSTTemplate - end - + @sprockets_environment = nil end def registered_engines @@ -153,6 +142,19 @@ module Jasmine::Headless search_paths.each { |path| @sprockets_environment.append_path(path) } @sprockets_environment.unregister_postprocessor('application/javascript', Sprockets::SafetyColons) + + # ...and unregister ones we don't want/need + @sprockets_environment.instance_eval do + EXCLUDED_FORMATS.each do |extension| + register_engine ".#{extension}", Jasmine::Headless::NilTemplate + end + + register_engine '.coffee', Jasmine::Headless::CoffeeTemplate + register_engine '.js', Jasmine::Headless::JSTemplate + register_engine '.css', Jasmine::Headless::CSSTemplate + register_engine '.jst', Jasmine::Headless::JSTTemplate + end + @sprockets_environment end -- 2.45.2