puma 3.7.1 → 4.1.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.

Files changed (74) hide show
  1. checksums.yaml +5 -5
  2. data/History.md +229 -1
  3. data/README.md +179 -212
  4. data/docs/architecture.md +37 -0
  5. data/{DEPLOYMENT.md → docs/deployment.md} +24 -4
  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/plugins.md +28 -0
  10. data/docs/restart.md +41 -0
  11. data/docs/signals.md +56 -3
  12. data/docs/systemd.md +130 -37
  13. data/ext/puma_http11/PumaHttp11Service.java +2 -0
  14. data/ext/puma_http11/extconf.rb +8 -0
  15. data/ext/puma_http11/http11_parser.c +84 -84
  16. data/ext/puma_http11/http11_parser.rl +9 -9
  17. data/ext/puma_http11/mini_ssl.c +105 -9
  18. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +13 -16
  19. data/ext/puma_http11/org/jruby/puma/IOBuffer.java +72 -0
  20. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +30 -6
  21. data/lib/puma.rb +10 -0
  22. data/lib/puma/accept_nonblock.rb +2 -0
  23. data/lib/puma/app/status.rb +13 -0
  24. data/lib/puma/binder.rb +33 -18
  25. data/lib/puma/cli.rb +48 -33
  26. data/lib/puma/client.rb +94 -22
  27. data/lib/puma/cluster.rb +69 -21
  28. data/lib/puma/commonlogger.rb +2 -0
  29. data/lib/puma/configuration.rb +134 -136
  30. data/lib/puma/const.rb +16 -2
  31. data/lib/puma/control_cli.rb +31 -18
  32. data/lib/puma/convenient.rb +5 -3
  33. data/lib/puma/daemon_ext.rb +2 -0
  34. data/lib/puma/delegation.rb +2 -0
  35. data/lib/puma/detect.rb +2 -0
  36. data/lib/puma/dsl.rb +349 -113
  37. data/lib/puma/events.rb +8 -4
  38. data/lib/puma/io_buffer.rb +3 -6
  39. data/lib/puma/jruby_restart.rb +2 -1
  40. data/lib/puma/launcher.rb +60 -36
  41. data/lib/puma/minissl.rb +85 -28
  42. data/lib/puma/null_io.rb +2 -0
  43. data/lib/puma/plugin.rb +2 -0
  44. data/lib/puma/plugin/tmp_restart.rb +3 -2
  45. data/lib/puma/rack/builder.rb +4 -1
  46. data/lib/puma/rack/urlmap.rb +2 -0
  47. data/lib/puma/rack_default.rb +2 -0
  48. data/lib/puma/reactor.rb +218 -30
  49. data/lib/puma/runner.rb +18 -4
  50. data/lib/puma/server.rb +149 -56
  51. data/lib/puma/single.rb +16 -5
  52. data/lib/puma/state_file.rb +2 -0
  53. data/lib/puma/tcp_logger.rb +2 -0
  54. data/lib/puma/thread_pool.rb +59 -6
  55. data/lib/puma/util.rb +2 -6
  56. data/lib/rack/handler/puma.rb +58 -19
  57. data/tools/jungle/README.md +12 -2
  58. data/tools/jungle/init.d/README.md +2 -0
  59. data/tools/jungle/init.d/puma +8 -8
  60. data/tools/jungle/init.d/run-puma +1 -1
  61. data/tools/jungle/rc.d/README.md +74 -0
  62. data/tools/jungle/rc.d/puma +61 -0
  63. data/tools/jungle/rc.d/puma.conf +10 -0
  64. data/tools/trickletest.rb +1 -1
  65. metadata +25 -85
  66. data/.github/issue_template.md +0 -20
  67. data/Gemfile +0 -12
  68. data/Manifest.txt +0 -77
  69. data/Rakefile +0 -158
  70. data/gemfiles/2.1-Gemfile +0 -12
  71. data/lib/puma/compat.rb +0 -14
  72. data/lib/puma/java_io_buffer.rb +0 -45
  73. data/lib/puma/rack/backports/uri/common_193.rb +0 -33
  74. data/puma.gemspec +0 -52
