Sha256: baede64fd27c5ab4c4cc6124276c1e7193c948df3736324a874348954549e57c

Contents?: true

Size: 706 Bytes

Versions: 7

Compression:

Stored size: 706 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.fetch(: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

7 entries across 7 versions & 1 rubygems

Version Path
nutcracker-web-0.0.24 lib/nutcracker/web.rb
nutcracker-web-0.0.23 lib/nutcracker/web.rb
nutcracker-web-0.0.22 lib/nutcracker/web.rb
nutcracker-web-0.0.20 lib/nutcracker/web.rb
nutcracker-web-0.0.19 lib/nutcracker/web.rb
nutcracker-web-0.0.17 lib/nutcracker/web.rb
nutcracker-web-0.0.16 lib/nutcracker/web.rb