Class: Rails::Server
- Inherits:
-
Rackup::Server
- Object
- Rackup::Server
- Rails::Server
- Defined in:
- lib/rails/commands/server/server_command.rb
Defined Under Namespace
Classes: Options
Instance Method Summary collapse
- #default_options ⇒ Object
-
#initialize(options = nil) ⇒ Server
constructor
A new instance of Server.
- #middleware ⇒ Object
- #opt_parser ⇒ Object
-
#serveable? ⇒ Boolean
:nodoc:.
- #served_url ⇒ Object
- #set_environment ⇒ Object
- #start(after_stop_callback = nil) ⇒ Object
Constructor Details
#initialize(options = nil) ⇒ Server
Returns a new instance of Server.
18 19 20 21 22 |
# File 'lib/rails/commands/server/server_command.rb', line 18 def initialize( = nil) @default_options = || {} super(@default_options) set_environment end |
Instance Method Details
#default_options ⇒ Object
54 55 56 |
# File 'lib/rails/commands/server/server_command.rb', line 54 def super.merge(@default_options) end |
#middleware ⇒ Object
50 51 52 |
# File 'lib/rails/commands/server/server_command.rb', line 50 def middleware Hash.new([]) end |
#opt_parser ⇒ Object
24 25 26 |
# File 'lib/rails/commands/server/server_command.rb', line 24 def opt_parser Options.new end |
#serveable? ⇒ Boolean
:nodoc:
43 44 45 46 47 48 |
# File 'lib/rails/commands/server/server_command.rb', line 43 def serveable? # :nodoc: server true rescue LoadError, NameError false end |
#served_url ⇒ Object
58 59 60 |
# File 'lib/rails/commands/server/server_command.rb', line 58 def served_url "#{[:SSLEnable] ? 'https' : 'http'}://#{[:Host]}:#{[:Port]}" unless use_puma? end |
#set_environment ⇒ Object
28 29 30 |
# File 'lib/rails/commands/server/server_command.rb', line 28 def set_environment ENV["RAILS_ENV"] ||= [:environment] end |
#start(after_stop_callback = nil) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rails/commands/server/server_command.rb', line 32 def start(after_stop_callback = nil) trap(:INT) { exit } create_tmp_directories setup_dev_caching log_to_stdout if [:log_stdout] super() ensure after_stop_callback.call if after_stop_callback end |