puma-daemon 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/codecov.yml ADDED
@@ -0,0 +1,4 @@
1
+ comment:
2
+ layout: "reach,diff,flags,tree,betaprofiling"
3
+ show_critical_paths: true
4
+
data/example/config.ru CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # config.ru
2
- run Proc.new { |_env| ['200', {'Content-Type' => 'text/html'}, ['Hello World']] }
4
+ run(proc { |*| ['200', { 'Content-Type' => 'text/html' }, ['Hello World']] })
3
5
  # run this with rackup command
data/example/puma.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puma/daemon'
2
4
 
3
5
  # The directory to operate out of.
@@ -34,7 +36,7 @@ bind 'tcp://0.0.0.0:9292'
34
36
  # Instead of “bind 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert'” you
35
37
  # can also use the “ssl_bind” option.
36
38
 
37
- # ssl_bind '127.0.0.1', '9292', { key: path_to_key, cert: path_to_cert }
39
+ # ssl_bind '127.0.0.1', '9292', { key: path_to_key, cert: path_to_cert }
38
40
 
39
41
  # Code to run before doing a restart. This code should
40
42
  # close log files, database connections, etc.
@@ -71,6 +73,6 @@ workers 2
71
73
  # Check out https://github.com/puma/puma/blob/master/lib/puma/app/status.rb
72
74
  # to see what the app has available.
73
75
 
74
- #activate_control_app 'unix:///var/run/pumactl.sock'
76
+ # activate_control_app 'unix:///var/run/pumactl.sock'
75
77
 
76
78
  daemonize
data/exe/pumad CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  # vim: ft=ruby
4
5
 
5
6
  lib_path = File.expand_path("#{File.dirname(__FILE__)}/../lib")
@@ -5,32 +5,44 @@ require_relative 'version'
5
5
  module Puma
6
6
  module Daemon
7
7
  module RunnerAdapter
8
- attr_reader :options
9
- attr_accessor :has_demonized
10
-
11
- def output_header(mode)
12
- super(mode)
13
-
14
- daemonize! if daemon?
15
- end
16
-
17
- def daemon?
18
- options[:daemon]
19
- end
20
-
21
- def daemonize!
22
- return if has_demonized
23
-
24
- log '* Puma Daemon: Demonizing...'
25
- log "* Gem: puma-daemon v#{::Puma::Daemon::VERSION}"
26
- log "* Gem: puma v#{::Puma::Const::VERSION}"
27
-
28
- Process.daemon(true, true)
29
- self.has_demonized = true
30
- end
31
-
32
- def log(str)
33
- super(str) unless str == 'Use Ctrl-C to stop'
8
+ class << self
9
+ def included(base)
10
+ base.class_eval do
11
+ attr_reader :options
12
+ attr_accessor :has_demonized
13
+ end
14
+
15
+ base.class_eval do
16
+ def output_header(mode)
17
+ super(mode)
18
+
19
+ daemonize! if daemon?
20
+ end
21
+
22
+ def daemon?
23
+ options[:daemon]
24
+ end
25
+
26
+ def daemonize!
27
+ return if has_demonized
28
+
29
+ log '* Puma Daemon: Demonizing...'
30
+ log "* Gem: puma-daemon v#{::Puma::Daemon::VERSION}"
31
+ log "* Gem: puma v#{::Puma::Const::VERSION}"
32
+
33
+ Process.daemon(true, true)
34
+ self.has_demonized = true
35
+ end
36
+
37
+ def log(str)
38
+ if super.respond_to?(:log)
39
+ super(str) unless str == 'Use Ctrl-C to stop'
40
+ else
41
+ puts(str)
42
+ end
43
+ end
44
+ end
45
+ end
34
46
  end
35
47
  end
36
48
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Puma
4
4
  module Daemon
5
- VERSION = '0.2.2'
5
+ VERSION = '0.3.0'
6
6
  end
7
7
  end
data/puma-daemon.gemspec CHANGED
@@ -11,19 +11,17 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = "Restore somewhat Puma's ability to self-daemonize, since Puma 5.0 dropped it"
12
12
  spec.description = <<~DESCRIPTION
13
13
 
14
- In version 5.0 the authors of the popular Ruby web server Puma chose
15
- to remove the daemonization support from Puma, because the code wasn't wall maintained,
16
- and because other and perhaps better options exist (such as systemd, etc), not to
17
- mention many people have switched to Kubernetes and Docker, where you want to start
18
- all servers on the foreground.
14
+ In version 5.0 the authors of the popular Ruby web server Puma chose to remove the
15
+ daemonization support from Puma, because the code wasn't wall maintained,
16
+ and because other and better options exist for production deployments. For example
17
+ systemd, Docker/Kubernetes, Heroku, etc.
19
18
 
20
- And yet, something useful and simple got lost in our humble opinion. Some folks were
21
- indeed happily using the `--daemonize` feature until in 5.0 they got an error that this flag is
22
- not supported.
19
+ Having said that, it was neat and often useful to daemonize Puma in development.
20
+ This gem adds this support to Puma 5 & 6 (hopefully) without breaking anything in Puma
21
+ itself.
23
22
 
