DEV Community

Cover image for Ruby on Rails Code Reading Part 1 - Rails Startup
Kenta Takeuchi
Kenta Takeuchi

Posted on • Originally published at bmf-tech.com

Ruby on Rails Code Reading Part 1 - Rails Startup

This article was originally published on bmf-tech.com.

Overview

This is a record of the code reading process for Ruby on Rails.

Preparation

  1. Create a new project with rails new RailsCodeReading.
  2. Add the following to the Gemfile:
gem 'pg'
gem 'pry-rails'
gem 'pry-doc'
gem 'pry-byebug'
gem 'byebug'
Enter fullscreen mode Exit fullscreen mode
  1. Run bundle config set path '.bundle' and then execute bundle install.

Code Reading

Read the code up to the server execution part after executing the rails server command until Rails starts.

  1. rails/rails - railties/lib/rails/commands/server/server_command.rb#L132
  2. rails/rails - railties/lib/rails/rackup/server.rb#L8
    • Requires rackup/server
  3. rack/rackup - lib/rackup/server.rb#L300
  4. puma/puma - lib/rack/handler/puma.rb#L67
    • The server called by server.run depends on the server used by the application
    • If using Puma, this run is called

References

Top comments (0)