spring 2.0.2 → 4.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE.txt +1 -0
- data/README.md +66 -39
- data/lib/spring/application/boot.rb +9 -3
- data/lib/spring/application.rb +80 -42
- data/lib/spring/application_manager.rb +10 -5
- data/lib/spring/binstub.rb +0 -20
- data/lib/spring/client/binstub.rb +32 -40
- data/lib/spring/client/help.rb +1 -1
- data/lib/spring/client/rails.rb +4 -4
- data/lib/spring/client/run.rb +50 -12
- data/lib/spring/client/stop.rb +1 -1
- data/lib/spring/commands.rb +11 -4
- data/lib/spring/configuration.rb +33 -2
- data/lib/spring/env.rb +3 -4
- data/lib/spring/errors.rb +1 -1
- data/lib/spring/json.rb +27 -30
- data/lib/spring/process_title_updater.rb +1 -1
- data/lib/spring/server.rb +16 -6
- data/lib/spring/version.rb +1 -1
- data/lib/spring/watcher/abstract.rb +12 -12
- data/lib/spring/watcher/polling.rb +2 -2
- metadata +10 -59
- data/lib/spring/sid.rb +0 -42
- data/lib/spring/test/acceptance_test.rb +0 -558
- data/lib/spring/test/application.rb +0 -229
- data/lib/spring/test/application_generator.rb +0 -144
- data/lib/spring/test/rails_version.rb +0 -23
- data/lib/spring/test/watcher_test.rb +0 -194
- data/lib/spring/test.rb +0 -18
@@ -1,6 +1,4 @@
|
|
1
|
-
require "set"
|
2
1
|
require "pathname"
|
3
|
-
require "mutex_m"
|
4
2
|
|
5
3
|
module Spring
|
6
4
|
module Watcher
|
@@ -10,23 +8,25 @@ module Spring
|
|
10
8
|
# IO.select([watcher]) # watcher is running in background
|
11
9
|
# watcher.stale? # => true
|
12
10
|
class Abstract
|
13
|
-
include Mutex_m
|
14
|
-
|
15
11
|
attr_reader :files, :directories, :root, :latency
|
16
12
|
|
17
13
|
def initialize(root, latency)
|
18
|
-
|
19
|
-
|
14
|
+
@mutex = Mutex.new
|
20
15
|
@root = File.realpath(root)
|
21
16
|
@latency = latency
|
22
|
-
@files =
|
23
|
-
@directories =
|
17
|
+
@files = {}
|
18
|
+
@directories = {}
|
24
19
|
@stale = false
|
25
20
|
@listeners = []
|
26
21
|
|
27
22
|
@on_debug = nil
|
28
23
|
end
|
29
24
|
|
25
|
+
def synchronize(&block)
|
26
|
+
# Used by some gems.
|
27
|
+
@mutex.synchronize(&block)
|
28
|
+
end
|
29
|
+
|
30
30
|
def on_debug(&block)
|
31
31
|
@on_debug = block
|
32
32
|
end
|
@@ -60,13 +60,13 @@ module Spring
|
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
|
-
synchronize
|
63
|
+
@mutex.synchronize do
|
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.
|
@@ -76,7 +76,7 @@ module Spring
|
|
76
76
|
end
|
77
77
|
|
78
78
|
subjects_changed
|
79
|
-
|
79
|
+
end
|
80
80
|
end
|
81
81
|
|
82
82
|
def stale?
|
@@ -12,7 +12,7 @@ module Spring
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def check_stale
|
15
|
-
synchronize do
|
15
|
+
@mutex.synchronize do
|
16
16
|
computed = compute_mtime
|
17
17
|
if mtime < computed
|
18
18
|
debug { "check_stale: mtime=#{mtime.inspect} < computed=#{computed.inspect}" }
|
@@ -91,7 +91,7 @@ module Spring
|
|
91
91
|
end
|
92
92
|
|
93
93
|
def expanded_files
|
94
|
-
files + Dir["{#{directories.map { |d| "#{d}/**/*" }.join(",")}}"]
|
94
|
+
(files.keys + Dir["{#{directories.keys.map { |d| "#{d}/**/*" }.join(",")}}"]).uniq
|
95
95
|
end
|
96
96
|
end
|
97
97
|
end
|
metadata
CHANGED
@@ -1,57 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 4.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Leighton
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: activesupport
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '4.2'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '4.2'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: bump
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
11
|
+
date: 2024-04-22 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
55
13
|
description: Preloads your application so things like console, rake and tests run
|
56
14
|
faster
|
57
15
|
email:
|
@@ -90,13 +48,6 @@ files:
|
|
90
48
|
- lib/spring/json.rb
|
91
49
|
- lib/spring/process_title_updater.rb
|
92
50
|
- lib/spring/server.rb
|
93
|
-
- lib/spring/sid.rb
|
94
|
-
- lib/spring/test.rb
|
95
|
-
- lib/spring/test/acceptance_test.rb
|
96
|
-
- lib/spring/test/application.rb
|
97
|
-
- lib/spring/test/application_generator.rb
|
98
|
-
- lib/spring/test/rails_version.rb
|
99
|
-
- lib/spring/test/watcher_test.rb
|
100
51
|
- lib/spring/version.rb
|
101
52
|
- lib/spring/watcher.rb
|
102
53
|
- lib/spring/watcher/abstract.rb
|
@@ -104,8 +55,9 @@ files:
|
|
104
55
|
homepage: https://github.com/rails/spring
|
105
56
|
licenses:
|
106
57
|
- MIT
|
107
|
-
metadata:
|
108
|
-
|
58
|
+
metadata:
|
59
|
+
rubygems_mfa_required: 'true'
|
60
|
+
post_install_message:
|
109
61
|
rdoc_options: []
|
110
62
|
require_paths:
|
111
63
|
- lib
|
@@ -113,16 +65,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
65
|
requirements:
|
114
66
|
- - ">="
|
115
67
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
68
|
+
version: 2.7.0
|
117
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
70
|
requirements:
|
119
71
|
- - ">="
|
120
72
|
- !ruby/object:Gem::Version
|
121
73
|
version: '0'
|
122
74
|
requirements: []
|
123
|
-
|
124
|
-
|
125
|
-
signing_key:
|
75
|
+
rubygems_version: 3.3.7
|
76
|
+
signing_key:
|
126
77
|
specification_version: 4
|
127
78
|
summary: Rails application preloader
|
128
79
|
test_files: []
|
data/lib/spring/sid.rb
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
# If rubygems is present, keep it out of the way when loading fiddle,
|
3
|
-
# otherwise if fiddle is not installed then rubygems will load all
|
4
|
-
# gemspecs in its (futile) search for fiddle, which is slow.
|
5
|
-
if respond_to?(:gem_original_require, true)
|
6
|
-
gem_original_require 'fiddle'
|
7
|
-
else
|
8
|
-
require 'fiddle'
|
9
|
-
end
|
10
|
-
rescue LoadError
|
11
|
-
end
|
12
|
-
|
13
|
-
module Spring
|
14
|
-
module SID
|
15
|
-
def self.fiddle_func
|
16
|
-
@fiddle_func ||= Fiddle::Function.new(
|
17
|
-
DL::Handle::DEFAULT['getsid'],
|
18
|
-
[Fiddle::TYPE_INT],
|
19
|
-
Fiddle::TYPE_INT
|
20
|
-
)
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.sid
|
24
|
-
@sid ||= begin
|
25
|
-
if Process.respond_to?(:getsid)
|
26
|
-
# Ruby 2
|
27
|
-
Process.getsid
|
28
|
-
elsif defined?(Fiddle) and defined?(DL)
|
29
|
-
# Ruby 1.9.3 compiled with libffi support
|
30
|
-
fiddle_func.call(0)
|
31
|
-
else
|
32
|
-
# last resort: shell out
|
33
|
-
`ps -p #{Process.pid} -o sess=`.to_i
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def self.pgid
|
39
|
-
Process.getpgid(sid)
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|