Class: Awestruct::CLI::Server
- Inherits:
-
Object
- Object
- Awestruct::CLI::Server
- Defined in:
- lib/awestruct/cli/server.rb
Overview
WEBrick::HTTPUtils::DefaultMimeTypes.store(‘atom’, ‘application/atom+xml’) WEBrick::HTTPUtils::DefaultMimeTypes.store(‘appcache’, ‘text/cache-manifest’)
Instance Attribute Summary collapse
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
-
#initialize(path, bind_addr = '0.0.0.0', port = 4242) ⇒ Server
constructor
A new instance of Server.
- #run ⇒ Object
- #run_webrick ⇒ Object
Constructor Details
#initialize(path, bind_addr = '0.0.0.0', port = 4242) ⇒ Server
Returns a new instance of Server.
14 15 16 17 18 |
# File 'lib/awestruct/cli/server.rb', line 14 def initialize(path, bind_addr='0.0.0.0', port=4242) @path = path @bind_addr = bind_addr @port = port end |
Instance Attribute Details
#server ⇒ Object (readonly)
Returns the value of attribute server.
12 13 14 |
# File 'lib/awestruct/cli/server.rb', line 12 def server @server end |
Instance Method Details
#run ⇒ Object
20 21 22 23 |
# File 'lib/awestruct/cli/server.rb', line 20 def run @server = Thin::Server.new( '0.0.0.0', @port, Awestruct::Rack::App.new( @path ) ) @server.start end |
#run_webrick ⇒ Object
25 26 27 28 |
# File 'lib/awestruct/cli/server.rb', line 25 def run_webrick @server = WEBrick::HTTPServer.new( :DocumentRoot=>@path, :Port=>@port, :BindAddress=>@bind_addr ) @server.start end |