Sha256: 3d19a383973f5cdd8b20be3d06c008b804eb98dc896ea10e823308cf0e204f90

Contents?: true

Size: 705 Bytes

Versions: 2

Compression:

Stored size: 705 Bytes

Contents

require "rack"

module Nutcracker
  module Web
    def self.start(nutcracker, o = {})
      @thread = Thread.new do
        Thread.current.abort_on_exception=true

        app = Rack::URLMap.new(o[:context] => 
          App.new(nutcracker, o.fetch(:external_servers,[])))

        Rack::Server.start(
          {
            :app => app,
            :environment => 'production',
            :pid => nil,
            :Port => 9292,
            :Host => '0.0.0.0',
            :AccessLog => []
          }.merge(o)
        )
      end
      self
    end
    
    def self.join
      @thread.join
    end
    
    def self.stop
      @thread.kill
    end

    autoload :App, 'nutcracker/web/app'
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nutcracker-web-0.0.13 lib/nutcracker/web.rb
nutcracker-web-0.0.12 lib/nutcracker/web.rb