24
- So, if you want to use the latest and greatest Puma 5+, but have it self-daemonize,
25
- this gem is for you. Just use *pumad* binary instead of *puma*, or require 'puma/daemon' inside
26
- your config file.
23
+ So, if you want to use the latest and greatest Puma 5+, but prefer to keep using built-in
24
+ daemonization, this gem if for you.
27
25
  DESCRIPTION
28
26
 
29
27
  spec.homepage = 'https://github.com/kigster/puma-daemon'
@@ -33,7 +31,7 @@ Gem::Specification.new do |spec|
33
31
 
34
32
  spec.metadata['homepage_uri'] = spec.homepage
35
33
  spec.metadata['source_code_uri'] = 'https://github.com/kigster/puma-daemon'
36
- spec.metadata['changelog_uri'] = 'https://github.com/kigster/puma-daemon/master/CHANAGELOG.md'
34
+ spec.metadata['changelog_uri'] = 'https://github.com/kigster/puma-daemon/blob/master/CHANGELOG.md'
37
35
 
38
36
  # Specify which files should be added to the gem when it is released.
39
37
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -50,15 +48,14 @@ Gem::Specification.new do |spec|
50
48
 
51
49
  spec.add_development_dependency 'asciidoctor'
52
50
  spec.add_development_dependency 'codecov'
51
+ spec.add_development_dependency 'httparty'
53
52
  spec.add_development_dependency 'relaxed-rubocop'
54
53
  spec.add_development_dependency 'rspec-its'
55
54
  spec.add_development_dependency 'rubocop'
56
55
  spec.add_development_dependency 'simplecov'
57
56
  spec.add_development_dependency 'yard'
58
57
 
59
- # Uncomment to register a new dependency of your gem
60
- # spec.add_dependency "example-gem", "~> 1.0"
61
-
62
58
  # For more information and examples about making a new gem, checkout our
63
59
  # guide at: https://bundler.io/guides/creating_gem.html
60
+ spec.metadata['rubygems_mfa_required'] = 'true'
64
61
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma-daemon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Gredeskoul
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-07 00:00:00.000000000 Z
11
+ date: 2023-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puma
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: httparty
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: relaxed-rubocop
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -136,16 +150,14 @@ dependencies:
136
150
  - - ">="
137
151
  - !ruby/object:Gem::Version
138
152
  version: '0'
139
- description: "\nIn version 5.0 the authors of the popular Ruby web server Puma chose\nto
140
- remove the daemonization support from Puma, because the code wasn't wall maintained,
141
- \nand because other and perhaps better options exist (such as systemd, etc), not
142
- to \nmention many people have switched to Kubernetes and Docker, where you want
143
- to start \nall servers on the foreground.\n\nAnd yet, something useful and simple
144
- got lost in our humble opinion. Some folks were \nindeed happily using the `--daemonize`
145
- feature until in 5.0 they got an error that this flag is \nnot supported.\n\nSo,
146
- if you want to use the latest and greatest Puma 5+, but have it self-daemonize,
147
- \nthis gem is for you. Just use *pumad* binary instead of *puma*, or require 'puma/daemon'
148
- inside\nyour config file.\n"
153
+ description: "\nIn version 5.0 the authors of the popular Ruby web server Puma chose
154
+ to remove the \ndaemonization support from Puma, because the code wasn't wall maintained,\nand
155
+ because other and better options exist for production deployments. For example\nsystemd,
156
+ Docker/Kubernetes, Heroku, etc. \n\nHaving said that, it was neat and often useful
157
+ to daemonize Puma in development.\nThis gem adds this support to Puma 5 & 6 (hopefully)
158
+ without breaking anything in Puma\nitself.\n\nSo, if you want to use the latest
159
+ and greatest Puma 5+, but prefer to keep using built-in\ndaemonization, this gem
160
+ if for you.\n"
149
161
  email:
150
162
  - kigster@gmail.com
151
163
  executables:
@@ -167,9 +179,11 @@ files:
167
179
  - LICENSE.txt
168
180
  - Makefile
169
181
  - README.adoc
182
+ - README.pdf
170
183
  - Rakefile
171
184
  - bin/console
172
185
  - bin/setup
186
+ - codecov.yml
173
187
  - config/puma_cluster.rb
174
188
  - config/puma_single.rb
175
189
  - example/cluster.sh
@@ -191,7 +205,8 @@ licenses:
191
205
  metadata:
192
206
  homepage_uri: https://github.com/kigster/puma-daemon
193
207
  source_code_uri: https://github.com/kigster/puma-daemon
194
- changelog_uri: https://github.com/kigster/puma-daemon/master/CHANAGELOG.md
208
+ changelog_uri: https://github.com/kigster/puma-daemon/blob/master/CHANGELOG.md
209
+ rubygems_mfa_required: 'true'
195
210
  post_install_message:
196
211
  rdoc_options: []
197
212
  require_paths:
@@ -207,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
207
222
  - !ruby/object:Gem::Version
208
223
  version: '0'
209
224
  requirements: []
210
- rubygems_version: 3.3.26
225
+ rubygems_version: 3.3.22
211
226
  signing_key:
212
227
  specification_version: 4
213
228
  summary: Restore somewhat Puma's ability to self-daemonize, since Puma 5.0 dropped