diff options
author | Alex Johnson <notalexjohnson@gmail.com> | 2013-11-12 19:14:10 +0530 |
---|---|---|
committer | Alex Johnson <notalexjohnson@gmail.com> | 2013-11-12 19:14:13 +0530 |
commit | 5735a77def338125738c6de9c72961bb4df49513 (patch) | |
tree | 3684c807ce3924d4557b4be7a6bdadf88c936529 | |
parent | efff6c1fd4b9e2e4c9f705a45879373cb34a5b0e (diff) | |
download | rails-5735a77def338125738c6de9c72961bb4df49513.tar.gz rails-5735a77def338125738c6de9c72961bb4df49513.tar.bz2 rails-5735a77def338125738c6de9c72961bb4df49513.zip |
Fix RailsServer#start content in initialization guide
[ci skip]
-rw-r--r-- | guides/source/initialization.md | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/guides/source/initialization.md b/guides/source/initialization.md index 0cd0492cab..f1bbb5bb13 100644 --- a/guides/source/initialization.md +++ b/guides/source/initialization.md @@ -330,37 +330,43 @@ and it's free for you to change based on your needs. ### `Rails::Server#start` -After `config/application` is loaded, `server.start` is called. This method is defined like this: +After `config/application` is loaded, `server.start` is called. This method is +defined like this: ```ruby def start - url = "#{options[:SSLEnable] ? 'https' : 'http'}://#{options[:Host]}:#{options[:Port]}" - puts "=> Booting #{ActiveSupport::Inflector.demodulize(server)}" - puts "=> Rails #{Rails.version} application starting in #{Rails.env} on #{url}" - puts "=> Run `rails server -h` for more startup options" + print_boot_information trap(:INT) { exit } - puts "=> Ctrl-C to shutdown server" unless options[:daemonize] + create_tmp_directories + log_to_stdout if options[:log_stdout] - #Create required tmp directories if not found - %w(cache pids sessions sockets).each do |dir_to_make| - FileUtils.mkdir_p(Rails.root.join('tmp', dir_to_make)) + super + ... +end + +private + + def print_boot_information + ... + puts "=> Run `rails server -h` for more startup options" + puts "=> Ctrl-C to shutdown server" unless options[:daemonize] end - unless options[:daemonize] + def create_tmp_directories + %w(cache pids sessions sockets).each do |dir_to_make| + FileUtils.mkdir_p(File.join(Rails.root, 'tmp', dir_to_make)) + end + end + + 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 Rails.logger.extend(ActiveSupport::Logger.broadcast(console)) end - - super -ensure - # The '-h' option calls exit before @options is set. - # If we call 'options' with it unset, we get double help banners. - puts 'Exiting' unless @options && options[:daemonize] -end ``` This is where the first output of the Rails initialization happens. This |