Sha256: 24a728d0892801f9df2eed6361235177dd19aea1fbee4b89534dd12cdd64b9d4

Contents?: true

Size: 771 Bytes

Versions: 9

Compression:

Stored size: 771 Bytes

Contents

#require 'webrick'
require 'thin'
require 'awestruct/rack/app'

module Awestruct
  module CLI

    #WEBrick::HTTPUtils::DefaultMimeTypes.store('atom', 'application/atom+xml')
    #WEBrick::HTTPUtils::DefaultMimeTypes.store('appcache', 'text/cache-manifest')

    class Server
      attr_reader :server

      def initialize(path, bind_addr='0.0.0.0', port=4242)
        @path      = path
        @bind_addr = bind_addr
        @port      = port
      end

      def run
        @server = Thin::Server.new( '0.0.0.0', @port, Awestruct::Rack::App.new( @path ) )
        @server.start
      end

      def run_webrick
        @server = WEBrick::HTTPServer.new( :DocumentRoot=>@path, :Port=>@port, :BindAddress=>@bind_addr )
        @server.start
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
awestruct-0.4.8 lib/awestruct/cli/server.rb
awestruct-0.4.7 lib/awestruct/cli/server.rb
awestruct-0.4.6 lib/awestruct/cli/server.rb
awestruct-0.4.5 lib/awestruct/cli/server.rb
awestruct-0.4.4 lib/awestruct/cli/server.rb
awestruct-0.4.3 lib/awestruct/cli/server.rb
awestruct-0.4.2 lib/awestruct/cli/server.rb
awestruct-0.4.2.x10 lib/awestruct/cli/server.rb
awestruct-0.4.2.x9 lib/awestruct/cli/server.rb