puma 2.16.0 → 3.11.4

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.
Files changed (78) hide show
  1. checksums.yaml +5 -5
  2. data/{History.txt → History.md} +489 -70
  3. data/README.md +143 -174
  4. data/docs/architecture.md +36 -0
  5. data/{DEPLOYMENT.md → docs/deployment.md} +1 -1
  6. data/docs/images/puma-connection-flow-no-reactor.png +0 -0
  7. data/docs/images/puma-connection-flow.png +0 -0
  8. data/docs/images/puma-general-arch.png +0 -0
  9. data/docs/nginx.md +2 -2
  10. data/docs/plugins.md +28 -0
  11. data/docs/restart.md +39 -0
  12. data/docs/signals.md +56 -3
  13. data/docs/systemd.md +272 -0
  14. data/ext/puma_http11/extconf.rb +2 -0
  15. data/ext/puma_http11/http11_parser.c +291 -447
  16. data/ext/puma_http11/http11_parser.h +1 -0
  17. data/ext/puma_http11/http11_parser.java.rl +5 -5
  18. data/ext/puma_http11/http11_parser.rl +10 -9
  19. data/ext/puma_http11/http11_parser_common.rl +1 -1
  20. data/ext/puma_http11/io_buffer.c +8 -8
  21. data/ext/puma_http11/mini_ssl.c +64 -6
  22. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +113 -131
  23. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +9 -2
  24. data/ext/puma_http11/puma_http11.c +1 -0
  25. data/lib/puma/app/status.rb +9 -1
  26. data/lib/puma/binder.rb +90 -38
  27. data/lib/puma/cli.rb +134 -491
  28. data/lib/puma/client.rb +142 -4
  29. data/lib/puma/cluster.rb +132 -76
  30. data/lib/puma/commonlogger.rb +19 -20
  31. data/lib/puma/compat.rb +3 -7
  32. data/lib/puma/configuration.rb +206 -67
  33. data/lib/puma/const.rb +21 -31
  34. data/lib/puma/control_cli.rb +92 -103
  35. data/lib/puma/convenient.rb +23 -0
  36. data/lib/puma/daemon_ext.rb +6 -0
  37. data/lib/puma/detect.rb +10 -1
  38. data/lib/puma/dsl.rb +203 -45
  39. data/lib/puma/events.rb +22 -13
  40. data/lib/puma/io_buffer.rb +1 -1
  41. data/lib/puma/jruby_restart.rb +1 -2
  42. data/lib/puma/launcher.rb +431 -0
  43. data/lib/puma/minissl.rb +83 -4
  44. data/lib/puma/null_io.rb +19 -11
  45. data/lib/puma/plugin/tmp_restart.rb +34 -0
  46. data/lib/puma/plugin.rb +115 -0
  47. data/lib/puma/rack/backports/uri/common_193.rb +17 -13
  48. data/lib/puma/rack/builder.rb +3 -0
  49. data/lib/puma/rack/urlmap.rb +9 -8
  50. data/lib/puma/reactor.rb +18 -0
  51. data/lib/puma/runner.rb +43 -15
  52. data/lib/puma/server.rb +141 -35
  53. data/lib/puma/single.rb +16 -6
  54. data/lib/puma/state_file.rb +29 -0
  55. data/lib/puma/tcp_logger.rb +8 -1
  56. data/lib/puma/thread_pool.rb +60 -10
  57. data/lib/puma/util.rb +1 -5
  58. data/lib/puma.rb +13 -4
  59. data/lib/rack/handler/puma.rb +76 -29
  60. data/tools/jungle/README.md +12 -2
  61. data/tools/jungle/init.d/README.md +9 -2
  62. data/tools/jungle/init.d/puma +86 -59
  63. data/tools/jungle/init.d/run-puma +16 -1
  64. data/tools/jungle/rc.d/README.md +74 -0
  65. data/tools/jungle/rc.d/puma +61 -0
  66. data/tools/jungle/rc.d/puma.conf +10 -0
  67. data/tools/jungle/upstart/puma.conf +1 -1
  68. data/tools/trickletest.rb +1 -1
  69. metadata +28 -95
  70. data/COPYING +0 -55
  71. data/Gemfile +0 -13
  72. data/Manifest.txt +0 -74
  73. data/Rakefile +0 -158
  74. data/docs/config.md +0 -0
  75. data/lib/puma/capistrano.rb +0 -94
  76. data/lib/puma/rack/backports/uri/common_18.rb +0 -56
  77. data/lib/puma/rack/backports/uri/common_192.rb +0 -52
  78. data/puma.gemspec +0 -52
