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

View File

@ -11,6 +11,10 @@ module Flowerbox::Delivery
def_delegators :environment, :append_path, :register_engine, :[]
def self.gem_asset_paths
@gem_asset_paths ||= Sprockets.find_gem_vendor_paths
end
def initialize(options)
@options = options
@ -32,14 +36,10 @@ module Flowerbox::Delivery
def environment
return @environment if @environment
@environment = Sprockets::EnvironmentWithVendoredGems.new
@environment.unregister_postprocessor('application/javascript', Sprockets::SafetyColons)
#@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)
@environment = Sprockets::Environment.new
@environment.cache = Sprockets::Cache::FileStore.new(".tmp")
self.class.gem_asset_paths.each { |path| append_path(path) }
options[:asset_paths].each { |path| append_path(path) }
@environment

View File

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