@@ -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"
@@ -0,0 +1,10 @@
1
+ {
2
+ "servers" : [
3
+ {
4
+ "dir": "/path/to/rails/project",
5
+ "user": "deploy-user",
6
+ "ruby_version": "ruby.version",
7
+ "ruby_env": "rbenv"
8
+ }
9
+ ]
10
+ }
data/tools/trickletest.rb CHANGED
@@ -31,7 +31,7 @@ st = "GET / HTTP/1.1\r\nHost: www.zedshaw.com\r\nContent-Type: text/plain\r\nCon
31
31
  puts "length: #{content.length}"
32
32
 
33
33
  threads = []
34
- ARGV[1].to_i.times do
34
+ ARGV[1].to_i.times do
35
35
  t = Thread.new do
36
36
  size = 100
37
37
  puts ">>>> #{size} sized chunks"
metadata CHANGED
@@ -1,81 +1,33 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.1
4
+ version: 4.1.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: 2017-02-20 00:00:00.000000000 Z
11
+ date: 2019-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rack
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '1.1'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '3.0'
23
- type: :development
24
- prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- version: '1.1'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '3.0'
33
- - !ruby/object:Gem::Dependency
34
- name: rake-compiler
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '0.8'
40
- type: :development
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: '0.8'
47
- - !ruby/object:Gem::Dependency
48
- name: rdoc
14
+ name: nio4r
49
15
  requirement: !ruby/object:Gem::Requirement
50
16
  requirements:
51
17
  - - "~>"
52
18
  - !ruby/object:Gem::Version
53
- version: '4.0'
54
- type: :development
19
+ version: '2.0'
20
+ type: :runtime
55
21
  prerelease: false
56
22
  version_requirements: !ruby/object:Gem::Requirement
57
23
  requirements:
58
24
  - - "~>"
59
25
  - !ruby/object:Gem::Version
60
- version: '4.0'
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'
26
+ version: '2.0'
75
27
  description: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server
76
28
  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.
29
+ environments. It's great for highly concurrent Ruby implementations such as Rubinius
30
+ and JRuby as well as as providing process worker support to support CRuby well.
79
31
  email:
80
32
  - evan@phx.io
81
33
  executables:
@@ -83,31 +35,22 @@ executables:
83
35
  - pumactl
84
36
  extensions:
85
37
  - ext/puma_http11/extconf.rb
86
- extra_rdoc_files:
87
- - ".github/issue_template.md"
88
- - DEPLOYMENT.md
89
- - History.md
90
- - Manifest.txt
91
- - README.md
92
- - docs/nginx.md
93
- - docs/signals.md
94
- - docs/systemd.md
95
- - tools/jungle/README.md
96
- - tools/jungle/init.d/README.md
97
- - tools/jungle/upstart/README.md
38
+ extra_rdoc_files: []
98
39
  files:
99
- - ".github/issue_template.md"
100
- - DEPLOYMENT.md
101
- - Gemfile
102
40
  - History.md
103
41
  - LICENSE
104
- - Manifest.txt
105
42
  - README.md
106
- - Rakefile
107
43
  - bin/puma
108
44
  - bin/puma-wild
109
45
  - bin/pumactl
46
+ - docs/architecture.md
47
+ - docs/deployment.md
48
+ - docs/images/puma-connection-flow-no-reactor.png
49
+ - docs/images/puma-connection-flow.png
50
+ - docs/images/puma-general-arch.png
110
51
  - docs/nginx.md
52
+ - docs/plugins.md
53
+ - docs/restart.md
111
54
  - docs/signals.md
112
55
  - docs/systemd.md
113
56
  - ext/puma_http11/PumaHttp11Service.java
@@ -122,9 +65,9 @@ files:
122
65
  - ext/puma_http11/mini_ssl.c
