Sha256: eb956f5e5b0bc9faf47187d2d64307011da444905033f5f370d4ab43370f15de

Contents?: true

Size: 584 Bytes

Versions: 6

Compression:

Stored size: 584 Bytes

Contents

require 'webrick'

module Awestruct
  module Commands

    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 = WEBrick::HTTPServer.new( :DocumentRoot=>@path, :Port=>@port, :BindAddress=>@bind_addr )
        @server.start
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
awestruct-0.2.18 lib/awestruct/commands/server.rb
awestruct-0.2.17 lib/awestruct/commands/server.rb
awestruct-0.2.15 lib/awestruct/commands/server.rb
awestruct-0.2.14 lib/awestruct/commands/server.rb
awestruct-0.2.13 lib/awestruct/commands/server.rb
awestruct-0.2.12 lib/awestruct/commands/server.rb