public
Created — forked from jejacks0n/gist:990160

Adding sprockets to evergreen for rails 3.1 and coffeescript (via /config/evergreen.rb)

  • Download Gist
gistfile1.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
# For Rails 3.1 asset packaging / sprockets support
# 1. Create a /config/evergreen.rb file and put these contents in it
# 2. Adjust the paths below (the provided ones are generic)
require ::File.expand_path('../application', __FILE__)
 
module Evergreen
 
class << self
def application_with_additions(suite)
app = application_without_additions(suite)
 
app.map "/assets" do
assets = Rails.application.config.assets
paths = %W{app/assets/javascripts lib/assets/javascripts vendor/assets/javascripts}.map{ |p| File.join(suite.root, p) }
if assets.enabled
require 'sprockets'
sprockets = Sprockets::Environment.new(suite.root)
sprockets.static_root = File.join(suite.root, 'public', assets.prefix)
sprockets.paths.concat paths
sprockets.js_compressor = nil # is compression useful in specs?
run sprockets
end
end
app
end
 
alias_method :application_without_additions, :application
alias_method :application, :application_with_additions
end
 
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.