Class: Rails::Server
Relationships & Source Files | |
Namespace Children | |
Classes:
| |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Rackup::Server
|
|
Instance Chain:
self,
Rackup::Server
|
|
Inherits: |
Rackup::Server
|
Defined in: | railties/lib/rails/commands/server/server_command.rb |
Class Method Summary
- .new(options = nil) ⇒ Server constructor
Instance Attribute Summary
- #use_puma? ⇒ Boolean readonly private
- #serveable? ⇒ Boolean readonly Internal use only
Instance Method Summary
Constructor Details
.new(options = nil) ⇒ Server
# File 'railties/lib/rails/commands/server/server_command.rb', line 18
def initialize( = nil) @default_options = || {} super(@default_options) set_environment end
Instance Attribute Details
#serveable? ⇒ Boolean
(readonly)
This method is for internal use only.
[ GitHub ]
#use_puma? ⇒ Boolean
(readonly, private)
[ GitHub ]
# File 'railties/lib/rails/commands/server/server_command.rb', line 87
def use_puma? server.to_s.end_with?("Handler::Puma") end
Instance Method Details
#create_tmp_directories (private)
[ GitHub ]#default_options
[ GitHub ]# File 'railties/lib/rails/commands/server/server_command.rb', line 54
def super.merge(@default_options) end
#log_to_stdout (private)
[ GitHub ]# File 'railties/lib/rails/commands/server/server_command.rb', line 75
def log_to_stdout wrapped_app # touch the app so the logger is set up console = ActiveSupport::Logger.new(STDOUT) console.formatter = Rails.logger.formatter console.level = Rails.logger.level unless ActiveSupport::Logger.logger_outputs_to?(Rails.logger, STDERR, STDOUT) Rails.logger.broadcast_to(console) end end
#middleware
[ GitHub ]#opt_parser
[ GitHub ]#served_url
[ GitHub ]# File 'railties/lib/rails/commands/server/server_command.rb', line 58
def served_url "#{ [:SSLEnable] ? 'https' : 'http'}://#{ [:Host]}:#{ [:Port]}" unless use_puma? end
#set_environment
[ GitHub ]# File 'railties/lib/rails/commands/server/server_command.rb', line 28
def set_environment ENV["RAILS_ENV"] ||= [:environment] end
#setup_dev_caching (private)
[ GitHub ]# File 'railties/lib/rails/commands/server/server_command.rb', line 63
def setup_dev_caching if [:environment] == "development" Rails::DevCaching.enable_by_argument( [:caching]) end end
#start(after_stop_callback = nil)
[ GitHub ]# File 'railties/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