try loading bundler too

This commit is contained in:
John Bintz 2011-12-24 09:53:52 -05:00
parent 4e64480c69
commit ac9a9cf23b

View File

@ -39,14 +39,26 @@ module Jasmine::Headless
def reset!
@asset_paths = nil
# register haml-sprockets if it's available...
%w{haml-sprockets}.each do |library|
# register haml-sprockets and handlebars_assets if it's available...
%w{haml-sprockets handlebars_assets}.each do |library|
begin
require library
rescue LoadError
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
Sprockets.instance_eval do
EXCLUDED_FORMATS.each do |extension|
@ -173,12 +185,16 @@ module Jasmine::Headless
def to_html(files)
alert_time = Time.now + PLEASE_WAIT_IM_WORKING_TIME
p self.class.extension_filter
files.collect do |file|
if alert_time && alert_time < Time.now
puts "Rebuilding cache, please wait..."
alert_time = nil
end
p file
sprockets_environment.find_asset(file, :bundle => false).body
end.compact.reject(&:empty?)
end