From acc03bb695d39682c5e7e4b1338ca96ad57d8ec6 Mon Sep 17 00:00:00 2001 From: Olivier Lacan Date: Wed, 13 Dec 2017 16:17:06 -0500 Subject: 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) --- activestorage/test/dummy/config/boot.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activestorage') diff --git a/activestorage/test/dummy/config/boot.rb b/activestorage/test/dummy/config/boot.rb index 59459d4ae3..72516d9255 100644 --- a/activestorage/test/dummy/config/boot.rb +++ b/activestorage/test/dummy/config/boot.rb @@ -5,3 +5,7 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__) require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) $LOAD_PATH.unshift File.expand_path("../../../lib", __dir__) + +if %w[s server c console].any? { |a| ARGV.include?(a) } + puts "=> Booting Rails" +end -- cgit v1.2.3