jubilee 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +5 -0
- data/Gemfile +2 -1
- data/Gemfile.lock +7 -3
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/java/src/org/jruby/jubilee/RackApplication.java +1 -2
- data/lib/jubilee/jubilee.jar +0 -0
- data/lib/rack/handler/jubilee.rb +1 -1
- data/test/jubilee/test_rack_server.rb +17 -0
- data/test/test_helper.rb +38 -0
- metadata +10 -11
- data/java/.idea/ant.xml +0 -7
- data/java/.idea/libraries/jruby.xml +0 -9
- data/java/.idea/libraries/netty_3_6_0_Beta1.xml +0 -9
- data/java/.idea/libraries/vertx_core_1_3_0_final.xml +0 -9
data/CHANGELOG
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ../../ruby/rack
|
3
|
+
specs:
|
4
|
+
rack (1.4.1)
|
5
|
+
|
1
6
|
GEM
|
2
7
|
remote: http://rubygems.org/
|
3
8
|
specs:
|
@@ -25,8 +30,7 @@ GEM
|
|
25
30
|
method_source (~> 0.8)
|
26
31
|
slop (~> 3.3.1)
|
27
32
|
spoon (~> 0.0)
|
28
|
-
|
29
|
-
rake (10.0.2)
|
33
|
+
rake (10.0.3)
|
30
34
|
rcov (0.9.11-java)
|
31
35
|
rdoc (3.12)
|
32
36
|
json (~> 1.4)
|
@@ -43,6 +47,6 @@ DEPENDENCIES
|
|
43
47
|
jeweler
|
44
48
|
multipart-post
|
45
49
|
pry
|
46
|
-
rack
|
50
|
+
rack!
|
47
51
|
rcov
|
48
52
|
spoon
|
data/Rakefile
CHANGED
@@ -26,7 +26,7 @@ Jeweler::Tasks.new do |gem|
|
|
26
26
|
gem.homepage = "http://github.com/isaiah/jubilee"
|
27
27
|
gem.license = "MIT"
|
28
28
|
gem.summary = %Q{JRuby webserver based on Vertx}
|
29
|
-
gem.description = %Q{
|
29
|
+
gem.description = %Q{Jubilee is a experimental webserver built for speed, it's based on Vertx.}
|
30
30
|
gem.email = "issaria@gmail.com"
|
31
31
|
gem.authors = ["Isaiah Peng"]
|
32
32
|
# dependencies defined in Gemfile
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
@@ -21,18 +21,17 @@ import java.util.concurrent.*;
|
|
21
21
|
public class RackApplication {
|
22
22
|
private IRubyObject app;
|
23
23
|
private boolean ssl;
|
24
|
-
private Buffer bodyBuf;
|
25
24
|
|
26
25
|
private ExecutorService exec;
|
27
26
|
|
28
27
|
public RackApplication(IRubyObject app, boolean ssl) {
|
29
28
|
this.app = app;
|
30
29
|
this.ssl = ssl;
|
31
|
-
bodyBuf = new Buffer(0);
|
32
30
|
exec = Executors.newCachedThreadPool();
|
33
31
|
}
|
34
32
|
|
35
33
|
public void call(final HttpServerRequest request) {
|
34
|
+
final Buffer bodyBuf = new Buffer(0);
|
36
35
|
final Ruby runtime = app.getRuntime();
|
37
36
|
final CountDownLatch bodyLatch = new CountDownLatch(1);
|
38
37
|
request.dataHandler(new Handler<Buffer>() {
|
data/lib/jubilee/jubilee.jar
CHANGED
Binary file
|
data/lib/rack/handler/jubilee.rb
CHANGED
@@ -25,7 +25,7 @@ module Rack
|
|
25
25
|
|
26
26
|
puts "Jubilee #{::Jubilee::Const::JUBILEE_VERSION} starting..."
|
27
27
|
puts "* Environment: #{ENV['RACK_ENV']}"
|
28
|
-
puts "* Listening on
|
28
|
+
puts "* Listening on http://#{options[:Host]}:#{options[:Port]}"
|
29
29
|
|
30
30
|
yield @server if block_given?
|
31
31
|
|
@@ -3,6 +3,7 @@ require 'rack/lint'
|
|
3
3
|
require 'rack/commonlogger'
|
4
4
|
|
5
5
|
class TestRackServer < MiniTest::Unit::TestCase
|
6
|
+
include Helpers
|
6
7
|
|
7
8
|
class ErrorChecker
|
8
9
|
def initialize(app)
|
@@ -43,6 +44,8 @@ class TestRackServer < MiniTest::Unit::TestCase
|
|
43
44
|
|
44
45
|
@simple = lambda { |env| [200, { "X-Header" => "Works" }, ["Hello"]] }
|
45
46
|
@checker = ErrorChecker.new ServerLint.new(@simple)
|
47
|
+
@host = "localhost"
|
48
|
+
@port = 3215
|
46
49
|
end
|
47
50
|
|
48
51
|
def teardown
|
@@ -87,6 +90,20 @@ class TestRackServer < MiniTest::Unit::TestCase
|
|
87
90
|
assert_equal "/test/a/b/c", input['PATH_INFO']
|
88
91
|
end
|
89
92
|
|
93
|
+
def test_request_method
|
94
|
+
input = nil
|
95
|
+
@server = Jubilee::Server.new (lambda { |env| input = env; @simple.call(env) })
|
96
|
+
@server.start
|
97
|
+
|
98
|
+
POST('/test/a/b/c', {"_method" => "delete", "user" => 1})
|
99
|
+
assert_equal "DELETE", input['REQUEST_METHOD']
|
100
|
+
|
101
|
+
# it should not memorize env
|
102
|
+
POST('/test/a/b/c', {"foo" => "bar"})
|
103
|
+
assert_equal "POST", input['REQUEST_METHOD']
|
104
|
+
|
105
|
+
end
|
106
|
+
|
90
107
|
def test_query_string
|
91
108
|
input = nil
|
92
109
|
@server = Jubilee::Server.new (lambda { |env| input = env; @simple.call(env) })
|
data/test/test_helper.rb
CHANGED
@@ -4,6 +4,7 @@ require 'minitest/unit'
|
|
4
4
|
require 'jubilee'
|
5
5
|
require 'net/http'
|
6
6
|
require 'net/http/post/multipart'
|
7
|
+
require 'yaml'
|
7
8
|
def hit(uris)
|
8
9
|
uris.map do |u|
|
9
10
|
res = nil
|
@@ -19,3 +20,40 @@ def hit(uris)
|
|
19
20
|
res
|
20
21
|
end
|
21
22
|
end
|
23
|
+
|
24
|
+
module Helpers
|
25
|
+
attr_reader :status, :response
|
26
|
+
|
27
|
+
def GET(path, header={})
|
28
|
+
Net::HTTP.start(@host, @port) { |http|
|
29
|
+
user = header.delete(:user)
|
30
|
+
passwd = header.delete(:passwd)
|
31
|
+
|
32
|
+
get = Net::HTTP::Get.new(path, header)
|
33
|
+
get.basic_auth user, passwd if user && passwd
|
34
|
+
http.request(get) { |response|
|
35
|
+
@status = response.code.to_i
|
36
|
+
begin
|
37
|
+
@response = YAML.load(response.body)
|
38
|
+
rescue TypeError, ArgumentError
|
39
|
+
@response = nil
|
40
|
+
end
|
41
|
+
}
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def POST(path, formdata={}, header={})
|
46
|
+
Net::HTTP.start(@host, @port) { |http|
|
47
|
+
user = header.delete(:user)
|
48
|
+
passwd = header.delete(:passwd)
|
49
|
+
|
50
|
+
post = Net::HTTP::Post.new(path, header)
|
51
|
+
post.form_data = formdata
|
52
|
+
post.basic_auth user, passwd if user && passwd
|
53
|
+
http.request(post) { |response|
|
54
|
+
@status = response.code.to_i
|
55
|
+
@response = YAML.load(response.body)
|
56
|
+
}
|
57
|
+
}
|
58
|
+
end
|
59
|
+
end
|
metadata
CHANGED
@@ -2,28 +2,30 @@
|
|
2
2
|
name: jubilee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Isaiah Peng
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|
16
16
|
version_requirements: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - ! '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: !binary |-
|
21
|
+
MA==
|
21
22
|
none: false
|
22
23
|
requirement: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
|
-
- -
|
25
|
+
- - ! '>='
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
+
version: !binary |-
|
28
|
+
MA==
|
27
29
|
none: false
|
28
30
|
prerelease: false
|
29
31
|
type: :runtime
|
@@ -63,7 +65,7 @@ dependencies:
|
|
63
65
|
none: false
|
64
66
|
prerelease: false
|
65
67
|
type: :development
|
66
|
-
description:
|
68
|
+
description: Jubilee is a experimental webserver built for speed, it's based on Vertx.
|
67
69
|
email: issaria@gmail.com
|
68
70
|
executables:
|
69
71
|
- jubilee
|
@@ -73,6 +75,7 @@ extra_rdoc_files:
|
|
73
75
|
- README.md
|
74
76
|
files:
|
75
77
|
- .rbenv-version
|
78
|
+
- CHANGELOG
|
76
79
|
- Gemfile
|
77
80
|
- Gemfile.lock
|
78
81
|
- Guardfile
|
@@ -89,10 +92,6 @@ files:
|
|
89
92
|
- jars/jackson-mapper-asl-1.9.4.jar
|
90
93
|
- jars/netty-3.6.0.Beta1.jar
|
91
94
|
- jars/vertx-core-1.3.0.final.jar
|
92
|
-
- java/.idea/ant.xml
|
93
|
-
- java/.idea/libraries/jruby.xml
|
94
|
-
- java/.idea/libraries/netty_3_6_0_Beta1.xml
|
95
|
-
- java/.idea/libraries/vertx_core_1_3_0_final.xml
|
96
95
|
- java/src/jubilee/JubileeService.java
|
97
96
|
- java/src/org/jruby/jubilee/Const.java
|
98
97
|
- java/src/org/jruby/jubilee/RackApplication.java
|
data/java/.idea/ant.xml
DELETED