bard-rails 0.4.1 → 0.4.2
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/.rspec +1 -0
- data/Gemfile +2 -0
- data/README.md +19 -0
- data/Rakefile +4 -1
- data/lib/bard/rails/puma_manifest.rb +36 -0
- data/lib/bard/rails/version.rb +1 -1
- data/lib/puma/plugin/bard_rails.rb +10 -0
- metadata +4 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cd074739d617f0b5e094353e74f41b98ed81a760dceb6415a541d262164bd965
|
|
4
|
+
data.tar.gz: 6e3ffaab8cfbf714c45d76b42da27033132416deaa737bcd02b90b8a07b82eef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c1dec730738e040b21073ce5f2a2151229329c21bc743a1eecc98c16d68eff310c9af3f2f2d26f599008e11b0ca202ca4bd7b5359346a10bbb75162529c81544
|
|
7
|
+
data.tar.gz: b3d78c5fc479ddb1875a94da43eaa626bbe6949c882e76940843af8f883e6498255f417a8069aa52ed1d47051ea619635ec5da1d0cf3ce590f5c6b34e60eb05e
|
data/.rspec
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--require spec_helper
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -12,6 +12,25 @@
|
|
|
12
12
|
* labelled_form: some nice label shortcuts for the Rails form builder
|
|
13
13
|
* rack-disable_css_animations: automatically remove CSS animations in the test environment, for more reliable tests
|
|
14
14
|
|
|
15
|
+
## Choosing how to restart Puma on deploy
|
|
16
|
+
|
|
17
|
+
A phased restart (USR1) has no user impact, but it keeps the Puma master, so it can't pick up a new Ruby, a new Puma, a changed `config/puma.rb`, or a new version of any gem the master loaded. To let the master record what it booted with, add this to `config/puma.rb`:
|
|
18
|
+
|
|
19
|
+
```ruby
|
|
20
|
+
extra_runtime_dependencies ["bard-rails"]
|
|
21
|
+
plugin :bard_rails
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Then ask which restart the deploy needs:
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
case Bard::RailsGem::PumaManifest.restart_kind
|
|
28
|
+
when :full then sh "systemctl --user restart app.target" # new Ruby, or no manifest yet
|
|
29
|
+
when :hot then sh "bin/server restart" # the master holds something that changed
|
|
30
|
+
when :phased then sh "systemctl --user reload app.target"
|
|
31
|
+
end
|
|
32
|
+
```
|
|
33
|
+
|
|
15
34
|
## Installation
|
|
16
35
|
|
|
17
36
|
Add this line to your application's Gemfile:
|
data/Rakefile
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "version"
|
|
4
|
+
|
|
5
|
+
module Bard
|
|
6
|
+
module RailsGem
|
|
7
|
+
# Written inside puma's pruned master, so it may only use what that master has already loaded.
|
|
8
|
+
module PumaManifest
|
|
9
|
+
MANIFEST = "tmp/pids/puma.manifest"
|
|
10
|
+
BOOTED_CONFIG = "tmp/pids/puma.rb.booted"
|
|
11
|
+
CONFIG = "config/puma.rb"
|
|
12
|
+
private_constant :MANIFEST, :BOOTED_CONFIG, :CONFIG
|
|
13
|
+
|
|
14
|
+
def self.write
|
|
15
|
+
held = Gem.loaded_specs.to_h { |name, spec| [name, spec.version.to_s] }
|
|
16
|
+
held["puma"] = Puma::Const::PUMA_VERSION
|
|
17
|
+
held["nio4r"] = NIO::VERSION if defined?(NIO::VERSION)
|
|
18
|
+
held["bard-rails"] = VERSION
|
|
19
|
+
held["ruby"] = RUBY_VERSION
|
|
20
|
+
File.write MANIFEST, held.map { |name, version| "#{name} #{version}\n" }.join
|
|
21
|
+
File.write BOOTED_CONFIG, File.read(CONFIG)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.restart_kind(locked: Bundler.locked_gems.specs.to_h { |spec| [spec.name, spec.version.to_s] }, ruby: RUBY_VERSION)
|
|
25
|
+
return :full unless File.exist?(MANIFEST) && File.exist?(BOOTED_CONFIG)
|
|
26
|
+
|
|
27
|
+
held = File.readlines(MANIFEST, chomp: true).to_h(&:split)
|
|
28
|
+
return :full if held.fetch("ruby") != ruby
|
|
29
|
+
return :hot if File.read(BOOTED_CONFIG) != File.read(CONFIG)
|
|
30
|
+
return :hot if held.any? { |name, version| locked.fetch(name, version) != version }
|
|
31
|
+
|
|
32
|
+
:phased
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
data/lib/bard/rails/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bard-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Micah Geisel
|
|
@@ -183,6 +183,7 @@ executables: []
|
|
|
183
183
|
extensions: []
|
|
184
184
|
extra_rdoc_files: []
|
|
185
185
|
files:
|
|
186
|
+
- ".rspec"
|
|
186
187
|
- Gemfile
|
|
187
188
|
- LICENSE.txt
|
|
188
189
|
- README.md
|
|
@@ -192,9 +193,11 @@ files:
|
|
|
192
193
|
- bin/setup
|
|
193
194
|
- lib/bard-rails.rb
|
|
194
195
|
- lib/bard/rails.rb
|
|
196
|
+
- lib/bard/rails/puma_manifest.rb
|
|
195
197
|
- lib/bard/rails/railtie.rb
|
|
196
198
|
- lib/bard/rails/test_storage.rb
|
|
197
199
|
- lib/bard/rails/version.rb
|
|
200
|
+
- lib/puma/plugin/bard_rails.rb
|
|
198
201
|
homepage: https://github.com/botandrose/bard-rails
|
|
199
202
|
licenses:
|
|
200
203
|
- MIT
|