Class: Rails::Server
- Inherits:
-
Rack::Server
- Object
- Rack::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.
19 20 21 22 23 |
# File 'lib/rails/commands/server/server_command.rb', line 19 def initialize( = nil) @default_options = || {} super(@default_options) set_environment end |
Instance Method Details
#default_options ⇒ Object
55 56 57 |
# File 'lib/rails/commands/server/server_command.rb', line 55 def super.merge(@default_options) end |
#middleware ⇒ Object
51 52 53 |
# File 'lib/rails/commands/server/server_command.rb', line 51 def middleware Hash.new([]) end |
#opt_parser ⇒ Object
25 26 27 |
# File 'lib/rails/commands/server/server_command.rb', line 25 def opt_parser Options.new end |
#serveable? ⇒ Boolean
:nodoc:
44 45 46 47 48 49 |
# File 'lib/rails/commands/server/server_command.rb', line 44 def serveable? # :nodoc: server true rescue LoadError, NameError false end |
#served_url ⇒ Object
59 60 61 |
# File 'lib/rails/commands/server/server_command.rb', line 59 def served_url "#{[:SSLEnable] ? 'https' : 'http'}://#{[:Host]}:#{[:Port]}" unless use_puma? end |
#set_environment ⇒ Object
29 30 31 |
# File 'lib/rails/commands/server/server_command.rb', line 29 def set_environment ENV["RAILS_ENV"] ||= [:environment] end |
#start(after_stop_callback = nil) ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/rails/commands/server/server_command.rb', line 33 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 |