aboutsummaryrefslogtreecommitdiffstats
path: root/railties
diff options
context:
space:
mode:
authorOlivier Lacan <hi@olivierlacan.com>2017-12-13 16:17:06 -0500
committerOlivier Lacan <hi@olivierlacan.com>2017-12-13 20:50:27 -0500
commitacc03bb695d39682c5e7e4b1338ca96ad57d8ec6 (patch)
tree87f6b81155fd6edcf8a753911d40e1e46d169ec5 /railties
parent924267516723b4cb69be64de456f8552e5ed55e6 (diff)
downloadrails-acc03bb695d39682c5e7e4b1338ca96ad57d8ec6.tar.gz
rails-acc03bb695d39682c5e7e4b1338ca96ad57d8ec6.tar.bz2
rails-acc03bb695d39682c5e7e4b1338ca96ad57d8ec6.zip
Provide instant feedback when booting Rails
I've noticed during pair/mob programming sessions with peers that despite the speed boosts provided by Bootsnap and Spring, there is a noticeable latency between firing a bin/rails server command and any feedback being provided to the console. Depending on the size of the application this lack of feedback can make it seem like something is wrong when Rails is simply busy initializing. This change may seem gratuitous but by just printing one line to STDOUT we're giving a clear signal to the Rails user that their command has been received and that Rails is indeed booting. It almost imperciptibly makes Rails feel more responsive. Sure the code doesn't look very fancy but there's no other appropriate place I could think of putting it than boot.rb. Compare these two GIFs of booting without and with this change: Before: ![Without Boot Feedback](https://user-images.githubusercontent.com/65950/33964140-721041fc-e025-11e7-9b25-9d839ce92977.gif) After: ![With Boot Feedback](https://user-images.githubusercontent.com/65950/33964151-79e12f86-e025-11e7-93e9-7a75c70d408f.gif)
Diffstat (limited to 'railties')
-rw-r--r--railties/lib/rails/generators/rails/app/templates/config/boot.rb.tt4
1 files changed, 4 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/boot.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/boot.rb.tt
index b9e460cef3..6246e7bf85 100644
--- a/railties/lib/rails/generators/rails/app/templates/config/boot.rb.tt
+++ b/railties/lib/rails/generators/rails/app/templates/config/boot.rb.tt
@@ -2,3 +2,7 @@ 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.
+
+if %w[s server c console].any? { |a| ARGV.include?(a) }
+ puts "=> Booting Rails"
+end