puma 3.0.1 → 3.0.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puma might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/History.txt +16 -0
- data/lib/puma/const.rb +1 -1
- data/lib/puma/control_cli.rb +9 -7
- data/lib/puma/plugin.rb +14 -1
- data/lib/puma/plugin/tmp_restart.rb +17 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e38706b39e9afd3162b1c9ced04cb0f856e31706
|
4
|
+
data.tar.gz: b81aadfa3ed39aa205704e0d497c559be4e88259
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ca710aedc31a5e20d37d1fe656892837225ba1980c6fc5c368d8fba6704493483ca8cee2668b4491d41523d193f921b4580b6f4441a13cb7405a33eacdd2d8e
|
7
|
+
data.tar.gz: e931f560ea6b6edee01240041c654099187d411f18a49c07709243740b52efad89c86b23500f0aeb067f0dfcfdb9455cc56e8d0289bcf232a5a80a909bc24629
|
data/History.txt
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
=== 3.0.2 / 2016-02-26
|
2
|
+
|
3
|
+
* 5 bug fixes:
|
4
|
+
|
5
|
+
* Fix 'undefined local variable or method `pid` for #<Puma::ControlCLI:0x007f185fcef968>' when execute pumactl with `--pid` option.
|
6
|
+
* Fix 'undefined method `windows?` for Puma:Module' when execute pumactl.
|
7
|
+
* Harden tmp_restart against errors related to the restart file
|
8
|
+
* Make `plugin :tmp_restart` behavior correct in Windows.
|
9
|
+
* fix uninitialized constant Puma::ControlCLI::StateFile
|
10
|
+
|
11
|
+
* 3 PRs merged:
|
12
|
+
|
13
|
+
* Merge pull request #901 from mitto/fix-pumactl-uninitialized-constant-statefile
|
14
|
+
* Merge pull request #902 from corrupt952/fix_undefined_method_and_variable_when_execute_pumactl
|
15
|
+
* Merge pull request #905 from Eric-Guo/master
|
16
|
+
|
1
17
|
=== 3.0.1 / 2016-02-25
|
2
18
|
|
3
19
|
* 1 bug fix:
|
data/lib/puma/const.rb
CHANGED
data/lib/puma/control_cli.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'optparse'
|
2
|
+
require 'puma'
|
2
3
|
require 'puma/const'
|
4
|
+
require 'puma/detect'
|
3
5
|
require 'puma/configuration'
|
4
6
|
require 'uri'
|
5
7
|
require 'socket'
|
@@ -108,7 +110,7 @@ module Puma
|
|
108
110
|
raise "State file not found: #{@state}"
|
109
111
|
end
|
110
112
|
|
111
|
-
sf = StateFile.new
|
113
|
+
sf = Puma::StateFile.new
|
112
114
|
sf.load @state
|
113
115
|
|
114
116
|
@control_url = sf.control_url
|
@@ -177,24 +179,24 @@ module Puma
|
|
177
179
|
end
|
178
180
|
|
179
181
|
begin
|
180
|
-
Process.getpgid pid
|
182
|
+
Process.getpgid @pid
|
181
183
|
rescue SystemCallError
|
182
184
|
if @command == "restart"
|
183
185
|
start
|
184
186
|
else
|
185
|
-
raise "No pid '#{pid}' found"
|
187
|
+
raise "No pid '#{@pid}' found"
|
186
188
|
end
|
187
189
|
end
|
188
190
|
|
189
191
|
case @command
|
190
192
|
when "restart"
|
191
|
-
Process.kill "SIGUSR2", pid
|
193
|
+
Process.kill "SIGUSR2", @pid
|
192
194
|
|
193
195
|
when "halt"
|
194
|
-
Process.kill "QUIT", pid
|
196
|
+
Process.kill "QUIT", @pid
|
195
197
|
|
196
198
|
when "stop"
|
197
|
-
Process.kill "SIGTERM", pid
|
199
|
+
Process.kill "SIGTERM", @pid
|
198
200
|
|
199
201
|
when "stats"
|
200
202
|
puts "Stats not available via pid only"
|
@@ -205,7 +207,7 @@ module Puma
|
|
205
207
|
return
|
206
208
|
|
207
209
|
when "phased-restart"
|
208
|
-
Process.kill "SIGUSR1", pid
|
210
|
+
Process.kill "SIGUSR1", @pid
|
209
211
|
|
210
212
|
else
|
211
213
|
message "Puma is started"
|
data/lib/puma/plugin.rb
CHANGED
@@ -58,8 +58,21 @@ module Puma
|
|
58
58
|
Plugins = PluginRegistry.new
|
59
59
|
|
60
60
|
class Plugin
|
61
|
+
# Matches
|
62
|
+
# "C:/Ruby22/lib/ruby/gems/2.2.0/gems/puma-3.0.1/lib/puma/plugin/tmp_restart.rb:3:in `<top (required)>'"
|
63
|
+
# AS
|
64
|
+
# C:/Ruby22/lib/ruby/gems/2.2.0/gems/puma-3.0.1/lib/puma/plugin/tmp_restart.rb
|
65
|
+
CALLER_FILE = /
|
66
|
+
\A # start of string
|
67
|
+
.+ # file path (one or more characters)
|
68
|
+
(?= # stop previous match when
|
69
|
+
:\d+ # a colon is followed by one or more digits
|
70
|
+
:in # followed by a colon followed by in
|
71
|
+
)
|
72
|
+
/x
|
73
|
+
|
61
74
|
def self.extract_name(ary)
|
62
|
-
path = ary.first
|
75
|
+
path = ary.first[CALLER_FILE]
|
63
76
|
|
64
77
|
m = %r!puma/plugin/([^/]*)\.rb$!.match(path)
|
65
78
|
return m[1]
|
@@ -4,17 +4,29 @@ Puma::Plugin.create do
|
|
4
4
|
def start(launcher)
|
5
5
|
path = File.join("tmp", "restart.txt")
|
6
6
|
|
7
|
-
|
7
|
+
orig = nil
|
8
8
|
|
9
|
-
|
9
|
+
# If we can't write to the path, then just don't bother with this plugin
|
10
|
+
begin
|
11
|
+
File.write path, ""
|
12
|
+
orig = File.stat(path).mtime
|
13
|
+
rescue SystemCallError
|
14
|
+
return
|
15
|
+
end
|
10
16
|
|
11
17
|
in_background do
|
12
18
|
while true
|
13
19
|
sleep 2
|
14
20
|
|
15
|
-
|
16
|
-
|
17
|
-
|
21
|
+
begin
|
22
|
+
mtime = File.stat(path).mtime
|
23
|
+
rescue SystemCallError
|
24
|
+
# If the file has disappeared, assume that means don't restart
|
25
|
+
else
|
26
|
+
if mtime > orig
|
27
|
+
launcher.restart
|
28
|
+
break
|
29
|
+
end
|
18
30
|
end
|
19
31
|
end
|
20
32
|
end
|