rainbows 0.90.1 → 0.90.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Documentation/comparison.haml +3 -4
- data/GIT-VERSION-GEN +1 -1
- data/Rakefile +1 -3
- data/bin/rainbows +9 -8
- data/lib/rainbows/const.rb +1 -1
- data/lib/rainbows/http_response.rb +2 -1
- data/lib/rainbows/rev_thread_pool.rb +2 -3
- data/lib/rainbows/rev_thread_spawn.rb +2 -3
- data/local.mk.sample +14 -3
- data/rainbows.1 +0 -0
- data/rainbows.gemspec +4 -2
- data/t/GNUmakefile +8 -5
- data/t/bin/content-md5-put +1 -1
- data/t/bin/unused_listen +1 -0
- data/t/bin/utee +1 -1
- data/t/cramp/README +3 -0
- data/t/cramp/streaming.ru +28 -0
- data/t/t0500-cramp-streaming.sh +77 -0
- metadata +8 -3
@@ -53,7 +53,7 @@
|
|
53
53
|
%tr.comp_row
|
54
54
|
%td.mod RevThreadSpawn
|
55
55
|
%td.tee No
|
56
|
-
%td.r18
|
56
|
+
%td.r18 Yes
|
57
57
|
%td.r19 Yes
|
58
58
|
%td.rbx No
|
59
59
|
%td.slow Yes
|
@@ -88,7 +88,7 @@
|
|
88
88
|
%tr.comp_row
|
89
89
|
%td.mod RevThreadPool
|
90
90
|
%td.tee No
|
91
|
-
%td.r18
|
91
|
+
%td.r18 Yes
|
92
92
|
%td.r19 Yes
|
93
93
|
%td.rbx No
|
94
94
|
%td.slow Yes
|
@@ -101,8 +101,7 @@
|
|
101
101
|
%td.slow Yes
|
102
102
|
%ul
|
103
103
|
%li
|
104
|
-
RevThread* + 1.8
|
105
|
-
Rev 0.3.2 (when it is released) should be much faster under 1.8.
|
104
|
+
RevThread* + 1.8 requires Rev >= 0.3.2 for reasonable performance
|
106
105
|
%li
|
107
106
|
waiting on Rubinius for better signal handling
|
108
107
|
%li
|
data/GIT-VERSION-GEN
CHANGED
data/Rakefile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# -*- encoding: binary -*-
|
2
|
+
autoload :Gem, 'rubygems'
|
2
3
|
|
3
4
|
# most tasks are in the GNUmakefile which offers better parallelism
|
4
5
|
|
@@ -89,8 +90,6 @@ end
|
|
89
90
|
|
90
91
|
desc "print release notes for Rubyforge"
|
91
92
|
task :release_notes do
|
92
|
-
require 'rubygems'
|
93
|
-
|
94
93
|
spec = Gem::Specification.load('rainbows.gemspec')
|
95
94
|
puts spec.description.strip
|
96
95
|
puts ""
|
@@ -121,7 +120,6 @@ end
|
|
121
120
|
|
122
121
|
desc "post to RAA"
|
123
122
|
task :raa_update do
|
124
|
-
require 'rubygems'
|
125
123
|
require 'net/http'
|
126
124
|
require 'net/netrc'
|
127
125
|
rc = Net::Netrc.locate('rainbows-raa') or abort "~/.netrc not found"
|
data/bin/rainbows
CHANGED
@@ -41,7 +41,7 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
41
41
|
require library
|
42
42
|
end
|
43
43
|
|
44
|
-
opts.separator "Unicorn options:"
|
44
|
+
opts.separator "Rainbows!/Unicorn options:"
|
45
45
|
|
46
46
|
# some of these switches exist for rackup command-line compatibility,
|
47
47
|
|
@@ -57,8 +57,8 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
57
57
|
set_listener = true
|
58
58
|
end
|
59
59
|
|
60
|
-
opts.on("-E", "--env
|
61
|
-
"use
|
60
|
+
opts.on("-E", "--env RACK_ENV",
|
61
|
+
"use RACK_ENV for defaults (default: development)") do |e|
|
62
62
|
ENV["RACK_ENV"] = e
|
63
63
|
end
|
64
64
|
|
@@ -67,8 +67,8 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
67
67
|
end
|
68
68
|
|
69
69
|
opts.on("-P", "--pid FILE", "DEPRECATED") do |f|
|
70
|
-
warn
|
71
|
-
warn
|
70
|
+
warn "Use of --pid/-P is strongly discouraged"
|
71
|
+
warn "Use the 'pid' directive in the Rainbows!/Unicorn config file instead"
|
72
72
|
options[:pid] = f
|
73
73
|
end
|
74
74
|
|
@@ -77,7 +77,7 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
77
77
|
warn "-s/--server only exists for compatibility with rackup"
|
78
78
|
end
|
79
79
|
|
80
|
-
# Unicorn-specific stuff
|
80
|
+
# Rainbows!/Unicorn-specific stuff
|
81
81
|
opts.on("-l", "--listen {HOST:PORT|PATH}",
|
82
82
|
"listen on HOST:PORT or PATH",
|
83
83
|
"this may be specified multiple times",
|
@@ -85,7 +85,8 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
85
85
|
listeners << address
|
86
86
|
end
|
87
87
|
|
88
|
-
opts.on("-c", "--config-file FILE",
|
88
|
+
opts.on("-c", "--config-file FILE",
|
89
|
+
"Rainbows!/Unicorn-specific config file") do |f|
|
89
90
|
options[:config_file] = f
|
90
91
|
end
|
91
92
|
|
@@ -102,7 +103,7 @@ opts = OptionParser.new("", 24, ' ') do |opts|
|
|
102
103
|
end
|
103
104
|
|
104
105
|
opts.on_tail("-v", "--version", "Show version") do
|
105
|
-
puts "
|
106
|
+
puts "Rainbows! v#{Rainbows::Const::RAINBOWS_VERSION}"
|
106
107
|
exit
|
107
108
|
end
|
108
109
|
|
data/lib/rainbows/const.rb
CHANGED
@@ -16,7 +16,8 @@ module Rainbows
|
|
16
16
|
next if %r{\AX-Rainbows-}i =~ key
|
17
17
|
next if SKIP.include?(key.downcase)
|
18
18
|
if value =~ /\n/
|
19
|
-
|
19
|
+
# avoiding blank, key-only cookies with /\n+/
|
20
|
+
out.concat(value.split(/\n+/).map! { |v| "#{key}: #{v}\r\n" })
|
20
21
|
else
|
21
22
|
out << "#{key}: #{value}\r\n"
|
22
23
|
end
|
@@ -15,9 +15,8 @@ module Rainbows
|
|
15
15
|
# slow clients and applications with medium-to-slow response times
|
16
16
|
# (I/O bound), but less suitable for sleepy applications.
|
17
17
|
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
# improvements under Ruby 1.8.
|
18
|
+
# Ruby 1.8 users are strongly advised to use Rev >= 0.3.2 to get
|
19
|
+
# usable performance.
|
21
20
|
|
22
21
|
module RevThreadPool
|
23
22
|
|
@@ -15,9 +15,8 @@ module Rainbows
|
|
15
15
|
# slow clients and applications with medium-to-slow response times
|
16
16
|
# (I/O bound), but less suitable for sleepy applications.
|
17
17
|
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
# improvements under Ruby 1.8.
|
18
|
+
# Ruby 1.8 users are strongly advised to use Rev >= 0.3.2 to get
|
19
|
+
# usable performance.
|
21
20
|
|
22
21
|
module RevThreadSpawn
|
23
22
|
|
data/local.mk.sample
CHANGED
@@ -6,14 +6,25 @@
|
|
6
6
|
|
7
7
|
RSYNC = rsync
|
8
8
|
DLEXT := so
|
9
|
-
gems := rack-1.0
|
10
|
-
# gems += unicorn-0.
|
11
|
-
gems += rev-0.3.
|
9
|
+
gems := rack-1.1.0
|
10
|
+
# gems += unicorn-0.96.0 # installed via setup.rb
|
11
|
+
gems += rev-0.3.2
|
12
12
|
gems += iobuffer-0.1.3
|
13
13
|
gems += eventmachine-0.12.10
|
14
14
|
gems += async_sinatra-0.1.5 sinatra-0.9.4
|
15
15
|
gems += espace-neverblock-0.1.6.1
|
16
16
|
|
17
|
+
# Cramp isn't enabled by default since it depends on several prerelease gems
|
18
|
+
ifdef CRAMP
|
19
|
+
gems += cramp-0.7
|
20
|
+
gems += activesupport-3.0.pre
|
21
|
+
gems += activemodel-3.0.pre
|
22
|
+
gems += arel-0.2.pre
|
23
|
+
gems += usher-0.6.2
|
24
|
+
gems += fuzzyhash-0.0.11
|
25
|
+
gems += mysqlplus-0.1.1
|
26
|
+
endif
|
27
|
+
|
17
28
|
# Avoid loading rubygems to speed up tests because gmake is
|
18
29
|
# fork+exec heavy with Ruby.
|
19
30
|
prefix = $(HOME)
|
data/rainbows.1
ADDED
File without changes
|
data/rainbows.gemspec
CHANGED
@@ -41,7 +41,9 @@ Gem::Specification.new do |s|
|
|
41
41
|
s.test_files = test_files
|
42
42
|
|
43
43
|
# we need Unicorn for the HTTP parser and process management
|
44
|
-
|
44
|
+
# The HTTP parser in Unicorn < 0.96.1 did not use the Ruby
|
45
|
+
# API correctly and resulted in a memory leak
|
46
|
+
s.add_dependency(%q<unicorn>, ["~> 0.96.1", "< 0.97.0"])
|
45
47
|
|
46
48
|
# Unicorn already depends on Rack
|
47
49
|
# s.add_dependency(%q<rack>)
|
@@ -53,7 +55,7 @@ Gem::Specification.new do |s|
|
|
53
55
|
# s.add_dependency(%q<revactor>, [">= 0.1.5"])
|
54
56
|
#
|
55
57
|
# Revactor depends on Rev, too, 0.3.0 got the ability to attach IOs
|
56
|
-
# s.add_dependency(%q<rev>, [">= 0.3.
|
58
|
+
# s.add_dependency(%q<rev>, [">= 0.3.2"])
|
57
59
|
#
|
58
60
|
# Rev depends on IOBuffer, which got faster in 0.1.3
|
59
61
|
# s.add_dependency(%q<iobuffer>, [">= 0.1.3"])
|
data/t/GNUmakefile
CHANGED
@@ -22,7 +22,14 @@ else
|
|
22
22
|
endif
|
23
23
|
export RUBYLIB RUBY_VERSION
|
24
24
|
|
25
|
-
models
|
25
|
+
models += ThreadPool
|
26
|
+
models += ThreadSpawn
|
27
|
+
models += Rev
|
28
|
+
models += EventMachine
|
29
|
+
models += NeverBlock
|
30
|
+
models += RevThreadSpawn
|
31
|
+
models += RevThreadPool
|
32
|
+
|
26
33
|
rp := )
|
27
34
|
ONENINE := $(shell case $(RUBY_VERSION) in 1.9.*$(rp) echo true;;esac)
|
28
35
|
ifeq ($(ONENINE),true)
|
@@ -30,10 +37,6 @@ ifeq ($(ONENINE),true)
|
|
30
37
|
models += FiberSpawn
|
31
38
|
models += RevFiberSpawn
|
32
39
|
models += FiberPool
|
33
|
-
|
34
|
-
# technically this works under 1.8, but wait until rev 0.3.2
|
35
|
-
models += RevThreadSpawn
|
36
|
-
models += RevThreadPool
|
37
40
|
endif
|
38
41
|
all_models := $(models) Base
|
39
42
|
|
data/t/bin/content-md5-put
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# -*- encoding: binary -*-
|
2
3
|
# simple chunked HTTP PUT request generator (and just that),
|
3
4
|
# it reads stdin and writes to stdout so socat can write to a
|
4
5
|
# UNIX or TCP socket (or to another filter or file) along with
|
5
6
|
# a Content-MD5 trailer.
|
6
|
-
# -*- encoding: binary -*-
|
7
7
|
require 'digest/md5'
|
8
8
|
$stdout.sync = $stderr.sync = true
|
9
9
|
$stdout.binmode
|
data/t/bin/unused_listen
CHANGED
data/t/bin/utee
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# -*- encoding: binary -*-
|
2
3
|
# tee(1) as distributed on most(all?) systems is buffered in luserspace
|
3
4
|
# this only does unbuffered writes (with line-buffered input) to make
|
4
5
|
# test output appear in real-time
|
5
|
-
# -*- encoding: binary -*-
|
6
6
|
$stdin.binmode
|
7
7
|
$stdout.binmode
|
8
8
|
fp = File.open(ARGV.shift, "wb")
|
data/t/cramp/README
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# based on examples/streaming.rb in git://github.com/lifo/cramp
|
2
|
+
# commit ca54f8a944ae582a0c858209daf3c74efea7d27c
|
3
|
+
|
4
|
+
# Rack::Lint does not like async + EM stuff, so disable it:
|
5
|
+
#\ -E deployment
|
6
|
+
|
7
|
+
require 'cramp/controller'
|
8
|
+
|
9
|
+
class StreamController < Cramp::Controller::Action
|
10
|
+
periodic_timer :send_data, :every => 1
|
11
|
+
periodic_timer :check_limit, :every => 2
|
12
|
+
|
13
|
+
def start
|
14
|
+
@limit = 0
|
15
|
+
end
|
16
|
+
|
17
|
+
def send_data
|
18
|
+
render ["Hello World", "\n"]
|
19
|
+
end
|
20
|
+
|
21
|
+
def check_limit
|
22
|
+
@limit += 1
|
23
|
+
finish if @limit > 1
|
24
|
+
end
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
run StreamController
|
@@ -0,0 +1,77 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
. ./test-lib.sh
|
3
|
+
case $model in
|
4
|
+
EventMachine) ;;
|
5
|
+
*)
|
6
|
+
t_info "skipping $T since it's not compatible with $model"
|
7
|
+
exit 0
|
8
|
+
;;
|
9
|
+
esac
|
10
|
+
require_check cramp Cramp::VERSION
|
11
|
+
|
12
|
+
t_plan 7 "streaming test for Cramp"
|
13
|
+
|
14
|
+
CONFIG_RU=cramp/streaming.ru
|
15
|
+
|
16
|
+
t_begin "setup and start" && {
|
17
|
+
rainbows_setup
|
18
|
+
rtmpfiles a b c curl_err expect
|
19
|
+
|
20
|
+
# requiring Rubygems for this test only since Cramp depends on
|
21
|
+
# pre versions of several gems
|
22
|
+
# Like the rest of the EM/async stuff, it's not Rack::Lint compatible
|
23
|
+
rainbows -E deployment -D $CONFIG_RU -c $unicorn_config
|
24
|
+
rainbows_wait_start
|
25
|
+
}
|
26
|
+
|
27
|
+
# this will spew any unexpected input to stdout and be silent on success
|
28
|
+
check () {
|
29
|
+
(
|
30
|
+
t0=$(date +%s)
|
31
|
+
i=0
|
32
|
+
while read hello world
|
33
|
+
do
|
34
|
+
t1=$(date +%s)
|
35
|
+
diff=$(($t1 - $t0))
|
36
|
+
t_info "i=$i diff=$diff hello=$hello world=$world"
|
37
|
+
test $diff -ge 1 || echo "$i: diff: $diff < 1 second"
|
38
|
+
t0=$t1
|
39
|
+
test xHello = x"$hello" || echo "$i: Hello != $hello"
|
40
|
+
test xWorld = x"$world" || echo "$i: World != $world"
|
41
|
+
i=$(($i + 1))
|
42
|
+
test $i -le 3 || echo "$i: $i > 3"
|
43
|
+
done
|
44
|
+
)
|
45
|
+
}
|
46
|
+
|
47
|
+
t_begin "send async requests off in parallel" && {
|
48
|
+
t0=$(date +%s)
|
49
|
+
curl --no-buffer -sSf http://$listen/ 2>> $curl_err | check >$a 2>&1 &
|
50
|
+
curl --no-buffer -sSf http://$listen/ 2>> $curl_err | check >$b 2>&1 &
|
51
|
+
curl --no-buffer -sSf http://$listen/ 2>> $curl_err | check >$c 2>&1 &
|
52
|
+
}
|
53
|
+
|
54
|
+
t_begin "wait for curl terminations" && {
|
55
|
+
wait
|
56
|
+
t1=$(date +%s)
|
57
|
+
elapsed=$(( $t1 - $t0 ))
|
58
|
+
t_info "elapsed=$elapsed (should be 4-5s)"
|
59
|
+
}
|
60
|
+
|
61
|
+
t_begin "termination signal sent" && {
|
62
|
+
kill $rainbows_pid
|
63
|
+
}
|
64
|
+
|
65
|
+
t_begin "no errors from curl" && {
|
66
|
+
test ! -s $curl_err
|
67
|
+
}
|
68
|
+
|
69
|
+
t_begin "no errors in stderr" && check_stderr
|
70
|
+
|
71
|
+
t_begin "silence is golden" && {
|
72
|
+
test ! -s $a
|
73
|
+
test ! -s $b
|
74
|
+
test ! -s $c
|
75
|
+
}
|
76
|
+
|
77
|
+
t_done
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rainbows
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.90.
|
4
|
+
version: 0.90.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rainbows! hackers
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date:
|
12
|
+
date: 2010-02-13 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 0.
|
23
|
+
version: 0.96.1
|
24
24
|
- - <
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.97.0
|
@@ -77,6 +77,7 @@ extra_rdoc_files:
|
|
77
77
|
- lib/rainbows/thread_spawn.rb
|
78
78
|
- LICENSE
|
79
79
|
- NEWS
|
80
|
+
- rainbows.1
|
80
81
|
- README
|
81
82
|
- SIGNALS
|
82
83
|
- TODO
|
@@ -161,6 +162,8 @@ files:
|
|
161
162
|
- t/bin/unused_listen
|
162
163
|
- t/bin/utee
|
163
164
|
- t/content-md5.ru
|
165
|
+
- t/cramp/README
|
166
|
+
- t/cramp/streaming.ru
|
164
167
|
- t/env.ru
|
165
168
|
- t/env_rack_env.ru
|
166
169
|
- t/fork-sleep.ru
|
@@ -207,11 +210,13 @@ files:
|
|
207
210
|
- t/t0300-async_sinatra.sh
|
208
211
|
- t/t0400-em-async-app.sh
|
209
212
|
- t/t0401-em-async-tailer.sh
|
213
|
+
- t/t0500-cramp-streaming.sh
|
210
214
|
- t/t9000-rack-app-pool.sh
|
211
215
|
- t/t9000.ru
|
212
216
|
- t/test-lib.sh
|
213
217
|
- t/worker-follows-master-to-death.ru
|
214
218
|
- vs_Unicorn
|
219
|
+
- rainbows.1
|
215
220
|
has_rdoc: true
|
216
221
|
homepage: http://rainbows.rubyforge.org/
|
217
222
|
licenses: []
|