Class: Statique::CLI::Server
- Inherits:
-
Object
- Object
- Statique::CLI::Server
- Defined in:
- lib/statique/cli/server.rb
Defined Under Namespace
Classes: EventStream, LoggerWrapper
Instance Method Summary collapse
-
#initialize(statique, port: 3000) ⇒ Server
constructor
A new instance of Server.
- #run ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(statique, port: 3000) ⇒ Server
Returns a new instance of Server.
27 28 29 30 |
# File 'lib/statique/cli/server.rb', line 27 def initialize(statique, port: 3000) @port = port @statique = statique end |
Instance Method Details
#run ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/statique/cli/server.rb', line 32 def run require "statique/app" @statique.ui.info "Starting server", port: @port logger = LoggerWrapper.new Rack::Handler::WEBrick.run(Statique::App.freeze, Port: @port, Host: "localhost", Logger: logger, AccessLog: [[logger, "%m:%U:%s:%T:%{Content-Type}o"]]) end |
#stop ⇒ Object
45 46 47 48 |
# File 'lib/statique/cli/server.rb', line 45 def stop @statique.ui.info "Stopping server" Rack::Handler::WEBrick.shutdown end |