File tree 4 files changed +22
-2
lines changed
4 files changed +22
-2
lines changed Original file line number Diff line number Diff line change 1
1
## Next Release
2
2
3
+ * Add support for ` SPRING_QUIET ` environment variable.
4
+
3
5
## 4.0.0
4
6
5
7
* Stop requiring ` set ` before bundler can select the proper version. This could result in
Original file line number Diff line number Diff line change @@ -388,6 +388,12 @@ a command runs:
388
388
Spring .quiet = true
389
389
```
390
390
391
+ You can also set the initial state of the ` quiet ` configuration option to true
392
+ by setting the ` SPRING_QUIET ` environment variable before executing Spring.
393
+ This is useful if you want to set quiet mode when invoking the Spring executable
394
+ in a subprocess, and cannot or prefer not to set it programmatically
395
+ via the ` Spring.quiet ` option in ` ~/.spring.rb ` or the app's ` config/spring.rb ` .
396
+
391
397
### Environment variables
392
398
393
399
The following environment variables are used by Spring:
@@ -412,6 +418,8 @@ The following environment variables are used by Spring:
412
418
the long-running Spring server process. By default, this is related to
413
419
the socket path; if the socket path is ` /foo/bar/spring.sock ` the
414
420
pidfile will be ` /foo/bar/spring.pid ` .
421
+ * ` SPRING_QUIET ` - If set, the initial state of the ` Spring.quiet `
422
+ configuration option will default to ` true ` .
415
423
* ` SPRING_SERVER_COMMAND ` - The command to run to start up the Spring
416
424
server when it is not already running. Defaults to `spring _ [ version] _
417
425
server --background`.
Original file line number Diff line number Diff line change 2
2
3
3
module Spring
4
4
class << self
5
- attr_accessor :application_root , :quiet
5
+ attr_accessor :application_root
6
+ attr_writer :quiet
6
7
7
8
def gemfile
8
9
require "bundler"
@@ -52,6 +53,10 @@ def project_root_path
52
53
@project_root_path ||= find_project_root ( Pathname . new ( File . expand_path ( Dir . pwd ) ) )
53
54
end
54
55
56
+ def quiet
57
+ @quiet ||= ENV . key? ( 'SPRING_QUIET' )
58
+ end
59
+
55
60
private
56
61
57
62
def find_project_root ( current_dir )
Original file line number Diff line number Diff line change @@ -125,12 +125,17 @@ def without_gem(name)
125
125
assert_success app . spring_test_command , stderr : "Running via Spring preloader in process"
126
126
end
127
127
128
- test "does not tell the user that Spring is being used when used automatically via binstubs but quiet is enabled" do
128
+ test "does not tell the user that Spring is being used when quiet is enabled via Spring.quiet " do
129
129
File . write ( "#{ app . user_home } /.spring.rb" , "Spring.quiet = true" )
130
130
assert_success "bin/rails runner ''"
131
131
refute_output_includes "bin/rails runner ''" , stderr : 'Running via Spring preloader in process'
132
132
end
133
133
134
+ test "does not tell the user that Spring is being used when quiet is enabled via SPRING_QUIET ENV var" do
135
+ assert_success "SPRING_QUIET=true bin/rails runner ''"
136
+ refute_output_includes "bin/rails runner ''" , stderr : 'Running via Spring preloader in process'
137
+ end
138
+
134
139
test "raises if config.cache_classes is true" do
135
140
config_path = app . path ( "config/environments/development.rb" )
136
141
config = File . read ( config_path )
You can’t perform that action at this time.
0 commit comments