Answering your question is easy by adding some puts
statements in your Rails application. (It seems like a lot of people are reluctant to dig in and do this, but I really recommend it!) So, by experimentation and observation alone, here is the order of the things you mentioned:
boot.rb
config/initializers/*
routes.rb
Here is a little more detail:
1. boot.rb
This loads the application gems by using bundler:
require 'rubygems'
# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
2. config/initializers/*
They run in alphabetical order.
If you are curious what triggers this, take a look at engine.rb in the railties source code. (It is useful to know that a Rails Application is a subclass of a Rails Engine.)
initializer :load_config_initializers do
config.paths["config/initializers"].existent.sort.each do |initializer|
load(initializer)
end
end
3. routes.rb
By observation, I see that route drawing (specification) occurs next.
But looking at the details is more involved, so if you are interested I would read SO: Controlling routes loading order from Engines and perhaps take a look at the :add_routing_paths initializer in engine.rb.