aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorBurke Libbey <burke@libbey.me>2017-06-01 14:28:51 -0400
committerBurke Libbey <burke@libbey.me>2017-07-17 13:17:45 -0400
commit0312a5c67e35b960e33677b5358c539f1047e4e1 (patch)
tree26f25351ba0e824a40b7e26ed08782942cae431f /railties
parent9914964514fc43f6eadba06a47fccdf95b7806f7 (diff)
downloadrails-0312a5c67e35b960e33677b5358c539f1047e4e1.tar.gz
rails-0312a5c67e35b960e33677b5358c539f1047e4e1.tar.bz2
rails-0312a5c67e35b960e33677b5358c539f1047e4e1.zip
Add bootsnap to default Gemfile:
Bootsnap precomputes load path resolution and caches ruby ISeq and YAML parsing/compilation, reducing application boot time by approximately 50% on supported configurations.
Diffstat (limited to 'railties')
-rw-r--r--railties/CHANGELOG.md4
-rw-r--r--railties/lib/rails/generators/rails/app/templates/Gemfile3
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/boot.rb1
3 files changed, 8 insertions, 0 deletions
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md
index db55d4fd69..f720b7caab 100644
--- a/railties/CHANGELOG.md
+++ b/railties/CHANGELOG.md
@@ -1,3 +1,7 @@
+* Add `bootsnap` to default `Gemfile`.
+
+ *Burke Libbey*
+
* Properly expand shortcuts for environment's name running the `console`
and `dbconsole` commands.
diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile
index 64e2062aea..f49b503f85 100644
--- a/railties/lib/rails/generators/rails/app/templates/Gemfile
+++ b/railties/lib/rails/generators/rails/app/templates/Gemfile
@@ -19,6 +19,9 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
+# Reduces boot times through caching; required in config/boot.rb
+gem 'bootsnap', '>= 1.1.0', require: false
+
<%- if options.api? -%>
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible
# gem 'rack-cors'
diff --git a/railties/lib/rails/generators/rails/app/templates/config/boot.rb b/railties/lib/rails/generators/rails/app/templates/config/boot.rb
index 30f5120df6..b9e460cef3 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/boot.rb
+++ b/railties/lib/rails/generators/rails/app/templates/config/boot.rb
@@ -1,3 +1,4 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
require 'bundler/setup' # Set up gems listed in the Gemfile.
+require 'bootsnap/setup' # Speed up boot time by caching expensive operations.