metadata CHANGED
@@ -1,81 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.16.0
4
+ version: 3.11.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Phoenix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-28 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: rdoc
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '4.0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '4.0'
27
- - !ruby/object:Gem::Dependency
28
- name: rack
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '1.1'
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: '2.0'
37
- type: :development
38
- prerelease: false
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: '1.1'
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: '2.0'
47
- - !ruby/object:Gem::Dependency
48
- name: rake-compiler
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: '0.8'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
- requirements:
58
- - - "~>"
59
- - !ruby/object:Gem::Version
60
- version: '0.8'
61
- - !ruby/object:Gem::Dependency
62
- name: hoe
63
- requirement: !ruby/object:Gem::Requirement
64
- requirements:
65
- - - "~>"
66
- - !ruby/object:Gem::Version
67
- version: '3.14'
68
- type: :development
69
- prerelease: false
70
- version_requirements: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - "~>"
73
- - !ruby/object:Gem::Version
74
- version: '3.14'
11
+ date: 2018-04-12 00:00:00.000000000 Z
12
+ dependencies: []
75
13
  description: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server
76
14
  for Ruby/Rack applications. Puma is intended for use in both development and production
77
- environments. In order to get the best throughput, it is highly recommended that
78
- you use a Ruby implementation with real threads like Rubinius or JRuby.
15
+ environments. It's great for highly concurrent Ruby implementations such as Rubinius
16
+ and JRuby as well as as providing process worker support to support CRuby well.
79
17
  email:
80
18
  - evan@phx.io
81
19
  executables:
@@ -83,32 +21,24 @@ executables:
83
21
  - pumactl
84
22
  extensions:
85
23
  - ext/puma_http11/extconf.rb
86
- extra_rdoc_files:
87
- - DEPLOYMENT.md
88
- - History.txt
89
- - Manifest.txt
90
- - README.md
91
- - docs/config.md
92
- - docs/nginx.md
93
- - docs/signals.md
94
- - tools/jungle/README.md
95
- - tools/jungle/init.d/README.md
96
- - tools/jungle/upstart/README.md
24
+ extra_rdoc_files: []
97
25
  files:
98
- - COPYING
99
- - DEPLOYMENT.md
100
- - Gemfile
101
- - History.txt
26
+ - History.md
102
27
  - LICENSE
103
- - Manifest.txt
104
28
  - README.md
105
- - Rakefile
106
29
  - bin/puma
107
30
  - bin/puma-wild
108
31
  - bin/pumactl
109
- - docs/config.md
32
+ - docs/architecture.md
33
+ - docs/deployment.md
34
+ - docs/images/puma-connection-flow-no-reactor.png
35
+ - docs/images/puma-connection-flow.png
36
+ - docs/images/puma-general-arch.png
110
37
  - docs/nginx.md
38
+ - docs/plugins.md
39
+ - docs/restart.md
111
40
  - docs/signals.md
41
+ - docs/systemd.md
112
42
  - ext/puma_http11/PumaHttp11Service.java
113
43
  - ext/puma_http11/ext_help.h
114
44
  - ext/puma_http11/extconf.rb
@@ -127,7 +57,6 @@ files:
127
57
  - lib/puma/accept_nonblock.rb
128
58
  - lib/puma/app/status.rb
129
59
  - lib/puma/binder.rb
130
- - lib/puma/capistrano.rb
131
60
  - lib/puma/cli.rb
132
61
  - lib/puma/client.rb
133
62
  - lib/puma/cluster.rb
@@ -136,6 +65,7 @@ files:
136
65
  - lib/puma/configuration.rb
137
66
  - lib/puma/const.rb
138
67
  - lib/puma/control_cli.rb
68
+ - lib/puma/convenient.rb
139
69
  - lib/puma/daemon_ext.rb
140
70
  - lib/puma/delegation.rb
141
71
  - lib/puma/detect.rb
@@ -144,10 +74,11 @@ files:
144
74
  - lib/puma/io_buffer.rb