123
66
  - ext/puma_http11/org/jruby/puma/Http11.java
124
67
  - ext/puma_http11/org/jruby/puma/Http11Parser.java
68
+ - ext/puma_http11/org/jruby/puma/IOBuffer.java
125
69
  - ext/puma_http11/org/jruby/puma/MiniSSL.java
126
70
  - ext/puma_http11/puma_http11.c
127
- - gemfiles/2.1-Gemfile
128
71
  - lib/puma.rb
129
72
  - lib/puma/accept_nonblock.rb
130
73
  - lib/puma/app/status.rb
@@ -133,7 +76,6 @@ files:
133
76
  - lib/puma/client.rb
134
77
  - lib/puma/cluster.rb
135
78
  - lib/puma/commonlogger.rb
136
- - lib/puma/compat.rb
137
79
  - lib/puma/configuration.rb
138
80
  - lib/puma/const.rb
139
81
  - lib/puma/control_cli.rb
@@ -144,14 +86,12 @@ files:
144
86
  - lib/puma/dsl.rb
145
87
  - lib/puma/events.rb
146
88
  - lib/puma/io_buffer.rb
147
- - lib/puma/java_io_buffer.rb
148
89
  - lib/puma/jruby_restart.rb
149
90
  - lib/puma/launcher.rb
150
91
  - lib/puma/minissl.rb
151
92
  - lib/puma/null_io.rb
152
93
  - lib/puma/plugin.rb
153
94
  - lib/puma/plugin/tmp_restart.rb
154
- - lib/puma/rack/backports/uri/common_193.rb
155
95
  - lib/puma/rack/builder.rb
156
96
  - lib/puma/rack/urlmap.rb
157
97
  - lib/puma/rack_default.rb
@@ -164,11 +104,13 @@ files:
164
104
  - lib/puma/thread_pool.rb
165
105
  - lib/puma/util.rb
166
106
  - lib/rack/handler/puma.rb
167
- - puma.gemspec
168
107
  - tools/jungle/README.md
169
108
  - tools/jungle/init.d/README.md
170
109
  - tools/jungle/init.d/puma
171
110
  - tools/jungle/init.d/run-puma
111
+ - tools/jungle/rc.d/README.md
112
+ - tools/jungle/rc.d/puma
113
+ - tools/jungle/rc.d/puma.conf
172
114
  - tools/jungle/upstart/README.md
173
115
  - tools/jungle/upstart/puma-manager.conf
174
116
  - tools/jungle/upstart/puma.conf
@@ -176,26 +118,24 @@ files:
176
118
  homepage: http://puma.io
177
119
  licenses:
178
120
  - BSD-3-Clause
179
- metadata: {}
121
+ metadata:
122
+ msys2_mingw_dependencies: openssl
180
123
  post_install_message:
181
- rdoc_options:
182
- - "--main"
183
- - README.md
124
+ rdoc_options: []
184
125
  require_paths:
185
126
  - lib
186
127
  required_ruby_version: !ruby/object:Gem::Requirement
187
128
  requirements:
188
129
  - - ">="
189
130
  - !ruby/object:Gem::Version
190
- version: 1.9.3
131
+ version: '2.2'
191
132
  required_rubygems_version: !ruby/object:Gem::Requirement
192
133
  requirements:
193
134
  - - ">="
194
135
  - !ruby/object:Gem::Version
195
136
  version: '0'
196
137
  requirements: []
197
- rubyforge_project:
198
- rubygems_version: 2.6.8
138
+ rubygems_version: 3.0.3
199
139
  signing_key:
200
140
  specification_version: 4
201
141
  summary: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for
