Class: Maze::DocumentServer
- Inherits:
-
Object
- Object
- Maze::DocumentServer
- Defined in:
- lib/maze/document_server.rb
Overview
HTTP server for a given document root
Class Method Summary collapse
-
.manual_start ⇒ Object
Starts the document server “manually” (via a Cucumber step as opposed to command line option).
- .manual_stop ⇒ Object
-
.start ⇒ Object
Start the document server.
Class Method Details
.manual_start ⇒ Object
Starts the document server “manually” (via a Cucumber step as opposed to command line option)
29 30 31 32 33 34 35 36 |
# File 'lib/maze/document_server.rb', line 29 def manual_start if !@thread.nil? && @thread.alive? $logger.warn 'Document Server has already been started on the command line, ignoring manual start' return end @manual_start = true start end |
.manual_stop ⇒ Object
38 39 40 41 42 43 |
# File 'lib/maze/document_server.rb', line 38 def manual_stop return unless @manual_start @thread.kill @manual_start = false end |
.start ⇒ Object
Start the document server. This is intended to be called only once per test run. Use manual_start for finer grained control.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/maze/document_server.rb', line 11 def start @thread = Thread.new do = { DocumentRoot: Maze.config.document_server_root, Port: Maze.config.document_server_port, Logger: $logger, AccessLog: [] } [:BindAddress] = Maze.config.document_server_bind_address unless Maze.config.document_server_bind_address.nil? server = WEBrick::HTTPServer.new() server.mount '/reflect', Servlets::ReflectiveServlet $logger.info "Starting document server for root: #{Maze.config.document_server_root}" server.start end end |