145
75
  - lib/puma/java_io_buffer.rb
146
76
  - lib/puma/jruby_restart.rb
77
+ - lib/puma/launcher.rb
147
78
  - lib/puma/minissl.rb
148
79
  - lib/puma/null_io.rb
149
- - lib/puma/rack/backports/uri/common_18.rb
150
- - lib/puma/rack/backports/uri/common_192.rb
80
+ - lib/puma/plugin.rb
81
+ - lib/puma/plugin/tmp_restart.rb
151
82
  - lib/puma/rack/backports/uri/common_193.rb
152
83
  - lib/puma/rack/builder.rb
153
84
  - lib/puma/rack/urlmap.rb
@@ -156,15 +87,18 @@ files:
156
87
  - lib/puma/runner.rb
157
88
  - lib/puma/server.rb
158
89
  - lib/puma/single.rb
90
+ - lib/puma/state_file.rb
159
91
  - lib/puma/tcp_logger.rb
160
92
  - lib/puma/thread_pool.rb
161
93
  - lib/puma/util.rb
162
94
  - lib/rack/handler/puma.rb
163
- - puma.gemspec
164
95
  - tools/jungle/README.md
165
96
  - tools/jungle/init.d/README.md
166
97
  - tools/jungle/init.d/puma
167
98
  - tools/jungle/init.d/run-puma
99
+ - tools/jungle/rc.d/README.md
100
+ - tools/jungle/rc.d/puma
101
+ - tools/jungle/rc.d/puma.conf
168
102
  - tools/jungle/upstart/README.md
169
103
  - tools/jungle/upstart/puma-manager.conf
170
104
  - tools/jungle/upstart/puma.conf
@@ -172,18 +106,17 @@ files:
172
106
  homepage: http://puma.io
173
107
  licenses:
174
108
  - BSD-3-Clause
175
- metadata: {}
109
+ metadata:
110
+ msys2_mingw_dependencies: openssl
176
111
  post_install_message:
177
- rdoc_options:
178
- - "--main"
179
- - README.md
112
+ rdoc_options: []
180
113
  require_paths:
181
114
  - lib
182
115
  required_ruby_version: !ruby/object:Gem::Requirement
183
116
  requirements:
184
117
  - - ">="
185
118
  - !ruby/object:Gem::Version
186
- version: 1.8.7
119
+ version: 1.9.3
187
120
  required_rubygems_version: !ruby/object:Gem::Requirement
188
121
  requirements:
189
122
  - - ">="
@@ -191,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
124
  version: '0'
192
125
  requirements: []
193
126
  rubyforge_project:
194
- rubygems_version: 2.5.1
127
+ rubygems_version: 2.7.6
195
128
  signing_key:
196
129
  specification_version: 4
197
130
  summary: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for
