Class: Lotus::Commands::Server Private
- Inherits:
-
Rack::Server
- Object
- Rack::Server
- Lotus::Commands::Server
- Defined in:
- lib/lotus/commands/server.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Rack compatible server.
It is run with:
`bundle exec lotus server`
It runs the application, by using the server specified in your ‘Gemfile` (eg. Puma or Unicorn).
It enables code reloading by default. This feature is implemented via process fork and requires ‘shotgun` gem.
Instance Attribute Summary collapse
- #options ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(env) ⇒ Server
constructor
private
A new instance of Server.
-
#middleware ⇒ Object
private
Primarily this removes the ::Rack::Chunked middleware which is the cause of Safari content-length bugs.
- #start ⇒ Object private
Constructor Details
#initialize(env) ⇒ Server
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Server.
22 23 24 25 26 27 28 29 30 |
# File 'lib/lotus/commands/server.rb', line 22 def initialize(env) @_env = env @options = (@_env) if code_reloading? require 'shotgun' @app = Shotgun::Loader.new(@_env.rackup.to_s) end end |
Instance Attribute Details
#options ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
20 21 22 |
# File 'lib/lotus/commands/server.rb', line 20 def @options end |
Instance Method Details
#middleware ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Primarily this removes the ::Rack::Chunked middleware which is the cause of Safari content-length bugs.
34 35 36 37 38 39 |
# File 'lib/lotus/commands/server.rb', line 34 def middleware mw = Hash.new { |e, m| e[m] = [] } mw["deployment"].concat([::Rack::ContentLength, ::Rack::CommonLogger]) mw["development"].concat(mw["deployment"] + [::Rack::ShowExceptions, ::Rack::Lint]) mw end |
#start ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
41 42 43 44 45 46 47 48 |
# File 'lib/lotus/commands/server.rb', line 41 def start if code_reloading? Shotgun.enable_copy_on_write Shotgun.preload end super end |