Class: Sitepress::PreviewServer
- Inherits:
-
Object
- Object
- Sitepress::PreviewServer
- Defined in:
- lib/sitepress/preview_server.rb
Overview
Evaluates a configuration file on each site request, then delegates to a sitepres server for rednering. In a production environment, you’d want to run ‘Sitepress::Server` directly.
Constant Summary collapse
- DEFAULT_PORT =
8080
- DEFAULT_BIND_ADDRESS =
"0.0.0.0".freeze
Instance Method Summary collapse
-
#initialize(project:) ⇒ PreviewServer
constructor
A new instance of PreviewServer.
- #run(port: DEFAULT_PORT, bind_address: DEFAULT_BIND_ADDRESS) ⇒ Object
Constructor Details
#initialize(project:) ⇒ PreviewServer
Returns a new instance of PreviewServer.
11 12 13 |
# File 'lib/sitepress/preview_server.rb', line 11 def initialize(project:) @project = project end |
Instance Method Details
#run(port: DEFAULT_PORT, bind_address: DEFAULT_BIND_ADDRESS) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sitepress/preview_server.rb', line 15 def run(port: DEFAULT_PORT, bind_address: DEFAULT_BIND_ADDRESS) # TODO: Move all of this junk into the PreviewServer class. Move # what's in there now into PreviewServer::Rack Rack::Handler::WEBrick.run rack_app, BindAddress: bind_address, Port: port do |server| Signal.trap "SIGINT" do server.stop end end end |