diff --git a/lib/flowerbox/delivery/server.rb b/lib/flowerbox/delivery/server.rb index 7e921a1..8e696a2 100644 --- a/lib/flowerbox/delivery/server.rb +++ b/lib/flowerbox/delivery/server.rb @@ -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 diff --git a/lib/flowerbox/delivery/sprockets_handler.rb b/lib/flowerbox/delivery/sprockets_handler.rb index 5dcd53f..41a6255 100644 --- a/lib/flowerbox/delivery/sprockets_handler.rb +++ b/lib/flowerbox/delivery/sprockets_handler.rb @@ -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 diff --git a/lib/flowerbox/delivery/unique_asset_list.rb b/lib/flowerbox/delivery/unique_asset_list.rb index b16049f..5adc032 100644 --- a/lib/flowerbox/delivery/unique_asset_list.rb +++ b/lib/flowerbox/delivery/unique_asset_list.rb @@ -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