Sha256: 573dbe73d08ba4eaa2d88b5c68f394574035cc5ac12624d4934c9054dcf72389

Contents?: true

Size: 579 Bytes

Versions: 11

Compression:

Stored size: 579 Bytes

Contents

require 'webrick'

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

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
awestruct-0.4.2.x8 lib/awestruct/cli/server.rb
awestruct-0.4.2.x7 lib/awestruct/cli/server.rb
awestruct-0.4.2.x6 lib/awestruct/cli/server.rb
awestruct-0.4.2.x5 lib/awestruct/cli/server.rb
awestruct-0.4.2.x4 lib/awestruct/cli/server.rb
awestruct-0.4.2.x3 lib/awestruct/cli/server.rb
awestruct-0.4.2.x2 lib/awestruct/cli/server.rb
awestruct-0.4.2.x1 lib/awestruct/cli/server.rb
awestructx-0.4.1.x1 lib/awestruct/cli/server.rb
awestructx-0.4.1 lib/awestruct/cli/server.rb
awestructx-0.4.0 lib/awestruct/cli/server.rb