Sha256: 362e4954f3ec8304ef82be484182a16b8ff468b5c6ee5e29f10fdcfda0ae4c05

Contents?: true

Size: 1.01 KB

Versions: 14

Compression:

Stored size: 1.01 KB

Contents

require 'rack/handler'
require 'jubilee'
require 'java'

module Rack
  module Handler
    module Jubilee
      DEFAULT_OPTIONS = {
        :Host => '0.0.0.0',
        :Port => 3000,
        :Verbose => false
      }
      def self.run(app, options = {})
        options = DEFAULT_OPTIONS.merge(options)

        if options[:Verbose]
          app = Rack::CommonLogger.new(app, STDOUT)
        end

        if options[:environment]
          ENV["RACK_ENV"] = options[:environment].to_s
        end

        @server = ::Jubilee::Server.new(app, options)

        puts "Jubilee #{::Jubilee::Const::JUBILEE_VERSION} starting..."
        puts "* Environment: #{ENV['RACK_ENV']}"
        puts "* Listening on http://#{options[:Host]}:#{options[:Port]}"

        yield @server if block_given?

        @server.start
        @starter = org.jruby.jubilee.deploy.Starter.new
        @starter.block
      end

      def self.shutdown
        @server.stop{ @starter.unblock }
        exit
      end
    end
    register :jubilee, Jubilee
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
jubilee-1.1.3-java lib/rack/handler/jubilee.rb
jubilee-1.1.2-java lib/rack/handler/jubilee.rb
jubilee-1.1.0-java lib/rack/handler/jubilee.rb
jubilee-1.1.0.rc3 lib/rack/handler/jubilee.rb
jubilee-1.1.0.rc2 lib/rack/handler/jubilee.rb
jubilee-1.1.0.rc1 lib/rack/handler/jubilee.rb
jubilee-1.0.2 lib/rack/handler/jubilee.rb
jubilee-1.0.1 lib/rack/handler/jubilee.rb
jubilee-1.0.0 lib/rack/handler/jubilee.rb
jubilee-1.0.0.beta1 lib/rack/handler/jubilee.rb
jubilee-0.5.0 lib/rack/handler/jubilee.rb
jubilee-0.4.1 lib/rack/handler/jubilee.rb
jubilee-0.4.0 lib/rack/handler/jubilee.rb
jubilee-0.2.2 lib/rack/handler/jubilee.rb