hatetepe 0.0.4 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/.travis.yml +3 -0
- data/README.md +21 -5
- data/Rakefile +3 -10
- data/bin/hatetepe +4 -0
- data/hatetepe.gemspec +10 -3
- data/lib/hatetepe.rb +5 -0
- data/lib/hatetepe/app.rb +44 -0
- data/lib/hatetepe/body.rb +79 -0
- data/lib/hatetepe/builder.rb +19 -3
- data/lib/hatetepe/cli.rb +50 -0
- data/lib/hatetepe/client.rb +95 -0
- data/lib/hatetepe/events.rb +35 -0
- data/lib/hatetepe/message.rb +13 -0
- data/lib/hatetepe/parser.rb +41 -71
- data/lib/hatetepe/prefork.rb +11 -0
- data/lib/hatetepe/proxy.rb +58 -0
- data/lib/hatetepe/request.rb +31 -0
- data/lib/hatetepe/response.rb +20 -0
- data/lib/hatetepe/server.rb +98 -0
- data/lib/hatetepe/thread_pool.rb +4 -0
- data/lib/hatetepe/version.rb +1 -1
- data/lib/rack/handler/hatetepe.rb +33 -0
- data/spec/integration/cli/start_spec.rb +169 -0
- data/spec/spec_helper.rb +37 -0
- data/spec/unit/app_spec.rb +108 -0
- data/spec/unit/body_spec.rb +198 -0
- data/spec/unit/client_spec.rb +270 -0
- data/spec/unit/events_spec.rb +96 -0
- data/spec/unit/parser_spec.rb +215 -0
- data/spec/unit/rack_handler_spec.rb +70 -0
- data/spec/unit/server_spec.rb +255 -0
- metadata +141 -56
- data/example.rb +0 -29
- data/test/builder_test.rb +0 -7
- data/test/parser_test.rb +0 -7
- data/test/test_helper.rb +0 -7
metadata
CHANGED
@@ -1,95 +1,180 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: hatetepe
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.0.4
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Lars Gierth
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-09-06 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
16
15
|
name: http_parser.rb
|
17
|
-
requirement: &
|
16
|
+
requirement: &79236260 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name:
|
28
|
-
requirement: &
|
24
|
+
version_requirements: *79236260
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: eventmachine
|
27
|
+
requirement: &79148530 !ruby/object:Gem::Requirement
|
29
28
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version:
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *79148530
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: em-synchrony
|
38
|
+
requirement: &79148130 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *79148130
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rack
|
49
|
+
requirement: &79147860 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *79147860
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: async-rack
|
60
|
+
requirement: &79147580 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *79147580
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: thor
|
71
|
+
requirement: &79147180 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *79147180
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rspec
|
82
|
+
requirement: &79146740 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *79146740
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: fakefs
|
93
|
+
requirement: &79146280 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *79146280
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: em-http-request
|
104
|
+
requirement: &79145760 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
34
110
|
type: :development
|
35
111
|
prerelease: false
|
36
|
-
version_requirements: *
|
37
|
-
description:
|
38
|
-
email:
|
112
|
+
version_requirements: *79145760
|
113
|
+
description:
|
114
|
+
email:
|
39
115
|
- lars.gierth@gmail.com
|
40
|
-
executables:
|
41
|
-
|
116
|
+
executables:
|
117
|
+
- hatetepe
|
42
118
|
extensions: []
|
43
|
-
|
44
119
|
extra_rdoc_files: []
|
45
|
-
|
46
|
-
|
120
|
+
files:
|
121
|
+
- .rspec
|
122
|
+
- .travis.yml
|
47
123
|
- Gemfile
|
48
124
|
- LICENSE
|
49
125
|
- README.md
|
50
126
|
- Rakefile
|
51
|
-
-
|
127
|
+
- bin/hatetepe
|
52
128
|
- hatetepe.gemspec
|
53
129
|
- lib/hatetepe.rb
|
130
|
+
- lib/hatetepe/app.rb
|
131
|
+
- lib/hatetepe/body.rb
|
54
132
|
- lib/hatetepe/builder.rb
|
133
|
+
- lib/hatetepe/cli.rb
|
134
|
+
- lib/hatetepe/client.rb
|
135
|
+
- lib/hatetepe/events.rb
|
136
|
+
- lib/hatetepe/message.rb
|
55
137
|
- lib/hatetepe/parser.rb
|
138
|
+
- lib/hatetepe/prefork.rb
|
139
|
+
- lib/hatetepe/proxy.rb
|
140
|
+
- lib/hatetepe/request.rb
|
141
|
+
- lib/hatetepe/response.rb
|
142
|
+
- lib/hatetepe/server.rb
|
56
143
|
- lib/hatetepe/status.rb
|
144
|
+
- lib/hatetepe/thread_pool.rb
|
57
145
|
- lib/hatetepe/version.rb
|
58
|
-
-
|
59
|
-
-
|
60
|
-
-
|
146
|
+
- lib/rack/handler/hatetepe.rb
|
147
|
+
- spec/integration/cli/start_spec.rb
|
148
|
+
- spec/spec_helper.rb
|
149
|
+
- spec/unit/app_spec.rb
|
150
|
+
- spec/unit/body_spec.rb
|
151
|
+
- spec/unit/client_spec.rb
|
152
|
+
- spec/unit/events_spec.rb
|
153
|
+
- spec/unit/parser_spec.rb
|
154
|
+
- spec/unit/rack_handler_spec.rb
|
155
|
+
- spec/unit/server_spec.rb
|
61
156
|
homepage: https://github.com/lgierth/hatetepe
|
62
157
|
licenses: []
|
63
|
-
|
64
158
|
post_install_message:
|
65
159
|
rdoc_options: []
|
66
|
-
|
67
|
-
require_paths:
|
160
|
+
require_paths:
|
68
161
|
- lib
|
69
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
162
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
70
163
|
none: false
|
71
|
-
requirements:
|
72
|
-
- -
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
|
75
|
-
|
76
|
-
- 0
|
77
|
-
version: "0"
|
78
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - ! '>='
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0'
|
168
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
169
|
none: false
|
80
|
-
requirements:
|
81
|
-
- -
|
82
|
-
- !ruby/object:Gem::Version
|
83
|
-
|
84
|
-
segments:
|
85
|
-
- 0
|
86
|
-
version: "0"
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
87
174
|
requirements: []
|
88
|
-
|
89
175
|
rubyforge_project:
|
90
|
-
rubygems_version: 1.8.
|
176
|
+
rubygems_version: 1.8.10
|
91
177
|
signing_key:
|
92
178
|
specification_version: 3
|
93
|
-
summary:
|
179
|
+
summary: The HTTP toolkit
|
94
180
|
test_files: []
|
95
|
-
|
data/example.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require "bundler"
|
2
|
-
Bundler.setup
|
3
|
-
|
4
|
-
require "hatetepe"
|
5
|
-
require "awesome_print"
|
6
|
-
|
7
|
-
Hatetepe::Parser.parse do
|
8
|
-
[:request, :response, :header, :body_chunk, :complete, :error].each do |hook|
|
9
|
-
send :"on_#{hook}" do |*args|
|
10
|
-
puts "on_#{hook}: #{args.inspect}"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
self << "HTTP/1.1 200 OK\r\nContent-Length: 11\r\n\r\nHallo Welt!"
|
15
|
-
end
|
16
|
-
|
17
|
-
Hatetepe::Builder.build do
|
18
|
-
on_write {|data| p data }
|
19
|
-
on_complete {|bytes_written| puts "Wrote #{bytes_written} bytes" }
|
20
|
-
|
21
|
-
response 200
|
22
|
-
header "Content-Type", "text/html", "utf-8"
|
23
|
-
raw_header "Content-Length: 25"
|
24
|
-
body "<p>Hallo Welt!</p>"
|
25
|
-
|
26
|
-
response 201
|
27
|
-
header "Location", "/new_entity"
|
28
|
-
complete
|
29
|
-
end
|
data/test/builder_test.rb
DELETED
data/test/parser_test.rb
DELETED