sprockets updates

This commit is contained in:
John Bintz 2012-03-14 17:41:02 -04:00
parent 95fb0e9702
commit 3d95dc9588
3 changed files with 12 additions and 9 deletions

View File

@ -2,6 +2,7 @@ require 'rack'
require 'net/http' require 'net/http'
require 'socket' require 'socket'
require 'rack/builder' require 'rack/builder'
require 'thin'
module Flowerbox module Flowerbox
module Delivery module Delivery
@ -18,6 +19,8 @@ module Flowerbox
app = options[:app] app = options[:app]
Thin::Logging.silent = !options[:logging]
if options[:logging] if options[:logging]
real_app = app real_app = app
app = ::Rack::Builder.new do app = ::Rack::Builder.new do

View File

@ -11,6 +11,10 @@ module Flowerbox::Delivery
def_delegators :environment, :append_path, :register_engine, :[] def_delegators :environment, :append_path, :register_engine, :[]
def self.gem_asset_paths
@gem_asset_paths ||= Sprockets.find_gem_vendor_paths
end
def initialize(options) def initialize(options)
@options = options @options = options
@ -32,14 +36,10 @@ module Flowerbox::Delivery
def environment def environment
return @environment if @environment return @environment if @environment
@environment = Sprockets::EnvironmentWithVendoredGems.new @environment = Sprockets::Environment.new
@environment.unregister_postprocessor('application/javascript', Sprockets::SafetyColons) @environment.cache = Sprockets::Cache::FileStore.new(".tmp")
#@environment.register_postprocessor('application/javascript', Flowerbox::Delivery::Tilt::EnsureSavedFile)
@environment.unregister_bundle_processor('text/css', Sprockets::CharsetNormalizer)
#@environment.register_engine('.js', Flowerbox::Delivery::Tilt::JSTemplate)
#@environment.register_engine('.css', Flowerbox::Delivery::Tilt::CSSTemplate)
#@environment.register_engine('.jst', Flowerbox::Delivery::Tilt::JSTTemplate)
self.class.gem_asset_paths.each { |path| append_path(path) }
options[:asset_paths].each { |path| append_path(path) } options[:asset_paths].each { |path| append_path(path) }
@environment @environment

View File

@ -5,12 +5,12 @@ module Flowerbox::Delivery
end end
def to_json def to_json
collect(&:logical_path) collect { |asset| asset.pathname.to_s }
end end
private private
def include?(file) def include?(file)
any? { |other_file| other_file == file } any? { |other_file| other_file.pathname.to_s == file.pathname.to_s }
end end
end end
end end