try loading bundler too

This commit is contained in:
John Bintz 2011-12-24 09:53:52 -05:00
parent 5743227de6
commit e38963ed42

View File

@ -39,14 +39,26 @@ module Jasmine::Headless
def reset! def reset!
@asset_paths = nil @asset_paths = nil
# register haml-sprockets if it's available... # register haml-sprockets and handlebars_assets if it's available...
%w{haml-sprockets}.each do |library| %w{haml-sprockets handlebars_assets}.each do |library|
begin begin
require library require library
rescue LoadError rescue LoadError
end end
end end
begin
require 'bundler'
envs = [ :default ]
%w{JHW_ENV RAILS_ENV RACK_ENV RAILS_GROUPS}.each do |env|
envs << ENV[env].to_sym if ENV[env]
end
Bundler.require(*envs)
rescue LoadError
end
# ...and unregister ones we don't want/need # ...and unregister ones we don't want/need
Sprockets.instance_eval do Sprockets.instance_eval do
EXCLUDED_FORMATS.each do |extension| EXCLUDED_FORMATS.each do |extension|
@ -175,12 +187,16 @@ module Jasmine::Headless
def to_html(files) def to_html(files)
alert_time = Time.now + PLEASE_WAIT_IM_WORKING_TIME alert_time = Time.now + PLEASE_WAIT_IM_WORKING_TIME
p self.class.extension_filter
files.collect do |file| files.collect do |file|
if alert_time && alert_time < Time.now if alert_time && alert_time < Time.now
puts "Rebuilding cache, please wait..." puts "Rebuilding cache, please wait..."
alert_time = nil alert_time = nil
end end
p file
sprockets_environment.find_asset(file, :bundle => false).body sprockets_environment.find_asset(file, :bundle => false).body
end.compact.reject(&:empty?) end.compact.reject(&:empty?)
end end