puma 3.5.0 → 3.12.0
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 +5 -5
- data/{History.txt → History.md} +318 -75
- data/README.md +143 -227
- data/docs/architecture.md +36 -0
- data/{DEPLOYMENT.md → docs/deployment.md} +0 -0
- data/docs/images/puma-connection-flow-no-reactor.png +0 -0
- data/docs/images/puma-connection-flow.png +0 -0
- data/docs/images/puma-general-arch.png +0 -0
- data/docs/plugins.md +28 -0
- data/docs/restart.md +39 -0
- data/docs/signals.md +56 -3
- data/docs/systemd.md +124 -22
- data/ext/puma_http11/extconf.rb +2 -0
- data/ext/puma_http11/http11_parser.c +85 -84
- data/ext/puma_http11/http11_parser.h +1 -0
- data/ext/puma_http11/http11_parser.rl +10 -9
- data/ext/puma_http11/io_buffer.c +7 -7
- data/ext/puma_http11/mini_ssl.c +67 -6
- data/ext/puma_http11/org/jruby/puma/Http11Parser.java +13 -16
- data/ext/puma_http11/org/jruby/puma/MiniSSL.java +15 -2
- data/ext/puma_http11/puma_http11.c +1 -0
- data/lib/puma.rb +13 -5
- data/lib/puma/app/status.rb +8 -0
- data/lib/puma/binder.rb +22 -17
- data/lib/puma/cli.rb +49 -33
- data/lib/puma/client.rb +149 -4
- data/lib/puma/cluster.rb +54 -12
- data/lib/puma/commonlogger.rb +19 -20
- data/lib/puma/compat.rb +3 -7
- data/lib/puma/configuration.rb +133 -130
- data/lib/puma/const.rb +19 -37
- data/lib/puma/control_cli.rb +38 -35
- data/lib/puma/convenient.rb +3 -3
- data/lib/puma/detect.rb +3 -1
- data/lib/puma/dsl.rb +80 -58
- data/lib/puma/events.rb +6 -8
- data/lib/puma/io_buffer.rb +1 -1
- data/lib/puma/jruby_restart.rb +0 -1
- data/lib/puma/launcher.rb +61 -30
- data/lib/puma/minissl.rb +85 -4
- data/lib/puma/null_io.rb +6 -13
- data/lib/puma/plugin.rb +12 -1
- data/lib/puma/plugin/tmp_restart.rb +1 -2
- data/lib/puma/rack/builder.rb +3 -0
- data/lib/puma/rack/urlmap.rb +9 -8
- data/lib/puma/reactor.rb +135 -0
- data/lib/puma/runner.rb +27 -1
- data/lib/puma/server.rb +134 -32
- data/lib/puma/single.rb +17 -3
- data/lib/puma/thread_pool.rb +67 -20
- data/lib/puma/util.rb +1 -5
- data/lib/rack/handler/puma.rb +58 -17
- data/tools/jungle/README.md +12 -2
- data/tools/jungle/init.d/README.md +9 -2
- data/tools/jungle/init.d/puma +32 -62
- data/tools/jungle/init.d/run-puma +5 -1
- data/tools/jungle/rc.d/README.md +74 -0
- data/tools/jungle/rc.d/puma +61 -0
- data/tools/jungle/rc.d/puma.conf +10 -0
- data/tools/trickletest.rb +1 -1
- metadata +22 -92
- data/Gemfile +0 -13
- data/Manifest.txt +0 -77
- data/Rakefile +0 -158
- data/lib/puma/rack/backports/uri/common_18.rb +0 -59
- data/lib/puma/rack/backports/uri/common_192.rb +0 -55
- data/puma.gemspec +0 -52
@@ -8,7 +8,11 @@ if [ -d "$HOME/.rbenv/bin" ]; then
|
|
8
8
|
elif [ -d "/usr/local/rbenv/bin" ]; then
|
9
9
|
PATH="/usr/local/rbenv/bin:/usr/local/rbenv/shims:$PATH"
|
10
10
|
eval "$(rbenv init -)"
|
11
|
+
elif [ -f /usr/local/rvm/scripts/rvm ]; then
|
12
|
+
source /etc/profile.d/rvm.sh
|
13
|
+
elif [ -f "$HOME/.rvm/scripts/rvm" ]; then
|
14
|
+
source "$HOME/.rvm/scripts/rvm"
|
11
15
|
fi
|
12
16
|
|
13
17
|
app=$1; config=$2; log=$3;
|
14
|
-
cd $app && exec bundle exec puma -C $config
|
18
|
+
cd $app && exec bundle exec puma -C $config >> $log 2>&1
|
@@ -0,0 +1,74 @@
|
|
1
|
+
# Puma as a service using rc.d
|
2
|
+
|
3
|
+
Manage multilpe Puma servers as services on one box using FreeBSD's rc.d service.
|
4
|
+
|
5
|
+
## Dependencies
|
6
|
+
|
7
|
+
* `jq` - a command-line json parser is needed to parse the json in the config file
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
# Copy the puma script to the rc.d directory (make sure everyone has read/execute perms)
|
12
|
+
sudo cp puma /usr/local/etc/rc.d/
|
13
|
+
|
14
|
+
# Create an empty configuration file
|
15
|
+
sudo touch /usr/local/etc/puma.conf
|
16
|
+
|
17
|
+
# Enable the puma service
|
18
|
+
sudo echo 'puma_enable="YES"' >> /etc/rc.conf
|
19
|
+
|
20
|
+
## Managing the jungle
|
21
|
+
|
22
|
+
Puma apps are referenced in /usr/local/etc/puma.conf by default.
|
23
|
+
|
24
|
+
Start the jungle running:
|
25
|
+
|
26
|
+
`service puma start`
|
27
|
+
|
28
|
+
This script will run at boot time.
|
29
|
+
|
30
|
+
|
31
|
+
You can also stop the jungle (stops ALL puma instances) by running:
|
32
|
+
|
33
|
+
`service puma stop`
|
34
|
+
|
35
|
+
|
36
|
+
To restart the jungle:
|
37
|
+
|
38
|
+
`service puma restart`
|
39
|
+
|
40
|
+
## Conventions
|
41
|
+
|
42
|
+
* The script expects:
|
43
|
+
* a config file to exist under `config/puma.rb` in your app. E.g.: `/home/apps/my-app/config/puma.rb`.
|
44
|
+
|
45
|
+
You can always change those defaults by editing the scripts.
|
46
|
+
|
47
|
+
## Here's what a minimal app's config file should have
|
48
|
+
|
49
|
+
```
|
50
|
+
{
|
51
|
+
"servers" : [
|
52
|
+
{
|
53
|
+
"dir": "/path/to/rails/project",
|
54
|
+
"user": "deploy-user",
|
55
|
+
"ruby_version": "ruby.version",
|
56
|
+
"ruby_env": "rbenv"
|
57
|
+
}
|
58
|
+
]
|
59
|
+
}
|
60
|
+
```
|
61
|
+
|
62
|
+
## Before starting...
|
63
|
+
|
64
|
+
You need to customise `puma.conf` to:
|
65
|
+
|
66
|
+
* Set the right user your app should be running on unless you want root to execute it!
|
67
|
+
* Set the directory of the app
|
68
|
+
* Set the ruby version to execute
|
69
|
+
* Set the ruby environment (currently set to rbenv, since that is the only ruby environment currently supported)
|
70
|
+
* Add additional server instances following the scheme in the example
|
71
|
+
|
72
|
+
## Notes:
|
73
|
+
|
74
|
+
Only rbenv is currently supported.
|
@@ -0,0 +1,61 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
|
4
|
+
# PROVIDE: puma
|
5
|
+
|
6
|
+
. /etc/rc.subr
|
7
|
+
|
8
|
+
name="puma"
|
9
|
+
start_cmd="puma_start"
|
10
|
+
stop_cmd="puma_stop"
|
11
|
+
restart_cmd="puma_restart"
|
12
|
+
rcvar=puma_enable
|
13
|
+
required_files=/usr/local/etc/puma.conf
|
14
|
+
|
15
|
+
puma_start()
|
16
|
+
{
|
17
|
+
server_count=$(/usr/local/bin/jq ".servers[] .ruby_env" /usr/local/etc/puma.conf | wc -l)
|
18
|
+
i=0
|
19
|
+
while [ "$i" -lt "$server_count" ]; do
|
20
|
+
rb_env=$(/usr/local/bin/jq -r ".servers[$i].ruby_env" /usr/local/etc/puma.conf)
|
21
|
+
dir=$(/usr/local/bin/jq -r ".servers[$i].dir" /usr/local/etc/puma.conf)
|
22
|
+
user=$(/usr/local/bin/jq -r ".servers[$i].user" /usr/local/etc/puma.conf)
|
23
|
+
rb_ver=$(/usr/local/bin/jq -r ".servers[$i].ruby_version" /usr/local/etc/puma.conf)
|
24
|
+
case $rb_env in
|
25
|
+
"rbenv")
|
26
|
+
su - $user -c "cd $dir && rbenv shell $rb_ver && bundle exec puma -C $dir/config/puma.rb -d"
|
27
|
+
;;
|
28
|
+
*)
|
29
|
+
;;
|
30
|
+
esac
|
31
|
+
i=$(( i + 1 ))
|
32
|
+
done
|
33
|
+
}
|
34
|
+
|
35
|
+
puma_stop()
|
36
|
+
{
|
37
|
+
pkill ruby
|
38
|
+
}
|
39
|
+
|
40
|
+
puma_restart()
|
41
|
+
{
|
42
|
+
server_count=$(/usr/local/bin/jq ".servers[] .ruby_env" /usr/local/etc/puma.conf | wc -l)
|
43
|
+
i=0
|
44
|
+
while [ "$i" -lt "$server_count" ]; do
|
45
|
+
rb_env=$(/usr/local/bin/jq -r ".servers[$i].ruby_env" /usr/local/etc/puma.conf)
|
46
|
+
dir=$(/usr/local/bin/jq -r ".servers[$i].dir" /usr/local/etc/puma.conf)
|
47
|
+
user=$(/usr/local/bin/jq -r ".servers[$i].user" /usr/local/etc/puma.conf)
|
48
|
+
rb_ver=$(/usr/local/bin/jq -r ".servers[$i].ruby_version" /usr/local/etc/puma.conf)
|
49
|
+
case $rb_env in
|
50
|
+
"rbenv")
|
51
|
+
su - $user -c "cd $dir && pkill ruby && rbenv shell $ruby_version && bundle exec puma -C $dir/config/puma.rb -d"
|
52
|
+
;;
|
53
|
+
*)
|
54
|
+
;;
|
55
|
+
esac
|
56
|
+
i=$(( i + 1 ))
|
57
|
+
done
|
58
|
+
}
|
59
|
+
|
60
|
+
load_rc_config $name
|
61
|
+
run_rc_command "$1"
|
data/tools/trickletest.rb
CHANGED
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: 3.
|
4
|
+
version: 3.12.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Evan Phoenix
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
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.15'
|
68
|
-
type: :development
|
69
|
-
prerelease: false
|
70
|
-
version_requirements: !ruby/object:Gem::Requirement
|
71
|
-
requirements:
|
72
|
-
- - "~>"
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: '3.15'
|
11
|
+
date: 2018-07-13 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.
|
78
|
-
|
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,29 +21,22 @@ 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/nginx.md
|
92
|
-
- docs/signals.md
|
93
|
-
- docs/systemd.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
|
-
-
|
99
|
-
- Gemfile
|
100
|
-
- History.txt
|
26
|
+
- History.md
|
101
27
|
- LICENSE
|
102
|
-
- Manifest.txt
|
103
28
|
- README.md
|
104
|
-
- Rakefile
|
105
29
|
- bin/puma
|
106
30
|
- bin/puma-wild
|
107
31
|
- bin/pumactl
|
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
|
108
37
|
- docs/nginx.md
|
38
|
+
- docs/plugins.md
|
39
|
+
- docs/restart.md
|
109
40
|
- docs/signals.md
|
110
41
|
- docs/systemd.md
|
111
42
|
- ext/puma_http11/PumaHttp11Service.java
|
@@ -148,8 +79,6 @@ files:
|
|
148
79
|
- lib/puma/null_io.rb
|
149
80
|
- lib/puma/plugin.rb
|
150
81
|
- lib/puma/plugin/tmp_restart.rb
|
151
|
-
- lib/puma/rack/backports/uri/common_18.rb
|
152
|
-
- lib/puma/rack/backports/uri/common_192.rb
|
153
82
|
- lib/puma/rack/backports/uri/common_193.rb
|
154
83
|
- lib/puma/rack/builder.rb
|
155
84
|
- lib/puma/rack/urlmap.rb
|
@@ -163,11 +92,13 @@ files:
|
|
163
92
|
- lib/puma/thread_pool.rb
|
164
93
|
- lib/puma/util.rb
|
165
94
|
- lib/rack/handler/puma.rb
|
166
|
-
- puma.gemspec
|
167
95
|
- tools/jungle/README.md
|
168
96
|
- tools/jungle/init.d/README.md
|
169
97
|
- tools/jungle/init.d/puma
|
170
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
|
171
102
|
- tools/jungle/upstart/README.md
|
172
103
|
- tools/jungle/upstart/puma-manager.conf
|
173
104
|
- tools/jungle/upstart/puma.conf
|
@@ -175,18 +106,17 @@ files:
|
|
175
106
|
homepage: http://puma.io
|
176
107
|
licenses:
|
177
108
|
- BSD-3-Clause
|
178
|
-
metadata:
|
109
|
+
metadata:
|
110
|
+
msys2_mingw_dependencies: openssl
|
179
111
|
post_install_message:
|
180
|
-
rdoc_options:
|
181
|
-
- "--main"
|
182
|
-
- README.md
|
112
|
+
rdoc_options: []
|
183
113
|
require_paths:
|
184
114
|
- lib
|
185
115
|
required_ruby_version: !ruby/object:Gem::Requirement
|
186
116
|
requirements:
|
187
117
|
- - ">="
|
188
118
|
- !ruby/object:Gem::Version
|
189
|
-
version:
|
119
|
+
version: '2.2'
|
190
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
191
121
|
requirements:
|
192
122
|
- - ">="
|
@@ -194,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
124
|
version: '0'
|
195
125
|
requirements: []
|
196
126
|
rubyforge_project:
|
197
|
-
rubygems_version: 2.
|
127
|
+
rubygems_version: 2.7.6
|
198
128
|
signing_key:
|
199
129
|
specification_version: 4
|
200
130
|
summary: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for
|
data/Gemfile
DELETED
data/Manifest.txt
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
DEPLOYMENT.md
|
2
|
-
Gemfile
|
3
|
-
History.txt
|
4
|
-
LICENSE
|
5
|
-
Manifest.txt
|
6
|
-
README.md
|
7
|
-
Rakefile
|
8
|
-
bin/puma
|
9
|
-
bin/puma-wild
|
10
|
-
bin/pumactl
|
11
|
-
docs/nginx.md
|
12
|
-
docs/signals.md
|
13
|
-
docs/systemd.md
|
14
|
-
ext/puma_http11/PumaHttp11Service.java
|
15
|
-
ext/puma_http11/ext_help.h
|
16
|
-
ext/puma_http11/extconf.rb
|
17
|
-
ext/puma_http11/http11_parser.c
|
18
|
-
ext/puma_http11/http11_parser.h
|
19
|
-
ext/puma_http11/http11_parser.java.rl
|
20
|
-
ext/puma_http11/http11_parser.rl
|
21
|
-
ext/puma_http11/http11_parser_common.rl
|
22
|
-
ext/puma_http11/io_buffer.c
|
23
|
-
ext/puma_http11/mini_ssl.c
|
24
|
-
ext/puma_http11/org/jruby/puma/Http11.java
|
25
|
-
ext/puma_http11/org/jruby/puma/Http11Parser.java
|
26
|
-
ext/puma_http11/org/jruby/puma/MiniSSL.java
|
27
|
-
ext/puma_http11/puma_http11.c
|
28
|
-
lib/puma.rb
|
29
|
-
lib/puma/accept_nonblock.rb
|
30
|
-
lib/puma/app/status.rb
|
31
|
-
lib/puma/binder.rb
|
32
|
-
lib/puma/cli.rb
|
33
|
-
lib/puma/client.rb
|
34
|
-
lib/puma/cluster.rb
|
35
|
-
lib/puma/commonlogger.rb
|
36
|
-
lib/puma/compat.rb
|
37
|
-
lib/puma/configuration.rb
|
38
|
-
lib/puma/const.rb
|
39
|
-
lib/puma/control_cli.rb
|
40
|
-
lib/puma/convenient.rb
|
41
|
-
lib/puma/daemon_ext.rb
|
42
|
-
lib/puma/delegation.rb
|
43
|
-
lib/puma/detect.rb
|
44
|
-
lib/puma/dsl.rb
|
45
|
-
lib/puma/events.rb
|
46
|
-
lib/puma/io_buffer.rb
|
47
|
-
lib/puma/java_io_buffer.rb
|
48
|
-
lib/puma/jruby_restart.rb
|
49
|
-
lib/puma/launcher.rb
|
50
|
-
lib/puma/minissl.rb
|
51
|
-
lib/puma/null_io.rb
|
52
|
-
lib/puma/plugin.rb
|
53
|
-
lib/puma/plugin/tmp_restart.rb
|
54
|
-
lib/puma/rack/backports/uri/common_18.rb
|
55
|
-
lib/puma/rack/backports/uri/common_192.rb
|
56
|
-
lib/puma/rack/backports/uri/common_193.rb
|
57
|
-
lib/puma/rack/builder.rb
|
58
|
-
lib/puma/rack/urlmap.rb
|
59
|
-
lib/puma/rack_default.rb
|
60
|
-
lib/puma/reactor.rb
|
61
|
-
lib/puma/runner.rb
|
62
|
-
lib/puma/server.rb
|
63
|
-
lib/puma/single.rb
|
64
|
-
lib/puma/state_file.rb
|
65
|
-
lib/puma/tcp_logger.rb
|
66
|
-
lib/puma/thread_pool.rb
|
67
|
-
lib/puma/util.rb
|
68
|
-
lib/rack/handler/puma.rb
|
69
|
-
puma.gemspec
|
70
|
-
tools/jungle/README.md
|
71
|
-
tools/jungle/init.d/README.md
|
72
|
-
tools/jungle/init.d/puma
|
73
|
-
tools/jungle/init.d/run-puma
|
74
|
-
tools/jungle/upstart/README.md
|
75
|
-
tools/jungle/upstart/puma-manager.conf
|
76
|
-
tools/jungle/upstart/puma.conf
|
77
|
-
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
|
-
|