@@ -1,20 +0,0 @@
1
- ### Steps to reproduce
2
-
3
- 1) ...
4
-
5
- 2) ...
6
-
7
- 3) ...
8
-
9
- ### Expected behavior
10
-
11
- Tell us what should happen ...
12
-
13
- ### Actual behavior
14
-
15
- Tell us what happens instead ...
16
-
17
- ### System configuration
18
-
19
- **Ruby version**:
20
- **Rails version**:
data/Gemfile DELETED
@@ -1,12 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem "hoe"
4
- gem "hoe-git"
5
- gem "hoe-ignore"
6
- gem "rdoc"
7
- gem "rake-compiler"
8
-
9
- gem "rack", "< 3.0"
10
- gem "minitest", "~> 5.9"
11
-
12
- gem "jruby-openssl", :platform => "jruby"
data/Manifest.txt DELETED
@@ -1,77 +0,0 @@
1
- .github/issue_template.md
2
- DEPLOYMENT.md
3
- Gemfile
4
- History.md
5
- LICENSE
6
- Manifest.txt
7
- README.md
8
- Rakefile
9
- bin/puma
10
- bin/puma-wild
11
- bin/pumactl
12
- docs/nginx.md
13
- docs/signals.md
14
- docs/systemd.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
- gemfiles/2.1-Gemfile
30
- lib/puma.rb
31
- lib/puma/accept_nonblock.rb
32
- lib/puma/app/status.rb
33
- lib/puma/binder.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/convenient.rb
43
- lib/puma/daemon_ext.rb
44
- lib/puma/delegation.rb
45
- lib/puma/detect.rb
46
- lib/puma/dsl.rb
47
- lib/puma/events.rb
48
- lib/puma/io_buffer.rb
49
- lib/puma/java_io_buffer.rb
50
- lib/puma/jruby_restart.rb
51
- lib/puma/launcher.rb
52
- lib/puma/minissl.rb
53
- lib/puma/null_io.rb
54
- lib/puma/plugin.rb
55
- lib/puma/plugin/tmp_restart.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 "bundler/setup"
2
- require "hoe"
3
- require "rake/extensiontask"
4
- require "rake/javaextensiontask"
5
-
6
- IS_JRUBY = defined?(RUBY_ENGINE) ? RUBY_ENGINE == "jruby" : false
7
-
8
- Hoe.plugin :git
9
- Hoe.plugin :ignore
10
-
11
- HOE = Hoe.spec "puma" do
12
- self.readme_file = "README.md"
13
- self.urls = %w!http://puma.io https://github.com/puma/puma!
14
-
15
- license "BSD-3-Clause"
16
- developer 'Evan Phoenix', 'evan@phx.io'
17
-
18
- spec_extras[:extensions] = ["ext/puma_http11/extconf.rb"]
19
- spec_extras[:executables] = ['puma', 'pumactl']
20
- spec_extras[:homepage] = self.urls.first
21
-
22
- require_ruby_version ">= 1.9.3"
23
-
24
- dependency "rack", [">= 1.1", "< 3.0"], :development
25
-
26
- extra_dev_deps << ["rake-compiler", "~> 0.8"]
27
- end
28
-
29
- task :prerelease => [:clobber, :check_manifest, :test]
30
-
31
- # hoe/test and rake-compiler don't seem to play well together, so disable
32
- # hoe/test's .gemtest touch file thingy for now
33
- HOE.spec.files -= [".gemtest"]
34
-
35
- include Hoe::Git
36
-
37
- desc "Print the current changelog."
38
- task "changelog" do
39
- tag = ENV["FROM"] || git_tags.last
40
- range = [tag, "HEAD"].compact.join ".."
41
- cmd = "git log #{range} '--format=tformat:%B|||%aN|||%aE|||'"
42
- now = Time.new.strftime "%Y-%m-%d"
43
-
44
- changes = `#{cmd}`.split(/\|\|\|/).each_slice(3).map { |msg, author, email|
45
- msg.split(/\n/).reject { |s| s.empty? }.first
46
- }.flatten.compact
47
-
48
- $changes = Hash.new { |h,k| h[k] = [] }
49
-
50
- codes = {
51
- "!" => :major,
52
- "+" => :minor,
53
- "*" => :minor,
54
- "-" => :bug,
55
- "?" => :unknown,
56
- }
57
-
58
- codes_re = Regexp.escape codes.keys.join
59
-
60
- changes.each do |change|
61
- if change =~ /^\s*([#{codes_re}])\s*(.*)/ then
62
- code, line = codes[$1], $2
63
- else
64
- code, line = codes["?"], change.chomp
65
- end
66
-
67
- $changes[code] << line
68
- end
69
-
70
- puts "## #{ENV['VERSION'] || 'NEXT'} / #{now}"
71
- puts
72
- changelog_section :major
73
- changelog_section :minor
74
- changelog_section :bug
75
- changelog_section :unknown
76
- puts
77
- end
78
-
79
- # generate extension code using Ragel (C and Java)
80
- desc "Generate extension code (C and Java) using Ragel"
81
- task :ragel
82
-
83
- file 'ext/puma_http11/http11_parser.c' => ['ext/puma_http11/http11_parser.rl'] do |t|
84
- begin
85
- sh "ragel #{t.prerequisites.last} -C -G2 -I ext/puma_http11 -o #{t.name}"
86
- rescue
87
- fail "Could not build wrapper using Ragel (it failed or not installed?)"
88
- end
89
- end
90
- task :ragel => ['ext/puma_http11/http11_parser.c']
91
-
92
- file 'ext/puma_http11/org/jruby/puma/Http11Parser.java' => ['ext/puma_http11/http11_parser.java.rl'] do |t|
93
- begin
94
- sh "ragel #{t.prerequisites.last} -J -G2 -I ext/puma_http11 -o #{t.name}"
95
- rescue
96
- fail "Could not build wrapper using Ragel (it failed or not installed?)"
97
- end
98
- end
99
- task :ragel => ['ext/puma_http11/org/jruby/puma/Http11Parser.java']
100
-
101
- if !IS_JRUBY
102
-
103
- # compile extensions using rake-compiler
104
- # C (MRI, Rubinius)
105
- Rake::ExtensionTask.new("puma_http11", HOE.spec) do |ext|
106
- # place extension inside namespace
107
- ext.lib_dir = "lib/puma"
108
-
109
- ext.cross_compile = true
110
- ext.cross_platform = ['i386-mswin32-60', 'i386-mingw32']
111
- ext.cross_compiling do |spec|
112
- # add fat-binary stub only when cross compiling
113
- spec.files << "lib/puma/puma_http11.rb"
114
- end
115
-
116
- CLEAN.include "lib/puma/{1.8,1.9}"
117
- CLEAN.include "lib/puma/puma_http11.rb"
118
- end
119
-
120
- else
121
-
122
- # Java (JRuby)
123
- Rake::JavaExtensionTask.new("puma_http11", HOE.spec) do |ext|
124
- ext.lib_dir = "lib/puma"
125
- end
126
-
127
- end
128
-
129
- # the following is a fat-binary stub that will be used when
130
- # require 'puma/puma_http11' and will use either 1.8 or 1.9 version depending
131
- # on RUBY_VERSION
132
- file "lib/puma/puma_http11.rb" do |t|
133
- File.open(t.name, "w") do |f|
134
- f.puts "RUBY_VERSION =~ /(\d+.\d+)/"
135
- f.puts 'require "puma/#{$1}/puma_http11"'
136
- end
137
- end
138
-
139
- # tests require extension be compiled, but depend on the platform
140
- if IS_JRUBY
141
- task :test => [:java]
142
- else
143
- task :test => [:compile]
144
- end
145
-
146
- namespace :test do
147
- desc "Run the integration tests"
148
- task :integration do
149
- sh "cd test/shell; sh run.sh"
150
- end
151
-
152
- desc "Run all tests"
153
- if defined?(JRUBY_VERSION) and ENV['TRAVIS']
154
- task :all => :test
155
- else
156
- task :all => [:test, "test:integration"]
157
- end
158
- end