Class: Charsi::Server
- Inherits:
-
Object
- Object
- Charsi::Server
- Defined in:
- lib/charsi/server.rb
Constant Summary collapse
- DEFAULT_PORT =
8000
Instance Method Summary collapse
-
#initialize ⇒ Server
constructor
A new instance of Server.
- #serve ⇒ Object
Constructor Details
#initialize ⇒ Server
Returns a new instance of Server.
7 8 9 |
# File 'lib/charsi/server.rb', line 7 def initialize @config = Configuration.new end |
Instance Method Details
#serve ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/charsi/server.rb', line 11 def serve build_dir = @config.path(:output_dir) server = WEBrick::HTTPServer.new(Port: DEFAULT_PORT, DocumentRoot: build_dir) trap('INT') { server.shutdown } puts "[charsi] Serving #{build_dir} at http://localhost:#{DEFAULT_PORT}" server.start end |