strelka 0.0.1.pre.187 → 0.0.1.pre.193
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/ChangeLog +94 -26
- data/Manifest.txt +4 -2
- data/examples/apps/ws-echo +17 -0
- data/lib/strelka/app.rb +26 -24
- data/lib/strelka/app/auth.rb +2 -1
- data/lib/strelka/app/errors.rb +1 -1
- data/lib/strelka/app/filters.rb +1 -1
- data/lib/strelka/app/negotiation.rb +1 -1
- data/lib/strelka/app/parameters.rb +2 -2
- data/lib/strelka/app/restresources.rb +1 -1
- data/lib/strelka/app/routing.rb +3 -2
- data/lib/strelka/app/sessions.rb +3 -3
- data/lib/strelka/app/templating.rb +3 -3
- data/lib/strelka/authprovider.rb +2 -10
- data/lib/strelka/behavior/plugin.rb +3 -3
- data/lib/strelka/httprequest.rb +5 -2
- data/lib/strelka/httprequest/session.rb +3 -2
- data/lib/strelka/httpresponse/session.rb +8 -9
- data/lib/strelka/mixins.rb +15 -0
- data/lib/strelka/plugins.rb +257 -0
- data/lib/strelka/router/default.rb +27 -2
- data/lib/strelka/session.rb +20 -2
- data/lib/strelka/session/db.rb +20 -10
- data/lib/strelka/session/default.rb +41 -18
- data/spec/lib/helpers.rb +1 -1
- data/spec/strelka/app/auth_spec.rb +1 -1
- data/spec/strelka/app/errors_spec.rb +1 -1
- data/spec/strelka/app/filters_spec.rb +1 -1
- data/spec/strelka/app/negotiation_spec.rb +1 -1
- data/spec/strelka/app/parameters_spec.rb +1 -1
- data/spec/strelka/app/restresources_spec.rb +1 -1
- data/spec/strelka/app/routing_spec.rb +4 -1
- data/spec/strelka/app/sessions_spec.rb +63 -17
- data/spec/strelka/app/templating_spec.rb +1 -1
- data/spec/strelka/app_spec.rb +13 -5
- data/spec/strelka/httprequest/session_spec.rb +44 -23
- data/spec/strelka/httprequest_spec.rb +21 -0
- data/spec/strelka/httpresponse/session_spec.rb +143 -0
- data/spec/strelka/{app/plugins_spec.rb → plugins_spec.rb} +64 -53
- data/spec/strelka/router/default_spec.rb +15 -0
- data/spec/strelka/router/exclusive_spec.rb +14 -0
- data/spec/strelka/session/db_spec.rb +11 -0
- data/spec/strelka/session/default_spec.rb +10 -2
- metadata +119 -37
- metadata.gz.sig +0 -0
- data/lib/strelka/app/plugins.rb +0 -284
@@ -73,6 +73,21 @@ describe Strelka::Router::Default do
|
|
73
73
|
@router.route_request( req ).should be_nil()
|
74
74
|
end
|
75
75
|
|
76
|
+
it "responds with a 405 (method not allowed) for a POST request to /user/foo" do
|
77
|
+
expected_info = {
|
78
|
+
status: 405,
|
79
|
+
message: "Method not allowed.",
|
80
|
+
headers: {
|
81
|
+
allow: 'GET, HEAD'
|
82
|
+
}
|
83
|
+
}
|
84
|
+
|
85
|
+
req = @request_factory.post( '/user/foo' )
|
86
|
+
expect {
|
87
|
+
@router.route_request( req )
|
88
|
+
}.to throw_symbol( :finish, expected_info )
|
89
|
+
end
|
90
|
+
|
76
91
|
end
|
77
92
|
|
78
93
|
context "a router with routes for 'foo', 'foo/bar', and a fallback action" do
|
@@ -107,6 +107,20 @@ describe Strelka::Router::Exclusive do
|
|
107
107
|
@router.route_request( req ).should be_nil()
|
108
108
|
end
|
109
109
|
|
110
|
+
it "responds with an HTTP::METHOD_NOT_ALLOWED for a POST request to /user/foo" do
|
111
|
+
expected_info = {
|
112
|
+
status: 405,
|
113
|
+
message: "Method not allowed.",
|
114
|
+
headers: {
|
115
|
+
allow: 'GET, HEAD'
|
116
|
+
}
|
117
|
+
}
|
118
|
+
|
119
|
+
req = @request_factory.post( '/user/foo' )
|
120
|
+
expect {
|
121
|
+
@router.route_request( req )
|
122
|
+
}.to throw_symbol( :finish, expected_info )
|
123
|
+
end
|
110
124
|
end
|
111
125
|
|
112
126
|
context "a router with routes for 'foo', 'foo/\w{3}', and 'foo/\w{6}'" do
|
@@ -70,6 +70,17 @@ describe Strelka::Session::Db do
|
|
70
70
|
end
|
71
71
|
|
72
72
|
|
73
|
+
it "knows that a request has a session if it has a cookie with an existing session id" do
|
74
|
+
described_class.dataset.insert(
|
75
|
+
:session_id => @session_id,
|
76
|
+
:session => @session_data.to_yaml )
|
77
|
+
|
78
|
+
session_cookie = "%s=%s" % [ @cookie_name, @session_id ]
|
79
|
+
req = @request_factory.get( '/frothy/gymkata', :cookie => session_cookie )
|
80
|
+
described_class.should have_session_for( req )
|
81
|
+
end
|
82
|
+
|
83
|
+
|
73
84
|
it "can save session data to the database" do
|
74
85
|
req = @request_factory.get( '/frothy/broth' )
|
75
86
|
response = req.response
|
@@ -27,6 +27,7 @@ describe Strelka::Session::Default do
|
|
27
27
|
end
|
28
28
|
|
29
29
|
before( :each ) do
|
30
|
+
described_class.configure
|
30
31
|
@cookie_name = described_class.cookie_options[:name]
|
31
32
|
end
|
32
33
|
|
@@ -66,18 +67,25 @@ describe Strelka::Session::Default do
|
|
66
67
|
end
|
67
68
|
|
68
69
|
it "rejects invalid session-ids" do
|
69
|
-
session_cookie =
|
70
|
+
session_cookie = "%s=gibberish" % [ @cookie_name ]
|
70
71
|
req = @request_factory.get( '/hungry/what-is-in-a-fruit-bowl?', :cookie => session_cookie )
|
71
72
|
described_class.get_session_id( req ).should =~ /^[[:xdigit:]]+$/
|
72
73
|
end
|
73
74
|
|
74
75
|
it "accepts and reuses an existing valid session-id" do
|
75
76
|
session_id = '3422067061a5790be374c81118d9ed3f'
|
76
|
-
session_cookie = "
|
77
|
+
session_cookie = "%s=%s" % [ @cookie_name, session_id ]
|
77
78
|
req = @request_factory.get( '/hungry/what-is-in-a-fruit-bowl?', :cookie => session_cookie )
|
78
79
|
described_class.get_session_id( req ).should == session_id
|
79
80
|
end
|
80
81
|
|
82
|
+
it "knows that a request has a session if it has a cookie with an existing session id" do
|
83
|
+
session_id = '3422067061a5790be374c81118d9ed3f'
|
84
|
+
described_class.sessions[ session_id ] = {}
|
85
|
+
session_cookie = "%s=%s" % [ @cookie_name, session_id ]
|
86
|
+
req = @request_factory.get( '/hungry/what-is-in-a-fruit-bowl?', :cookie => session_cookie )
|
87
|
+
described_class.should have_session_for( req )
|
88
|
+
end
|
81
89
|
|
82
90
|
it "can save itself to the store and set the response's session ID" do
|
83
91
|
req = @request_factory.get( '/hungry/hungry/hippos' )
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strelka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.pre.
|
4
|
+
version: 0.0.1.pre.193
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -36,11 +36,11 @@ cert_chain:
|
|
36
36
|
YUhDS0xaZFNLai9SSHVUT3QrZ2JsUmV4OEZBaDhOZUEKY21saFhlNDZwWk5K
|
37
37
|
Z1dLYnhaYWg4NWpJang5NWhSOHZPSStOQU01aUg5a09xSzEzRHJ4YWNUS1Bo
|
38
38
|
cWo1UGp3RgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
|
39
|
-
date: 2012-04-
|
39
|
+
date: 2012-04-18 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: trollop
|
43
|
-
requirement:
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
44
|
none: false
|
45
45
|
requirements:
|
46
46
|
- - ~>
|
@@ -48,10 +48,15 @@ dependencies:
|
|
48
48
|
version: '1.16'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
|
-
version_requirements:
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ~>
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '1.16'
|
52
57
|
- !ruby/object:Gem::Dependency
|
53
58
|
name: highline
|
54
|
-
requirement:
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
55
60
|
none: false
|
56
61
|
requirements:
|
57
62
|
- - ~>
|
@@ -59,10 +64,15 @@ dependencies:
|
|
59
64
|
version: '1.6'
|
60
65
|
type: :runtime
|
61
66
|
prerelease: false
|
62
|
-
version_requirements:
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ~>
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '1.6'
|
63
73
|
- !ruby/object:Gem::Dependency
|
64
74
|
name: sysexits
|
65
|
-
requirement:
|
75
|
+
requirement: !ruby/object:Gem::Requirement
|
66
76
|
none: false
|
67
77
|
requirements:
|
68
78
|
- - ~>
|
@@ -70,10 +80,15 @@ dependencies:
|
|
70
80
|
version: '1.0'
|
71
81
|
type: :runtime
|
72
82
|
prerelease: false
|
73
|
-
version_requirements:
|
83
|
+
version_requirements: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ~>
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.0'
|
74
89
|
- !ruby/object:Gem::Dependency
|
75
90
|
name: formvalidator
|
76
|
-
requirement:
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
77
92
|
none: false
|
78
93
|
requirements:
|
79
94
|
- - ~>
|
@@ -81,10 +96,15 @@ dependencies:
|
|
81
96
|
version: '0.1'
|
82
97
|
type: :runtime
|
83
98
|
prerelease: false
|
84
|
-
version_requirements:
|
99
|
+
version_requirements: !ruby/object:Gem::Requirement
|
100
|
+
none: false
|
101
|
+
requirements:
|
102
|
+
- - ~>
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0.1'
|
85
105
|
- !ruby/object:Gem::Dependency
|
86
106
|
name: inversion
|
87
|
-
requirement:
|
107
|
+
requirement: !ruby/object:Gem::Requirement
|
88
108
|
none: false
|
89
109
|
requirements:
|
90
110
|
- - ~>
|
@@ -92,10 +112,15 @@ dependencies:
|
|
92
112
|
version: '0.8'
|
93
113
|
type: :runtime
|
94
114
|
prerelease: false
|
95
|
-
version_requirements:
|
115
|
+
version_requirements: !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ~>
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0.8'
|
96
121
|
- !ruby/object:Gem::Dependency
|
97
122
|
name: mongrel2
|
98
|
-
requirement:
|
123
|
+
requirement: !ruby/object:Gem::Requirement
|
99
124
|
none: false
|
100
125
|
requirements:
|
101
126
|
- - ~>
|
@@ -103,10 +128,15 @@ dependencies:
|
|
103
128
|
version: '0.20'
|
104
129
|
type: :runtime
|
105
130
|
prerelease: false
|
106
|
-
version_requirements:
|
131
|
+
version_requirements: !ruby/object:Gem::Requirement
|
132
|
+
none: false
|
133
|
+
requirements:
|
134
|
+
- - ~>
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0.20'
|
107
137
|
- !ruby/object:Gem::Dependency
|
108
138
|
name: uuidtools
|
109
|
-
requirement:
|
139
|
+
requirement: !ruby/object:Gem::Requirement
|
110
140
|
none: false
|
111
141
|
requirements:
|
112
142
|
- - ~>
|
@@ -114,10 +144,15 @@ dependencies:
|
|
114
144
|
version: '2.1'
|
115
145
|
type: :runtime
|
116
146
|
prerelease: false
|
117
|
-
version_requirements:
|
147
|
+
version_requirements: !ruby/object:Gem::Requirement
|
148
|
+
none: false
|
149
|
+
requirements:
|
150
|
+
- - ~>
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '2.1'
|
118
153
|
- !ruby/object:Gem::Dependency
|
119
154
|
name: configurability
|
120
|
-
requirement:
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
121
156
|
none: false
|
122
157
|
requirements:
|
123
158
|
- - ~>
|
@@ -125,10 +160,15 @@ dependencies:
|
|
125
160
|
version: '1.0'
|
126
161
|
type: :runtime
|
127
162
|
prerelease: false
|
128
|
-
version_requirements:
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
none: false
|
165
|
+
requirements:
|
166
|
+
- - ~>
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '1.0'
|
129
169
|
- !ruby/object:Gem::Dependency
|
130
170
|
name: pluginfactory
|
131
|
-
requirement:
|
171
|
+
requirement: !ruby/object:Gem::Requirement
|
132
172
|
none: false
|
133
173
|
requirements:
|
134
174
|
- - ~>
|
@@ -136,10 +176,15 @@ dependencies:
|
|
136
176
|
version: '1.0'
|
137
177
|
type: :runtime
|
138
178
|
prerelease: false
|
139
|
-
version_requirements:
|
179
|
+
version_requirements: !ruby/object:Gem::Requirement
|
180
|
+
none: false
|
181
|
+
requirements:
|
182
|
+
- - ~>
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: '1.0'
|
140
185
|
- !ruby/object:Gem::Dependency
|
141
186
|
name: hoe-mercurial
|
142
|
-
requirement:
|
187
|
+
requirement: !ruby/object:Gem::Requirement
|
143
188
|
none: false
|
144
189
|
requirements:
|
145
190
|
- - ~>
|
@@ -147,10 +192,15 @@ dependencies:
|
|
147
192
|
version: 1.4.0
|
148
193
|
type: :development
|
149
194
|
prerelease: false
|
150
|
-
version_requirements:
|
195
|
+
version_requirements: !ruby/object:Gem::Requirement
|
196
|
+
none: false
|
197
|
+
requirements:
|
198
|
+
- - ~>
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: 1.4.0
|
151
201
|
- !ruby/object:Gem::Dependency
|
152
202
|
name: hoe-manualgen
|
153
|
-
requirement:
|
203
|
+
requirement: !ruby/object:Gem::Requirement
|
154
204
|
none: false
|
155
205
|
requirements:
|
156
206
|
- - ~>
|
@@ -158,10 +208,15 @@ dependencies:
|
|
158
208
|
version: 0.3.0
|
159
209
|
type: :development
|
160
210
|
prerelease: false
|
161
|
-
version_requirements:
|
211
|
+
version_requirements: !ruby/object:Gem::Requirement
|
212
|
+
none: false
|
213
|
+
requirements:
|
214
|
+
- - ~>
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
version: 0.3.0
|
162
217
|
- !ruby/object:Gem::Dependency
|
163
218
|
name: hoe-highline
|
164
|
-
requirement:
|
219
|
+
requirement: !ruby/object:Gem::Requirement
|
165
220
|
none: false
|
166
221
|
requirements:
|
167
222
|
- - ~>
|
@@ -169,10 +224,15 @@ dependencies:
|
|
169
224
|
version: 0.1.0
|
170
225
|
type: :development
|
171
226
|
prerelease: false
|
172
|
-
version_requirements:
|
227
|
+
version_requirements: !ruby/object:Gem::Requirement
|
228
|
+
none: false
|
229
|
+
requirements:
|
230
|
+
- - ~>
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
version: 0.1.0
|
173
233
|
- !ruby/object:Gem::Dependency
|
174
234
|
name: rdoc
|
175
|
-
requirement:
|
235
|
+
requirement: !ruby/object:Gem::Requirement
|
176
236
|
none: false
|
177
237
|
requirements:
|
178
238
|
- - ~>
|
@@ -180,10 +240,15 @@ dependencies:
|
|
180
240
|
version: '3.10'
|
181
241
|
type: :development
|
182
242
|
prerelease: false
|
183
|
-
version_requirements:
|
243
|
+
version_requirements: !ruby/object:Gem::Requirement
|
244
|
+
none: false
|
245
|
+
requirements:
|
246
|
+
- - ~>
|
247
|
+
- !ruby/object:Gem::Version
|
248
|
+
version: '3.10'
|
184
249
|
- !ruby/object:Gem::Dependency
|
185
250
|
name: hoe-deveiate
|
186
|
-
requirement:
|
251
|
+
requirement: !ruby/object:Gem::Requirement
|
187
252
|
none: false
|
188
253
|
requirements:
|
189
254
|
- - ~>
|
@@ -191,10 +256,15 @@ dependencies:
|
|
191
256
|
version: '0.1'
|
192
257
|
type: :development
|
193
258
|
prerelease: false
|
194
|
-
version_requirements:
|
259
|
+
version_requirements: !ruby/object:Gem::Requirement
|
260
|
+
none: false
|
261
|
+
requirements:
|
262
|
+
- - ~>
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: '0.1'
|
195
265
|
- !ruby/object:Gem::Dependency
|
196
266
|
name: simplecov
|
197
|
-
requirement:
|
267
|
+
requirement: !ruby/object:Gem::Requirement
|
198
268
|
none: false
|
199
269
|
requirements:
|
200
270
|
- - ~>
|
@@ -202,10 +272,15 @@ dependencies:
|
|
202
272
|
version: '0.6'
|
203
273
|
type: :development
|
204
274
|
prerelease: false
|
205
|
-
version_requirements:
|
275
|
+
version_requirements: !ruby/object:Gem::Requirement
|
276
|
+
none: false
|
277
|
+
requirements:
|
278
|
+
- - ~>
|
279
|
+
- !ruby/object:Gem::Version
|
280
|
+
version: '0.6'
|
206
281
|
- !ruby/object:Gem::Dependency
|
207
282
|
name: hoe
|
208
|
-
requirement:
|
283
|
+
requirement: !ruby/object:Gem::Requirement
|
209
284
|
none: false
|
210
285
|
requirements:
|
211
286
|
- - ~>
|
@@ -213,7 +288,12 @@ dependencies:
|
|
213
288
|
version: '3.0'
|
214
289
|
type: :development
|
215
290
|
prerelease: false
|
216
|
-
version_requirements:
|
291
|
+
version_requirements: !ruby/object:Gem::Requirement
|
292
|
+
none: false
|
293
|
+
requirements:
|
294
|
+
- - ~>
|
295
|
+
- !ruby/object:Gem::Version
|
296
|
+
version: '3.0'
|
217
297
|
description: ! 'Strelka is a framework for creating and deploying Mongrel2 web applications
|
218
298
|
|
219
299
|
in Ruby, and for managing a Mongrel2 cluster.
|
@@ -254,6 +334,7 @@ files:
|
|
254
334
|
- examples/apps/auth-demo
|
255
335
|
- examples/apps/auth-demo2
|
256
336
|
- examples/apps/sessions-demo
|
337
|
+
- examples/apps/ws-echo
|
257
338
|
- examples/config.yml
|
258
339
|
- examples/gen-config.rb
|
259
340
|
- examples/static/examples.css
|
@@ -268,7 +349,6 @@ files:
|
|
268
349
|
- lib/strelka/app/filters.rb
|
269
350
|
- lib/strelka/app/negotiation.rb
|
270
351
|
- lib/strelka/app/parameters.rb
|
271
|
-
- lib/strelka/app/plugins.rb
|
272
352
|
- lib/strelka/app/restresources.rb
|
273
353
|
- lib/strelka/app/routing.rb
|
274
354
|
- lib/strelka/app/sessions.rb
|
@@ -292,6 +372,7 @@ files:
|
|
292
372
|
- lib/strelka/logging.rb
|
293
373
|
- lib/strelka/mixins.rb
|
294
374
|
- lib/strelka/paramvalidator.rb
|
375
|
+
- lib/strelka/plugins.rb
|
295
376
|
- lib/strelka/router.rb
|
296
377
|
- lib/strelka/router/default.rb
|
297
378
|
- lib/strelka/router/exclusive.rb
|
@@ -308,7 +389,6 @@ files:
|
|
308
389
|
- spec/strelka/app/filters_spec.rb
|
309
390
|
- spec/strelka/app/negotiation_spec.rb
|
310
391
|
- spec/strelka/app/parameters_spec.rb
|
311
|
-
- spec/strelka/app/plugins_spec.rb
|
312
392
|
- spec/strelka/app/restresources_spec.rb
|
313
393
|
- spec/strelka/app/routing_spec.rb
|
314
394
|
- spec/strelka/app/sessions_spec.rb
|
@@ -326,10 +406,12 @@ files:
|
|
326
406
|
- spec/strelka/httprequest/session_spec.rb
|
327
407
|
- spec/strelka/httprequest_spec.rb
|
328
408
|
- spec/strelka/httpresponse/negotiation_spec.rb
|
409
|
+
- spec/strelka/httpresponse/session_spec.rb
|
329
410
|
- spec/strelka/httpresponse_spec.rb
|
330
411
|
- spec/strelka/logging_spec.rb
|
331
412
|
- spec/strelka/mixins_spec.rb
|
332
413
|
- spec/strelka/paramvalidator_spec.rb
|
414
|
+
- spec/strelka/plugins_spec.rb
|
333
415
|
- spec/strelka/router/default_spec.rb
|
334
416
|
- spec/strelka/router/exclusive_spec.rb
|
335
417
|
- spec/strelka/router_spec.rb
|
@@ -362,7 +444,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
362
444
|
version: '0'
|
363
445
|
requirements: []
|
364
446
|
rubyforge_project: strelka
|
365
|
-
rubygems_version: 1.8.
|
447
|
+
rubygems_version: 1.8.21
|
366
448
|
signing_key:
|
367
449
|
specification_version: 3
|
368
450
|
summary: Strelka is a framework for creating and deploying Mongrel2 web applications
|
metadata.gz.sig
CHANGED
Binary file
|