Skip to content

Commit fd5cb71

Browse files
agisjonleighton
authored andcommitted
Warn if Spring is running in production (#532)
Fixes #318
1 parent 306bfc7 commit fd5cb71

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/spring/application.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,17 @@ def serve(client)
173173
IGNORE_SIGNALS.each { |sig| trap(sig, "DEFAULT") }
174174
trap("TERM", "DEFAULT")
175175

176-
STDERR.puts "Running via Spring preloader in process #{Process.pid}" unless Spring.quiet
176+
unless Spring.quiet
177+
STDERR.puts "Running via Spring preloader in process #{Process.pid}"
178+
179+
if Rails.env.production?
180+
STDERR.puts "WARNING: Spring is running in production. To fix " \
181+
"this make sure the spring gem is only present " \
182+
"in `development` and `test` groups in your Gemfile " \
183+
"and make sure you always use " \
184+
"`bundle install --without development test` in production"
185+
end
186+
end
177187

178188
ARGV.replace(args)
179189
$0 = command.exec_name

0 commit comments

Comments
 (0)