spring 4.0.0 → 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f13e2a4d08faffc1b15c2f1dfe801a3b0b6a12b80d7a66a39601e74ccf3feff
4
- data.tar.gz: 60c63476055ff6050668abfc79489f7c6fbbfc9a7b3a11ea998cb5b2ab86ef9a
3
+ metadata.gz: 25f487be691e4b74fec8082de6dae9c31b2b5452adea9546e615fe972bb92302
4
+ data.tar.gz: 7b7997de4635a441fdba39157260f18f6be1f7c4c41b3fe1b43b21a0fada61d6
5
5
  SHA512:
6
- metadata.gz: 9c467ea15cea498f05ec7e5211bb014163e37a75557d9694e03cc4d6d6e94d4b62c6edcede752e61c4ff51accf472939150c7fc01901aab94cd60d4d06c8a8b1
7
- data.tar.gz: 6d363498591c949b3a49885c38d8694db924d9a2b24c2cc8499236d67739f4cb863eff5db114385bba8cb02bf996af48acd892cbf5e2edebe495bf3bdfffca93
6
+ metadata.gz: a5a1a3b647476c8582da82cfbaa35524e427303149a1bc2e375f115ba25ef32166fd5800e968f3873afef84e6a38b686447b68c1145e9bfffe6aecff03379cb8
7
+ data.tar.gz: 985b243181c0a7c6a4c37052fe504f1f3e51303f7c014924ff2dc8c10693e17b45bba8cf0b39f49a2c378da761b715b501d4f535102f3b82bf5006618461235f
data/README.md CHANGED
@@ -18,6 +18,7 @@ boot it every time you run a test, rake task or migration.
18
18
 
19
19
  * Ruby versions: MRI 2.7, MRI 3.0, MRI 3.1
20
20
  * Rails versions: 6.0, 6.1, 7.0
21
+ * Bundler v2.1+
21
22
 
22
23
  Spring makes extensive use of `Process.fork`, so won't be able to
23
24
  provide a speed up on platforms which don't support forking (Windows, JRuby).
@@ -388,6 +389,12 @@ a command runs:
388
389
  Spring.quiet = true
389
390
  ```
390
391
 
392
+ You can also set the initial state of the `quiet` configuration option to true
393
+ by setting the `SPRING_QUIET` environment variable before executing Spring.
394
+ This is useful if you want to set quiet mode when invoking the Spring executable
395
+ in a subprocess, and cannot or prefer not to set it programmatically
396
+ via the `Spring.quiet` option in `~/.spring.rb` or the app's `config/spring.rb`.
397
+
391
398
  ### Environment variables
392
399
 
393
400
  The following environment variables are used by Spring:
@@ -412,6 +419,8 @@ The following environment variables are used by Spring:
412
419
  the long-running Spring server process. By default, this is related to
413
420
  the socket path; if the socket path is `/foo/bar/spring.sock` the
414
421
  pidfile will be `/foo/bar/spring.pid`.
422
+ * `SPRING_QUIET` - If set, the initial state of the `Spring.quiet`
423
+ configuration option will default to `true`.
415
424
  * `SPRING_SERVER_COMMAND` - The command to run to start up the Spring
416
425
  server when it is not already running. Defaults to `spring _[version]_
417
426
  server --background`.
@@ -1,5 +1,4 @@
1
1
  require "spring/boot"
2
- require "set"
3
2
  require "pty"
4
3
 
5
4
  module Spring
@@ -128,7 +127,12 @@ module Spring
128
127
  end
129
128
 
130
129
  def eager_preload
131
- with_pty { preload }
130
+ with_pty do
131
+ # we can't see stderr and there could be issues when it's overflown
132
+ # see https://github.com/rails/spring/issues/396
133
+ STDERR.reopen("/dev/null")
134
+ preload
135
+ end
132
136
  end
133
137
 
134
138
  def run
@@ -93,7 +93,7 @@ module Spring
93
93
  def start_child(preload = false)
94
94
  @child, child_socket = UNIXSocket.pair
95
95
 
96
- Bundler.with_unbundled_env do
96
+ Bundler.with_original_env do
97
97
  bundler_dir = File.expand_path("../..", $LOADED_FEATURES.grep(/bundler\/setup\.rb$/).first)
98
98
  @pid = Process.spawn(
99
99
  {
@@ -1,5 +1,3 @@
1
- require 'set'
2
-
3
1
  module Spring
4
2
  module Client
5
3
  class Binstub < Command
@@ -1,5 +1,3 @@
1
- require "set"
2
-
3
1
  module Spring
4
2
  module Client
5
3
  class Rails < Command
@@ -22,7 +20,7 @@ module Spring
22
20
 
23
21
  if COMMANDS.include?(command_name)
24
22
  Run.call(["rails_#{command_name}", *args.drop(2)])
25
- elsif command_name.start_with?("db:")
23
+ elsif command_name&.start_with?("db:") && !command_name.start_with?("db:system")
26
24
  Run.call(["rake", *args.drop(1)])
27
25
  else
28
26
  require "spring/configuration"
@@ -28,9 +28,16 @@ module Spring
28
28
  config = File.expand_path("~/.spring.rb")
29
29
  require config if File.exist?(config)
30
30
 
31
- # If the config/spring.rb contains requires for commands from other gems,
32
- # then we need to be under bundler.
33
- require "bundler/setup"
31
+ # We force the TTY so bundler doesn't show a backtrace in case gems are missing.
32
+ old_env = ENV["BUNDLER_FORCE_TTY"]
33
+ ENV["BUNDLER_FORCE_TTY"] = "true"
34
+ begin
35
+ # If the config/spring.rb contains requires for commands from other gems,
36
+ # then we need to be under bundler.
37
+ require "bundler/setup"
38
+ ensure
39
+ ENV["BUNDLER_FORCE_TTY"] = old_env
40
+ end
34
41
 
35
42
  # Auto-require any Spring extensions which are in the Gemfile
36
43
  Gem::Specification.map(&:name).grep(/^spring-/).each do |command|
@@ -2,7 +2,8 @@ require "spring/errors"
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 @@ module Spring
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)
data/lib/spring/env.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require "pathname"
2
- require "digest/md5"
3
2
 
4
3
  require "spring/version"
5
4
  require "spring/configuration"
@@ -41,6 +40,7 @@ module Spring
41
40
  end
42
41
 
43
42
  def application_id
43
+ require "digest/md5"
44
44
  ENV["SPRING_APPLICATION_ID"] || Digest::MD5.hexdigest(RUBY_VERSION + project_root.to_s)
45
45
  end
46
46
 
@@ -1,3 +1,3 @@
1
1
  module Spring
2
- VERSION = "4.0.0"
2
+ VERSION = "4.1.0"
3
3
  end
@@ -1,4 +1,3 @@
1
- require "set"
2
1
  require "pathname"
3
2
  require "mutex_m"
4
3
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spring
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Leighton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-10 00:00:00.000000000 Z
11
+ date: 2022-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -114,7 +114,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  - !ruby/object:Gem::Version
115
115
  version: '0'
116
116
  requirements: []
117
- rubygems_version: 3.2.32
117
+ rubygems_version: 3.3.7
118
118
  signing_key:
119
119
  specification_version: 4
120
120
  summary: Rails application preloader