data/COPYING DELETED
@@ -1,55 +0,0 @@
1
- Mongrel Web Server (Mongrel) is copyrighted free software by Zed A. Shaw
2
- <zedshaw at zedshaw dot com> You can redistribute it and/or modify it under
3
- either the terms of the GPL or the conditions below:
4
-
5
- 1. You may make and give away verbatim copies of the source form of the
6
- software without restriction, provided that you duplicate all of the
7
- original copyright notices and associated disclaimers.
8
-
9
- 2. You may modify your copy of the software in any way, provided that
10
- you do at least ONE of the following:
11
-
12
- a) place your modifications in the Public Domain or otherwise make them
13
- Freely Available, such as by posting said modifications to Usenet or an
14
- equivalent medium, or by allowing the author to include your
15
- modifications in the software.
16
-
17
- b) use the modified software only within your corporation or
18
- organization.
19
-
20
- c) rename any non-standard executables so the names do not conflict with
21
- standard executables, which must also be provided.
22
-
23
- d) make other distribution arrangements with the author.
24
-
25
- 3. You may distribute the software in object code or executable
26
- form, provided that you do at least ONE of the following:
27
-
28
- a) distribute the executables and library files of the software,
29
- together with instructions (in the manual page or equivalent) on where
30
- to get the original distribution.
31
-
32
- b) accompany the distribution with the machine-readable source of the
33
- software.
34
-
35
- c) give non-standard executables non-standard names, with
36
- instructions on where to get the original software distribution.
37
-
38
- d) make other distribution arrangements with the author.
39
-
40
- 4. You may modify and include the part of the software into any other
41
- software (possibly commercial). But some files in the distribution
42
- are not written by the author, so that they are not under this terms.
43
-
44
- 5. The scripts and library files supplied as input to or produced as
45
- output from the software do not automatically fall under the
46
- copyright of the software, but belong to whomever generated them,
47
- and may be sold commercially, and may be aggregated with this
48
- software.
49
-
50
- 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
51
- IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
52
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
53
- PURPOSE.
54
-
55
-
data/Gemfile DELETED
@@ -1,13 +0,0 @@
1
- source "http://rubygems.org"
2
-
3
- gem "hoe"
4
- gem "hoe-git"
5
- gem "hoe-ignore"
6
- gem "rdoc"
7
- gem "rake-compiler"
8
- gem "test-unit", "~> 3.0"
9
-
10
- gem "rack"
11
- gem 'minitest', '~> 4.0'
12
-
13
- gem "jruby-openssl", :platform => "jruby"
data/Manifest.txt DELETED
@@ -1,74 +0,0 @@
1
- COPYING
2
- DEPLOYMENT.md
3
- Gemfile
4
- History.txt
5
- LICENSE
6
- Manifest.txt
7
- README.md
8
- Rakefile
9
- bin/puma
10
- bin/puma-wild
11
- bin/pumactl
12
- docs/config.md
13
- docs/nginx.md
14
- docs/signals.md
15
- ext/puma_http11/PumaHttp11Service.java
16
- ext/puma_http11/ext_help.h
17
- ext/puma_http11/extconf.rb
18
- ext/puma_http11/http11_parser.c
19
- ext/puma_http11/http11_parser.h
20
- ext/puma_http11/http11_parser.java.rl
21
- ext/puma_http11/http11_parser.rl
22
- ext/puma_http11/http11_parser_common.rl
23
- ext/puma_http11/io_buffer.c
24
- ext/puma_http11/mini_ssl.c
25
- ext/puma_http11/org/jruby/puma/Http11.java
26
- ext/puma_http11/org/jruby/puma/Http11Parser.java
27
- ext/puma_http11/org/jruby/puma/MiniSSL.java
28
- ext/puma_http11/puma_http11.c
29
- lib/puma.rb
30
- lib/puma/accept_nonblock.rb
31
- lib/puma/app/status.rb
32
- lib/puma/binder.rb
33
- lib/puma/capistrano.rb
34
- lib/puma/cli.rb
35
- lib/puma/client.rb
36
- lib/puma/cluster.rb
37
- lib/puma/commonlogger.rb
38
- lib/puma/compat.rb
39
- lib/puma/configuration.rb
40
- lib/puma/const.rb
41
- lib/puma/control_cli.rb
42
- lib/puma/daemon_ext.rb
43
- lib/puma/delegation.rb
44
- lib/puma/detect.rb
45
- lib/puma/dsl.rb
46
- lib/puma/events.rb
47
- lib/puma/io_buffer.rb
48
- lib/puma/java_io_buffer.rb
49
- lib/puma/jruby_restart.rb
50
- lib/puma/minissl.rb
51
- lib/puma/null_io.rb
52
- lib/puma/rack/backports/uri/common_18.rb
53
- lib/puma/rack/backports/uri/common_192.rb
54
- lib/puma/rack/backports/uri/common_193.rb
55
- lib/puma/rack/builder.rb
56
- lib/puma/rack/urlmap.rb
57
- lib/puma/rack_default.rb
58
- lib/puma/reactor.rb
59
- lib/puma/runner.rb
60
- lib/puma/server.rb
61
- lib/puma/single.rb
62
- lib/puma/tcp_logger.rb
63
- lib/puma/thread_pool.rb
64
- lib/puma/util.rb
65
- lib/rack/handler/puma.rb
66
- puma.gemspec
67
- tools/jungle/README.md
68
- tools/jungle/init.d/README.md
69
- tools/jungle/init.d/puma
70
- tools/jungle/init.d/run-puma
71
- tools/jungle/upstart/README.md
72
- tools/jungle/upstart/puma-manager.conf
73
- tools/jungle/upstart/puma.conf
74
- tools/trickletest.rb
data/Rakefile DELETED
@@ -1,158 +0,0 @@
1
- require "hoe"
2
- require "rake/extensiontask"
3
- require "rake/javaextensiontask"
4
-
5
- IS_JRUBY = defined?(RUBY_ENGINE) ? RUBY_ENGINE == "jruby" : false
6
-
7
- Hoe.plugin :git
8
- Hoe.plugin :ignore
9
-
10
- HOE = Hoe.spec "puma" do
11
- self.readme_file = "README.md"
12
- self.urls = %w!http://puma.io https://github.com/puma/puma!
13
-
14
- license "BSD-3-Clause"
15
- developer 'Evan Phoenix', 'evan@phx.io'
16
-
17
- spec_extras[:extensions] = ["ext/puma_http11/extconf.rb"]
18
- spec_extras[:executables] = ['puma', 'pumactl']
19
- spec_extras[:homepage] = self.urls.first
20
-
21
- require_ruby_version ">= 1.8.7"
22
-
23
- dependency "rack", [">= 1.1", "< 2.0"], :development
24
-
25
- extra_dev_deps << ["rake-compiler", "~> 0.8"]
26
- end
27
-
28
- task :prerelease => [:clobber, :check_manifest, :test]
29
-
30
- # hoe/test and rake-compiler don't seem to play well together, so disable
31
- # hoe/test's .gemtest touch file thingy for now
32
- HOE.spec.files -= [".gemtest"]
33
-
34
- include Hoe::Git
35
-
36
- desc "Print the current changelog."
37
- task "changelog" do
38
- tag = ENV["FROM"] || git_tags.last
39
- range = [tag, "HEAD"].compact.join ".."
40
- cmd = "git log #{range} '--format=tformat:%B|||%aN|||%aE|||'"
41
- now = Time.new.strftime "%Y-%m-%d"
42
-
43
- changes = `#{cmd}`.split(/\|\|\|/).each_slice(3).map { |msg, author, email|
44
- msg.split(/\n/).reject { |s| s.empty? }.first
45
- }.flatten.compact
46
-
47
- $changes = Hash.new { |h,k| h[k] = [] }
48
-
49
- codes = {
50
- "!" => :major,
51
- "+" => :minor,
52
- "*" => :minor,
53
- "-" => :bug,
54
- "?" => :unknown,
55
- }
56
-
57
- codes_re = Regexp.escape codes.keys.join
58
-
59
- changes.each do |change|
60
- if change =~ /^\s*([#{codes_re}])\s*(.*)/ then
61
- code, line = codes[$1], $2
62
- else
63
- code, line = codes["?"], change.chomp
64
- end
65
-
66
- $changes[code] << line
67
- end
68
-
69
- puts "=== #{ENV['VERSION'] || 'NEXT'} / #{now}"
70
- puts
71
- changelog_section :major
72
- changelog_section :minor
73
- changelog_section :bug
74
- changelog_section :unknown
75
- puts
76
- end
77
-
78
- # generate extension code using Ragel (C and Java)
79
- desc "Generate extension code (C and Java) using Ragel"
80
- task :ragel
81
-
82
- file 'ext/puma_http11/http11_parser.c' => ['ext/puma_http11/http11_parser.rl'] do |t|
83
- begin
84
- sh "ragel #{t.prerequisites.last} -C -G2 -I ext/puma_http11 -o #{t.name}"
85
- rescue
86
- fail "Could not build wrapper using Ragel (it failed or not installed?)"
87
- end
88
- end
89
- task :ragel => ['ext/puma_http11/http11_parser.c']
90
-
91
- file 'ext/puma_http11/org/jruby/puma/Http11Parser.java' => ['ext/puma_http11/http11_parser.java.rl'] do |t|
92
- begin
93
- sh "ragel #{t.prerequisites.last} -J -G2 -I ext/puma_http11 -o #{t.name}"
94
- rescue
95
- fail "Could not build wrapper using Ragel (it failed or not installed?)"
96
- end
97
- end
98
- task :ragel => ['ext/puma_http11/org/jruby/puma/Http11Parser.java']
99
-
100
- if !IS_JRUBY
101
-
102
- # compile extensions using rake-compiler
103
- # C (MRI, Rubinius)
104
- Rake::ExtensionTask.new("puma_http11", HOE.spec) do |ext|
105
- # place extension inside namespace
106
- ext.lib_dir = "lib/puma"
107
-
108
- ext.cross_compile = true
109
- ext.cross_platform = ['i386-mswin32-60', 'i386-mingw32']
110
- ext.cross_compiling do |spec|
111
- # add fat-binary stub only when cross compiling
112
- spec.files << "lib/puma/puma_http11.rb"
113
- end
114
-
115
- CLEAN.include "lib/puma/{1.8,1.9}"
116
- CLEAN.include "lib/puma/puma_http11.rb"
117
- end
118
-
119
- else
120
-
121
- # Java (JRuby)
122
- Rake::JavaExtensionTask.new("puma_http11", HOE.spec) do |ext|
123
- ext.lib_dir = "lib/puma"
124
- end
125
-
126
- end
127
-
128
- # the following is a fat-binary stub that will be used when
129
- # require 'puma/puma_http11' and will use either 1.8 or 1.9 version depending
130
- # on RUBY_VERSION
131
- file "lib/puma/puma_http11.rb" do |t|
132
- File.open(t.name, "w") do |f|
133
- f.puts "RUBY_VERSION =~ /(\d+.\d+)/"
134
- f.puts 'require "puma/#{$1}/puma_http11"'
135
- end
136
- end
137
-
138
- # tests require extension be compiled, but depend on the platform
139
- if IS_JRUBY
140
- task :test => [:java]
141
- else
142
- task :test => [:compile]
143
- end
144
-
145
- namespace :test do
146
- desc "Run the integration tests"
147
- task :integration do
148
- sh "cd test/shell; sh run.sh"
149
- end
150
-
151
- desc "Run all tests"
152
- if defined?(JRUBY_VERSION) and ENV['TRAVIS']
153
- task :all => :test
154
- else
155
- task :all => [:test, "test:integration"]
156
- end
157
- end
158
-
data/docs/config.md DELETED
File without changes
@@ -1,94 +0,0 @@
1
- $stderr.puts "DEPRECATED: To manage puma with capistrano, use https://github.com/seuros/capistrano-puma"
2
-
3
- Capistrano::Configuration.instance.load do
4
-
5
- # Ensure the tmp/sockets directory is created by the deploy:setup task and
6
- # symlinked in by the deploy:update task. This is not handled by Capistrano
7
- # v2 but is fixed in v3.
8
- shared_children.push('tmp/sockets')
9
-
10
- _cset(:puma_default_hooks) { true }
11
- _cset(:puma_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec puma" }
12
- _cset(:pumactl_cmd) { "#{fetch(:bundle_cmd, 'bundle')} exec pumactl" }
13
- _cset(:puma_env) { fetch(:rack_env, fetch(:rails_env, 'production')) }
14
- _cset(:puma_state) { "#{shared_path}/sockets/puma.state" }
15
- _cset(:puma_socket) { "unix://#{shared_path}/sockets/puma.sock" }
16
- _cset(:puma_role) { :app }
17
-
18
- if fetch(:puma_default_hooks)
19
- after 'deploy:stop', 'puma:stop'
20
- after 'deploy:start', 'puma:start'
21
- after 'deploy:restart', 'puma:restart'
22
- end
23
-
24
- namespace :puma do
25
- desc 'Start puma'
26
- task :start, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
27
- run "cd #{current_path} && #{puma_rails_additional_env} #{puma_cmd} #{start_options}", :pty => false
28
- end
29
-
30
- desc 'Stop puma'
31
- task :stop, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
32
- run "cd #{current_path} && #{pumactl_cmd} -S #{state_path} stop"
33
- end
34
-
35
- desc 'Restart puma'
36
- task :restart, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
37
- begin
38
- run "cd #{current_path} && #{puma_rails_additional_env} #{pumactl_cmd} -S #{state_path} restart"
39
- rescue Capistrano::CommandError => ex
40
- puts "Failed to restart puma: #{ex}\nAssuming not started."
41
- start
42
- end
43
- end
44
-
45
- desc 'Restart puma (phased restart)'
46
- task :phased_restart, :roles => lambda { puma_role }, :on_no_matching_servers => :continue do
47
- begin
48
- run "cd #{current_path} && #{puma_rails_additional_env} #{pumactl_cmd} -S #{state_path} phased-restart"
49
- rescue Capistrano::CommandError => ex
50
- puts "Failed to restart puma: #{ex}\nAssuming not started."
51
- start
52
- end
53
- end
54
-
55
- end
56
-
57
- def start_options
58
- if config_file
59
- "-q -d -e #{puma_env} -C #{config_file}"
60
- else
61
- "-q -d -e #{puma_env} -b '#{puma_socket}' -S #{state_path} --control 'unix://#{shared_path}/sockets/pumactl.sock'"
62
- end
63
- end
64
-
65
- def config_file
66
- @_config_file ||= begin
67
- file = fetch(:puma_config_file, nil)
68
- file = "./config/puma/#{puma_env}.rb" if !file && File.exists?("./config/puma/#{puma_env}.rb")
69
- file
70
- end
71
- end
72
-
73
- def puma_env
74
- fetch(:rack_env, fetch(:rails_env, 'production'))
75
- end
76
-
77
- #add additional env when start rails, such as : secret key, db username, db pwd or other what you want.
78
- def puma_rails_additional_env
79
- fetch(:puma_rails_additional_env, '')
80
- end
81
-
82
- def state_path
83
- (config_file ? configuration.options[:state] : nil) || puma_state
84
- end
85
-
86
- def configuration
87
- require 'puma'
88
- require 'puma/configuration'
89
-
90
- config = Puma::Configuration.new(:config_file => config_file)
91
- config.load
92
- config
93
- end
94
- end
@@ -1,56 +0,0 @@
1
- # :stopdoc:
2
-
3
- # Stolen from ruby core's uri/common.rb, with modifications to support 1.8.x
4
- #
5
- # https://github.com/ruby/ruby/blob/trunk/lib/uri/common.rb
6
- #
7
- #
8
-
9
- module URI
10
- TBLENCWWWCOMP_ = {} # :nodoc:
11
- 256.times do |i|
12
- TBLENCWWWCOMP_[i.chr] = '%%%02X' % i
13
- end
14
- TBLENCWWWCOMP_[' '] = '+'
15
- TBLENCWWWCOMP_.freeze
16
- TBLDECWWWCOMP_ = {} # :nodoc:
17
- 256.times do |i|
18
- h, l = i>>4, i&15
19
- TBLDECWWWCOMP_['%%%X%X' % [h, l]] = i.chr
20
- TBLDECWWWCOMP_['%%%x%X' % [h, l]] = i.chr
21
- TBLDECWWWCOMP_['%%%X%x' % [h, l]] = i.chr
22
- TBLDECWWWCOMP_['%%%x%x' % [h, l]] = i.chr
23
- end
24
- TBLDECWWWCOMP_['+'] = ' '
25
- TBLDECWWWCOMP_.freeze
26
-
27
- # Encode given +s+ to URL-encoded form data.
28
- #
29
- # This method doesn't convert *, -, ., 0-9, A-Z, _, a-z, but does convert SP
30
- # (ASCII space) to + and converts others to %XX.
31
- #
32
- # This is an implementation of
33
- # http://www.w3.org/TR/html5/forms.html#url-encoded-form-data
34
- #
35
- # See URI.decode_www_form_component, URI.encode_www_form
36
- def self.encode_www_form_component(s)
37
- str = s.to_s
38
- if RUBY_VERSION < "1.9" && $KCODE =~ /u/i
39
- str.gsub(/([^ a-zA-Z0-9_.-]+)/) do
40
- '%' + $1.unpack('H2' * Rack::Utils.bytesize($1)).join('%').upcase
41
- end.tr(' ', '+')
42
- else
43
- str.gsub(/[^*\-.0-9A-Z_a-z]/) {|m| TBLENCWWWCOMP_[m]}
44
- end
45
- end
46
-
47
- # Decode given +str+ of URL-encoded form data.
48
- #
49
- # This decodes + to SP.
50
- #
51
- # See URI.encode_www_form_component, URI.decode_www_form
52
- def self.decode_www_form_component(str, enc=nil)
53
- raise ArgumentError, "invalid %-encoding (#{str})" unless /\A(?:%[0-9a-fA-F]{2}|[^%])*\z/ =~ str
54
- str.gsub(/\+|%[0-9a-fA-F]{2}/) {|m| TBLDECWWWCOMP_[m]}
55
- end
56
- end