Skip to content

Commit 0a80019

Browse files
committed
Print "Running via Spring preloader" message from the app process
Rather than from the Spring client process. See https://github.com/rails/spring/pull/455/files#r48411471 Within the app process, we'll have access to the spring config, to see whether Spring.quiet has been set. This means we can remove the spring/commands require from the client side, which should never have been added and caused problems (#456, #457). I'm getting rid of the feature which omits this message when run manually (i.e. `spring rails runner ...` rather than `bin/rails runner ...`) because: 1. It makes the implementation more complicated 2. YAGNI
1 parent 8fff76c commit 0a80019

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## Next release
2+
3+
* Fix problems with the implementation of the new "Running via Spring preloader"
4+
message (see #456, #457)
5+
16
## 1.6.1
27

38
* support replaced backtraces / backtraces with only line and number

bin/spring

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,4 @@ end
4646
lib = File.expand_path("../../lib", __FILE__)
4747
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib) # enable local development
4848
require 'spring/client'
49-
# if the user knows that spring is called, do not show running spring
50-
Spring.quiet = true if $0.include? 'spring'
5149
Spring::Client.run(ARGV)

lib/spring/application.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ def serve(client)
157157
IGNORE_SIGNALS.each { |sig| trap(sig, "DEFAULT") }
158158
trap("TERM", "DEFAULT")
159159

160+
puts "Running via Spring preloader in process #{Process.pid}" unless Spring.quiet
161+
160162
ARGV.replace(args)
161163
$0 = command.exec_name
162164

lib/spring/client/run.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
require "spring/commands"
21
require "rbconfig"
32
require "socket"
43
require "bundler"
@@ -139,8 +138,6 @@ def run_command(client, application)
139138
if pid && !pid.empty?
140139
log "got pid: #{pid}"
141140

142-
puts "Running via Spring preloader in process #{pid}" unless Spring.quiet
143-
144141
forward_signals(pid.to_i)
145142
status = application.read.to_i
146143

lib/spring/test/acceptance_test.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@ def without_gem(name)
107107
assert_success app.spring_test_command, stdout: "Running via Spring preloader in process"
108108
end
109109

110-
test "does not tell the user that spring is being used when the user used spring manually" do
111-
refute_output_includes "spring rails runner ''", stdout: "Running via Spring preloader in process"
112-
refute_output_includes "spring rake test", stdout: "Running via Spring preloader in process"
113-
end
114-
115110
test "does not tell the user that spring is being used when used automatically via binstubs but quiet is enabled" do
116111
File.write("#{app.user_home}/.spring.rb", "Spring.quiet = true")
117112
assert_success "bin/rails runner ''"

0 commit comments

Comments
 (0)