spring 2.0.0 → 2.1.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 -1
- data/README.md +23 -18
- data/lib/spring/application.rb +37 -6
- data/lib/spring/application_manager.rb +4 -2
- data/lib/spring/binstub.rb +0 -20
- data/lib/spring/client/binstub.rb +13 -13
- data/lib/spring/client/help.rb +1 -1
- data/lib/spring/client/rails.rb +1 -1
- data/lib/spring/client/run.rb +16 -2
- data/lib/spring/client/stop.rb +1 -1
- data/lib/spring/commands.rb +1 -1
- data/lib/spring/configuration.rb +5 -1
- data/lib/spring/errors.rb +1 -1
- data/lib/spring/process_title_updater.rb +1 -1
- data/lib/spring/version.rb +1 -1
- data/lib/spring/watcher/abstract.rb +33 -2
- data/lib/spring/watcher/polling.rb +46 -9
- metadata +10 -17
- data/lib/spring/test/acceptance_test.rb +0 -550
- data/lib/spring/test/application.rb +0 -229
- data/lib/spring/test/application_generator.rb +0 -139
- data/lib/spring/test/rails_version.rb +0 -23
- data/lib/spring/test/watcher_test.rb +0 -167
- data/lib/spring/test.rb +0 -18
@@ -12,7 +12,13 @@ module Spring
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def check_stale
|
15
|
-
synchronize
|
15
|
+
synchronize do
|
16
|
+
computed = compute_mtime
|
17
|
+
if mtime < computed
|
18
|
+
debug { "check_stale: mtime=#{mtime.inspect} < computed=#{computed.inspect}" }
|
19
|
+
mark_stale
|
20
|
+
end
|
21
|
+
end
|
16
22
|
end
|
17
23
|
|
18
24
|
def add(*)
|
@@ -21,36 +27,67 @@ module Spring
|
|
21
27
|
end
|
22
28
|
|
23
29
|
def start
|
30
|
+
debug { "start: poller=#{@poller.inspect}" }
|
24
31
|
unless @poller
|
25
32
|
@poller = Thread.new {
|
26
33
|
Thread.current.abort_on_exception = true
|
27
34
|
|
28
|
-
|
29
|
-
|
30
|
-
|
35
|
+
begin
|
36
|
+
until stale?
|
37
|
+
Kernel.sleep latency
|
38
|
+
check_stale
|
39
|
+
end
|
40
|
+
rescue Exception => e
|
41
|
+
debug do
|
42
|
+
"poller: aborted: #{e.class}: #{e}\n #{e.backtrace.join("\n ")}"
|
43
|
+
end
|
44
|
+
raise
|
45
|
+
ensure
|
46
|
+
@poller = nil
|
31
47
|
end
|
32
48
|
}
|
33
49
|
end
|
34
50
|
end
|
35
51
|
|
36
52
|
def stop
|
53
|
+
debug { "stopping poller: #{@poller.inspect}" }
|
37
54
|
if @poller
|
38
55
|
@poller.kill
|
39
56
|
@poller = nil
|
40
57
|
end
|
41
58
|
end
|
42
59
|
|
60
|
+
def running?
|
61
|
+
@poller && @poller.alive?
|
62
|
+
end
|
63
|
+
|
43
64
|
def subjects_changed
|
44
|
-
|
65
|
+
computed = compute_mtime
|
66
|
+
debug { "subjects_changed: mtime #{@mtime} -> #{computed}" }
|
67
|
+
@mtime = computed
|
45
68
|
end
|
46
69
|
|
47
70
|
private
|
48
71
|
|
49
72
|
def compute_mtime
|
50
|
-
expanded_files.map
|
51
|
-
|
52
|
-
|
53
|
-
|
73
|
+
expanded_files.map do |f|
|
74
|
+
# Get the mtime of symlink targets. Ignore dangling symlinks.
|
75
|
+
if File.symlink?(f)
|
76
|
+
begin
|
77
|
+
File.mtime(f)
|
78
|
+
rescue Errno::ENOENT
|
79
|
+
0
|
80
|
+
end
|
81
|
+
# If a file no longer exists, treat it as changed.
|
82
|
+
else
|
83
|
+
begin
|
84
|
+
File.mtime(f)
|
85
|
+
rescue Errno::ENOENT
|
86
|
+
debug { "compute_mtime: no longer exists: #{f}" }
|
87
|
+
Float::MAX
|
88
|
+
end
|
89
|
+
end.to_f
|
90
|
+
end.max || 0
|
54
91
|
end
|
55
92
|
|
56
93
|
def expanded_files
|
metadata
CHANGED
@@ -1,31 +1,31 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Leighton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
type: :
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bump
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -91,12 +91,6 @@ files:
|
|
91
91
|
- lib/spring/process_title_updater.rb
|
92
92
|
- lib/spring/server.rb
|
93
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
94
|
- lib/spring/version.rb
|
101
95
|
- lib/spring/watcher.rb
|
102
96
|
- lib/spring/watcher/abstract.rb
|
@@ -113,15 +107,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
107
|
requirements:
|
114
108
|
- - ">="
|
115
109
|
- !ruby/object:Gem::Version
|
116
|
-
version:
|
110
|
+
version: 2.4.0
|
117
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
118
112
|
requirements:
|
119
113
|
- - ">="
|
120
114
|
- !ruby/object:Gem::Version
|
121
115
|
version: '0'
|
122
116
|
requirements: []
|
123
|
-
|
124
|
-
rubygems_version: 2.5.1
|
117
|
+
rubygems_version: 3.0.3
|
125
118
|
signing_key:
|
126
119
|
specification_version: 4
|
127
120
|
summary: Rails application preloader
|