rails-nginx 1.0.5 → 1.1.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 +7 -0
- data/lib/puma/plugin/hooks_wrapper.rb +41 -0
- data/lib/puma/plugin/rails_nginx.rb +11 -10
- data/lib/rails/nginx/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f8d5a194f3c4e13cf96afe0ff92032d147bdf1b1547eb2005b8179f5c416f9ae
|
|
4
|
+
data.tar.gz: 92f5b4f5c6e4a555c275168a2b2c26a66ac12b7e3ade54469fab424d202b0bd9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cef88d4facf475fa212f1dbb16ed0011061b5eb541efa8cb9ece8400d644c9f235097142156471ad8f9fd1443e025c4cebb0436f439046d7cb866d4e031f38b6
|
|
7
|
+
data.tar.gz: 1f3d3669700f109d9e9ab0f5ef28a34a52b7bd808d06df4c5b435982f82cf6169f3a0f8af70959f4a45b2ddc1b60d00554f2e6deab5f0634d1c7ef087a7fd896
|
data/README.md
CHANGED
|
@@ -180,6 +180,13 @@ Run the Standard Ruby linter, and RSpec test suite.
|
|
|
180
180
|
bundle exec rake
|
|
181
181
|
```
|
|
182
182
|
|
|
183
|
+
**OR**
|
|
184
|
+
|
|
185
|
+
Run the rake task through [Appraisal](https://github.com/thoughtbot/appraisal) to test against many Puma versions.
|
|
186
|
+
```
|
|
187
|
+
bundle exec appraisal rake
|
|
188
|
+
```
|
|
189
|
+
|
|
183
190
|
#### Generating a new Dummy server
|
|
184
191
|
|
|
185
192
|
There's a built-in executable if you'd like to generate a new Dummy server to upgrade the regression tests to work with the latest version of Rails.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
module HooksWrapper
|
|
2
|
+
def booted(config, &)
|
|
3
|
+
if new_hooks?
|
|
4
|
+
config.after_booted(&)
|
|
5
|
+
else
|
|
6
|
+
config.on_booted(&)
|
|
7
|
+
end
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def restarted(config, &)
|
|
11
|
+
if new_hooks?
|
|
12
|
+
config.before_restart(&)
|
|
13
|
+
else
|
|
14
|
+
config.on_restart(&)
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def stopped(config, &)
|
|
19
|
+
return unless stopped_hook?
|
|
20
|
+
|
|
21
|
+
if new_hooks?
|
|
22
|
+
config.after_stopped(&)
|
|
23
|
+
else
|
|
24
|
+
config.on_stopped(&)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
PUMA_VERSION = Gem::Version.new(Puma::Const::PUMA_VERSION)
|
|
31
|
+
|
|
32
|
+
def new_hooks?
|
|
33
|
+
# Puma renamed their hooks in v7.
|
|
34
|
+
Gem::Version.new("7.0.0") <= PUMA_VERSION
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def stopped_hook?
|
|
38
|
+
# Puma v6.5 added on_stopped.
|
|
39
|
+
Gem::Version.new("6.5.0") <= PUMA_VERSION
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "puma/plugin"
|
|
4
|
+
require_relative "hooks_wrapper"
|
|
4
5
|
require_relative "../../rails/nginx"
|
|
5
6
|
|
|
6
7
|
# The Puma team recommends this approach to extend the Puma DSL.
|
|
@@ -27,13 +28,15 @@ def rails_port!
|
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
Puma::Plugin.create do
|
|
31
|
+
include HooksWrapper
|
|
32
|
+
|
|
30
33
|
def config(puma_config)
|
|
31
34
|
rails_port!
|
|
32
35
|
|
|
33
36
|
puma_config.clear_binds!
|
|
34
37
|
puma_config.port Rails::Nginx.port
|
|
35
38
|
|
|
36
|
-
puma_config
|
|
39
|
+
booted(puma_config) do
|
|
37
40
|
if puma_config.rails_nginx_configs.empty?
|
|
38
41
|
Rails::Nginx.start!
|
|
39
42
|
else
|
|
@@ -43,7 +46,7 @@ Puma::Plugin.create do
|
|
|
43
46
|
end
|
|
44
47
|
end
|
|
45
48
|
|
|
46
|
-
puma_config
|
|
49
|
+
restarted(puma_config) do
|
|
47
50
|
if puma_config.rails_nginx_configs.empty?
|
|
48
51
|
Rails::Nginx.stop!
|
|
49
52
|
Rails::Nginx.start!
|
|
@@ -55,14 +58,12 @@ Puma::Plugin.create do
|
|
|
55
58
|
end
|
|
56
59
|
end
|
|
57
60
|
|
|
58
|
-
|
|
59
|
-
puma_config.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
Rails::Nginx.stop!(options)
|
|
65
|
-
end
|
|
61
|
+
stopped(puma_config) do
|
|
62
|
+
if puma_config.rails_nginx_configs.empty?
|
|
63
|
+
Rails::Nginx.stop!
|
|
64
|
+
else
|
|
65
|
+
puma_config.rails_nginx_configs.each_value do |options|
|
|
66
|
+
Rails::Nginx.stop!(options)
|
|
66
67
|
end
|
|
67
68
|
end
|
|
68
69
|
end
|
data/lib/rails/nginx/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails-nginx
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bert McCutchen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-10-28 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: puma
|
|
@@ -62,6 +62,7 @@ files:
|
|
|
62
62
|
- CHANGELOG.md
|
|
63
63
|
- LICENSE.txt
|
|
64
64
|
- README.md
|
|
65
|
+
- lib/puma/plugin/hooks_wrapper.rb
|
|
65
66
|
- lib/puma/plugin/rails_nginx.rb
|
|
66
67
|
- lib/rails/nginx.rb
|
|
67
68
|
- lib/rails/nginx/configuration.rb
|