<commit_before>h2. The Rails Initialization Process

This guide explains the internals of the initialization process in Rails as of Rails 3.1. It is an extremely in-depth guide and recommended for advanced Rails developers.

* Using +rails server+
* Using Passenger

endprologue.

This guide goes through every single file, class and method call that is required to boot up the Ruby on Rails stack for a default Rails 3.1 application, explaining each part in detail along the way. For this guide, we will be focusing on how the two most common methods (+rails server+ and Passenger) boot a Rails application.

NOTE: Paths in this guide are relative to Rails or a Rails application unless otherwise specified.

h3. Launch!

As of Rails 3, +script/server+ has become +rails server+. This was done to centralize all rails related commands to one common file.

h4. +bin/rails+

The actual +rails+ command is kept in _bin/rails_:

<ruby>
#!/usr/bin/env ruby
#
# This file was generated by RubyGems.
#
# The application 'railties' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0"

if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
  version = $1
  ARGV.shift
end

gem 'railties', version
load Gem.bin_path('railties', 'rails', version)
</ruby>
<commit_msg>Revert "[ci skip] updated bin/rails code in Rails Initialization Process guide"<commit_after>h2. The Rails Initialization Process

This guide explains the internals of the initialization process in Rails as of Rails 3.1. It is an extremely in-depth guide and recommended for advanced Rails developers.

* Using +rails server+
* Using Passenger

endprologue.

This guide goes through every single file, class and method call that is required to boot up the Ruby on Rails stack for a default Rails 3.1 application, explaining each part in detail along the way. For this guide, we will be focusing on how the two most common methods (+rails server+ and Passenger) boot a Rails application.

NOTE: Paths in this guide are relative to Rails or a Rails application unless otherwise specified.

h3. Launch!

As of Rails 3, +script/server+ has become +rails server+. This was done to centralize all rails related commands to one common file.

h4. +bin/rails+

The actual +rails+ command is kept in _bin/rails_:

<ruby>
#!/usr/bin/env ruby

begin
  require "rails/cli"
rescue LoadError
  railties_path = File.expand_path('../../railties/lib', __FILE__)
  $:.unshift(railties_path)
  require "rails/cli"
end
</ruby>

{'fraction_non_alphanumeric': 0.07283464566929133, 'fraction_numerical': 0.007480314960629921, 'mean_word_length': 4.239175257731959, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '231696', 'n_tokens_mistral': 773, 'n_tokens_neox': 707, 'n_words': 368}