a few tweaks

This commit is contained in:
John Bintz 2012-02-29 14:24:07 -05:00
parent 2dc1e03aff
commit 91ad5de7d1
2 changed files with 16 additions and 4 deletions

View File

@ -13,14 +13,20 @@ module Flowerbox
def start
@server_thread = Thread.new do
Rack::Handler::WEBrick.run(lambda { |env| [ 200, {}, [] ] }, :Port => port, :Host => interface) { |server|
::Rack::Handler::WEBrick.run(options[:app], :Port => port, :Host => interface) do |server|
trap('QUIT') { server.stop }
Thread.current[:server] = server
}
end
end
while !@server_thread[:server]
while !@server_thread[:server] && @server_thread.alive?
$stderr.puts "waiting"
sleep 0.1
end
raise StandardError.new("Server died") if !@server_thread.alive?
end
def stop

View File

@ -1,10 +1,15 @@
require 'sprockets'
require 'sprockets/engines'
require 'forwardable'
module Flowerbox::Delivery
class SprocketsHandler
extend Forwardable
attr_reader :files, :options
def_delegators :environment, :append_path
def initialize(options)
@options = options
@ -29,8 +34,8 @@ module Flowerbox::Delivery
@environment.register_engine('.css', Flowerbox::Delivery::Tilt::CSSTemplate)
@environment.register_engine('.jst', Flowerbox::Delivery::Tilt::JSTTemplate)
options[:asset_paths].each { |path| append_path(path) }
options[:asset_paths].each { |path| @environment.append_path(path) }
@environment
end
@ -43,3 +48,4 @@ module Flowerbox::Delivery
end
end
end