spring 3.1.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/lib/spring/application.rb +8 -8
- data/lib/spring/application_manager.rb +1 -1
- data/lib/spring/client/binstub.rb +22 -27
- data/lib/spring/client/rails.rb +1 -1
- data/lib/spring/version.rb +1 -1
- data/lib/spring/watcher/abstract.rb +4 -4
- data/lib/spring/watcher/polling.rb +1 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f13e2a4d08faffc1b15c2f1dfe801a3b0b6a12b80d7a66a39601e74ccf3feff
|
4
|
+
data.tar.gz: 60c63476055ff6050668abfc79489f7c6fbbfc9a7b3a11ea998cb5b2ab86ef9a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c467ea15cea498f05ec7e5211bb014163e37a75557d9694e03cc4d6d6e94d4b62c6edcede752e61c4ff51accf472939150c7fc01901aab94cd60d4d06c8a8b1
|
7
|
+
data.tar.gz: 6d363498591c949b3a49885c38d8694db924d9a2b24c2cc8499236d67739f4cb863eff5db114385bba8cb02bf996af48acd892cbf5e2edebe495bf3bdfffca93
|
data/README.md
CHANGED
@@ -16,9 +16,8 @@ boot it every time you run a test, rake task or migration.
|
|
16
16
|
|
17
17
|
## Compatibility
|
18
18
|
|
19
|
-
* Ruby versions: MRI 2.
|
20
|
-
* Rails versions:
|
21
|
-
`rails new` to generate your application)
|
19
|
+
* Ruby versions: MRI 2.7, MRI 3.0, MRI 3.1
|
20
|
+
* Rails versions: 6.0, 6.1, 7.0
|
22
21
|
|
23
22
|
Spring makes extensive use of `Process.fork`, so won't be able to
|
24
23
|
provide a speed up on platforms which don't support forking (Windows, JRuby).
|
data/lib/spring/application.rb
CHANGED
@@ -11,8 +11,8 @@ module Spring
|
|
11
11
|
@original_env = original_env
|
12
12
|
@spring_env = spring_env
|
13
13
|
@mutex = Mutex.new
|
14
|
-
@waiting =
|
15
|
-
@clients =
|
14
|
+
@waiting = {}
|
15
|
+
@clients = {}
|
16
16
|
@preloaded = false
|
17
17
|
@state = :initialized
|
18
18
|
@interrupt = IO.pipe
|
@@ -92,8 +92,8 @@ module Spring
|
|
92
92
|
|
93
93
|
require Spring.application_root_path.join("config", "application")
|
94
94
|
|
95
|
-
unless Rails.respond_to?(:gem_version) && Rails.gem_version >= Gem::Version.new('
|
96
|
-
raise "Spring only supports Rails >=
|
95
|
+
unless Rails.respond_to?(:gem_version) && Rails.gem_version >= Gem::Version.new('6.0.0')
|
96
|
+
raise "Spring only supports Rails >= 6.0.0"
|
97
97
|
end
|
98
98
|
|
99
99
|
Rails::Application.initializer :ensure_reloading_is_enabled, group: :all do
|
@@ -150,7 +150,7 @@ module Spring
|
|
150
150
|
log "got client"
|
151
151
|
manager.puts
|
152
152
|
|
153
|
-
@clients
|
153
|
+
@clients[client] = true
|
154
154
|
|
155
155
|
_stdout, stderr, _stdin = streams = 3.times.map { client.recv_io }
|
156
156
|
[STDOUT, STDERR, STDIN].zip(streams).each { |a, b| a.reopen(b) }
|
@@ -181,7 +181,7 @@ module Spring
|
|
181
181
|
pid = fork {
|
182
182
|
# Make sure to close other clients otherwise their graceful termination
|
183
183
|
# will be impossible due to reference from this fork.
|
184
|
-
@clients.
|
184
|
+
@clients.each_key { |c| c.close if c != client }
|
185
185
|
|
186
186
|
Process.setsid
|
187
187
|
IGNORE_SIGNALS.each { |sig| trap(sig, "DEFAULT") }
|
@@ -245,7 +245,7 @@ module Spring
|
|
245
245
|
if exiting?
|
246
246
|
# Ensure that we do not ignore subsequent termination attempts
|
247
247
|
log "forced exit"
|
248
|
-
@waiting.
|
248
|
+
@waiting.each_key { |pid| Process.kill("TERM", pid) }
|
249
249
|
Kernel.exit
|
250
250
|
else
|
251
251
|
state! :terminating
|
@@ -337,7 +337,7 @@ module Spring
|
|
337
337
|
end
|
338
338
|
|
339
339
|
def wait(pid, streams, client)
|
340
|
-
@mutex.synchronize { @waiting
|
340
|
+
@mutex.synchronize { @waiting[pid] = true }
|
341
341
|
|
342
342
|
# Wait in a separate thread so we can run multiple commands at once
|
343
343
|
Spring.failsafe_thread {
|
@@ -93,7 +93,7 @@ module Spring
|
|
93
93
|
def start_child(preload = false)
|
94
94
|
@child, child_socket = UNIXSocket.pair
|
95
95
|
|
96
|
-
Bundler.
|
96
|
+
Bundler.with_unbundled_env do
|
97
97
|
bundler_dir = File.expand_path("../..", $LOADED_FEATURES.grep(/bundler\/setup\.rb$/).first)
|
98
98
|
@pid = Process.spawn(
|
99
99
|
{
|
@@ -11,41 +11,36 @@ module Spring
|
|
11
11
|
# client is not invoked for whatever reason, then the Kernel.exit won't
|
12
12
|
# happen, and so we'll fall back to the lines after this block, which
|
13
13
|
# should cause the "unsprung" version of the command to run.
|
14
|
-
LOADER =
|
15
|
-
|
16
|
-
|
17
|
-
rescue LoadError => e
|
18
|
-
raise unless e.message.include?('spring')
|
19
|
-
end
|
20
|
-
CODE
|
14
|
+
LOADER = <<~CODE
|
15
|
+
load File.expand_path("spring", __dir__)
|
16
|
+
CODE
|
21
17
|
|
22
18
|
# The defined? check ensures these lines don't execute when we load the
|
23
19
|
# binstub from the application process. Which means that in the application
|
24
20
|
# process we'll execute the lines which come after the LOADER block, which
|
25
21
|
# is what we want.
|
26
|
-
SPRING =
|
27
|
-
#!/usr/bin/env ruby
|
28
|
-
|
29
|
-
# This file loads Spring without using
|
30
|
-
# It gets overwritten when you run the `spring binstub` command.
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
43
|
-
end
|
44
|
-
CODE
|
22
|
+
SPRING = <<~CODE
|
23
|
+
#!/usr/bin/env ruby
|
24
|
+
|
25
|
+
# This file loads Spring without using loading other gems in the Gemfile, in order to be fast.
|
26
|
+
# It gets overwritten when you run the `spring binstub` command.
|
27
|
+
|
28
|
+
if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"])
|
29
|
+
require "bundler"
|
30
|
+
|
31
|
+
Bundler.locked_gems.specs.find { |spec| spec.name == "spring" }&.tap do |spring|
|
32
|
+
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
|
33
|
+
gem "spring", spring.version
|
34
|
+
require "spring/binstub"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
CODE
|
45
38
|
|
46
39
|
OLD_BINSTUB = %{if !Process.respond_to?(:fork) || Gem::Specification.find_all_by_name("spring").empty?}
|
47
40
|
|
48
41
|
BINSTUB_VARIATIONS = Regexp.union [
|
42
|
+
%{load File.expand_path("spring", __dir__)\n},
|
43
|
+
%{begin\n load File.expand_path('../spring', __FILE__)\nrescue LoadError => e\n raise unless e.message.include?('spring')\nend\n},
|
49
44
|
%{begin\n load File.expand_path('../spring', __FILE__)\nrescue LoadError\nend\n},
|
50
45
|
%{begin\n spring_bin_path = File.expand_path('../spring', __FILE__)\n load spring_bin_path\nrescue LoadError => e\n raise unless e.message.end_with? spring_bin_path, 'spring/binstub'\nend\n},
|
51
46
|
LOADER
|
@@ -146,7 +141,7 @@ CODE
|
|
146
141
|
@mode = :add
|
147
142
|
@items = args.drop(1)
|
148
143
|
.map { |name| find_commands name }
|
149
|
-
.
|
144
|
+
.flatten.uniq
|
150
145
|
.map { |command| Item.new(command) }
|
151
146
|
end
|
152
147
|
|
data/lib/spring/client/rails.rb
CHANGED
data/lib/spring/version.rb
CHANGED
@@ -19,8 +19,8 @@ module Spring
|
|
19
19
|
|
20
20
|
@root = File.realpath(root)
|
21
21
|
@latency = latency
|
22
|
-
@files =
|
23
|
-
@directories =
|
22
|
+
@files = {}
|
23
|
+
@directories = {}
|
24
24
|
@stale = false
|
25
25
|
@listeners = []
|
26
26
|
|
@@ -63,10 +63,10 @@ module Spring
|
|
63
63
|
synchronize {
|
64
64
|
items.each do |item|
|
65
65
|
if item.directory?
|
66
|
-
directories
|
66
|
+
directories[item.realpath.to_s] = true
|
67
67
|
else
|
68
68
|
begin
|
69
|
-
files
|
69
|
+
files[item.realpath.to_s] = true
|
70
70
|
rescue Errno::ENOENT
|
71
71
|
# Race condition. Ignore symlinks whose target was removed
|
72
72
|
# since the check above, or are deeply chained.
|
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
|
+
version: 4.0.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-
|
11
|
+
date: 2021-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -97,7 +97,8 @@ files:
|
|
97
97
|
homepage: https://github.com/rails/spring
|
98
98
|
licenses:
|
99
99
|
- MIT
|
100
|
-
metadata:
|
100
|
+
metadata:
|
101
|
+
rubygems_mfa_required: 'true'
|
101
102
|
post_install_message:
|
102
103
|
rdoc_options: []
|
103
104
|
require_paths:
|
@@ -106,14 +107,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
106
107
|
requirements:
|
107
108
|
- - ">="
|
108
109
|
- !ruby/object:Gem::Version
|
109
|
-
version: 2.
|
110
|
+
version: 2.7.0
|
110
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
112
|
requirements:
|
112
113
|
- - ">="
|
113
114
|
- !ruby/object:Gem::Version
|
114
115
|
version: '0'
|
115
116
|
requirements: []
|
116
|
-
rubygems_version: 3.2.
|
117
|
+
rubygems_version: 3.2.32
|
117
118
|
signing_key:
|
118
119
|
specification_version: 4
|
119
120
|
summary: Rails application preloader
|