strelka 0.0.1.pre.194 → 0.0.1.pre.199
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +45 -22
- data/bin/strelka +21 -3
- data/lib/strelka/app/errors.rb +45 -29
- data/lib/strelka/app.rb +4 -2
- data/lib/strelka/httprequest.rb +5 -8
- data/lib/strelka/httpresponse.rb +14 -1
- data/lib/strelka/mixins.rb +19 -2
- data/lib/strelka/plugins.rb +14 -0
- data/lib/strelka.rb +8 -2
- data/spec/strelka/app/filters_spec.rb +15 -15
- data/spec/strelka/httpresponse_spec.rb +8 -2
- data.tar.gz.sig +0 -0
- metadata +35 -115
- metadata.gz.sig +0 -0
data/ChangeLog
CHANGED
@@ -1,5 +1,24 @@
|
|
1
|
+
2012-04-19 Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
* lib/strelka/websocketserver.rb:
|
4
|
+
Adding a websocket service base class
|
5
|
+
[149dae18de58] [qbase, qtip, tip, websocketservice.patch]
|
6
|
+
|
7
|
+
* lib/strelka/plugins.rb:
|
8
|
+
Moving application stack dump function to the PluginLoader mixin
|
9
|
+
[3c35f0dd2089] [qparent]
|
10
|
+
|
1
11
|
2012-04-18 Michael Granger <ged@FaerieMUD.org>
|
2
12
|
|
13
|
+
* examples/gen-config.rb, lib/strelka/plugins.rb,
|
14
|
+
spec/strelka/plugins_spec.rb:
|
15
|
+
Fix plugin loading, add a spec for coverage.
|
16
|
+
[0b6ed1f75d7b]
|
17
|
+
|
18
|
+
* Manifest.txt:
|
19
|
+
Updated the manifest
|
20
|
+
[0233fbbfabd9]
|
21
|
+
|
3
22
|
* examples/apps/ws-echo, experiments/reflective-module.rb,
|
4
23
|
lib/strelka/app.rb, lib/strelka/app/auth.rb,
|
5
24
|
lib/strelka/app/errors.rb, lib/strelka/app/filters.rb,
|
@@ -29,7 +48,7 @@
|
|
29
48
|
|
30
49
|
* Strelka::App::Plugin is now Strelka::Plugin
|
31
50
|
* Strelka::App::Plugins is now Strelka::PluginLoader
|
32
|
-
[ea4c4358a943] [
|
51
|
+
[ea4c4358a943] [github/master]
|
33
52
|
|
34
53
|
2012-04-16 Mahlon E. Smith <mahlon@martini.nu>
|
35
54
|
|
@@ -64,7 +83,7 @@
|
|
64
83
|
spec/strelka/app/routing_spec.rb:
|
65
84
|
Add Router#routerclass to subclasses. nil guard for
|
66
85
|
layout_templates.
|
67
|
-
[279f2399ad4a]
|
86
|
+
[279f2399ad4a]
|
68
87
|
|
69
88
|
* Rakefile:
|
70
89
|
Remove outdated Rakefile cruft.
|
@@ -112,16 +131,18 @@
|
|
112
131
|
* Merging with ssh://hg@deveiate.org/Strelka@8f1c27819e70
|
113
132
|
[5fcd76455aad]
|
114
133
|
|
115
|
-
* Manifest.txt:
|
116
|
-
Updating the manifest
|
117
|
-
[35165b3d01cc]
|
118
|
-
|
119
134
|
2012-04-11 Mahlon E. Smith <mahlon@martini.nu>
|
120
135
|
|
121
136
|
* lib/strelka/session/default.rb:
|
122
137
|
Use the built-in securerandom method for obtaining a hex value.
|
123
138
|
[8f1c27819e70]
|
124
139
|
|
140
|
+
2012-04-11 Michael Granger <ged@FaerieMUD.org>
|
141
|
+
|
142
|
+
* Manifest.txt:
|
143
|
+
Updating the manifest
|
144
|
+
[35165b3d01cc]
|
145
|
+
|
125
146
|
2012-04-10 Michael Granger <ged@FaerieMUD.org>
|
126
147
|
|
127
148
|
* lib/strelka/app/auth.rb, lib/strelka/app/parameters.rb,
|
@@ -192,22 +213,6 @@
|
|
192
213
|
Add the ChangeLog to the ignorefile
|
193
214
|
[cc8c30d38652]
|
194
215
|
|
195
|
-
* lib/strelka/app/templating.rb:
|
196
|
-
Add API docs to the :templating plugin module
|
197
|
-
[3c160d996320]
|
198
|
-
|
199
|
-
* README.rdoc:
|
200
|
-
Add more URLs
|
201
|
-
[060962556bd1]
|
202
|
-
|
203
|
-
* Rakefile:
|
204
|
-
Oops. Fix typo
|
205
|
-
[5a8aa207860b]
|
206
|
-
|
207
|
-
* .rvm.gems, Rakefile:
|
208
|
-
Update dependencies
|
209
|
-
[787e523777d1]
|
210
|
-
|
211
216
|
2012-04-06 Mahlon E. Smith <mahlon@martini.nu>
|
212
217
|
|
213
218
|
* lib/strelka/app/sessions.rb, lib/strelka/cookie.rb,
|
@@ -225,6 +230,24 @@
|
|
225
230
|
Add a persistent DB session store, using sequel.
|
226
231
|
[99f3c3f5d6ca]
|
227
232
|
|
233
|
+
2012-04-06 Michael Granger <ged@FaerieMUD.org>
|
234
|
+
|
235
|
+
* lib/strelka/app/templating.rb:
|
236
|
+
Add API docs to the :templating plugin module
|
237
|
+
[3c160d996320]
|
238
|
+
|
239
|
+
* README.rdoc:
|
240
|
+
Add more URLs
|
241
|
+
[060962556bd1]
|
242
|
+
|
243
|
+
* Rakefile:
|
244
|
+
Oops. Fix typo
|
245
|
+
[5a8aa207860b]
|
246
|
+
|
247
|
+
* .rvm.gems, Rakefile:
|
248
|
+
Update dependencies
|
249
|
+
[787e523777d1]
|
250
|
+
|
228
251
|
2012-04-04 Michael Granger <ged@FaerieMUD.org>
|
229
252
|
|
230
253
|
* manual/src/tutorial.page:
|
data/bin/strelka
CHANGED
@@ -197,8 +197,18 @@ class Strelka::CLICommand
|
|
197
197
|
cmd_method = nil
|
198
198
|
|
199
199
|
# Set the datadir override if it's given
|
200
|
-
|
200
|
+
if self.options.datadir
|
201
|
+
self.log.debug "Using data dir option: %s" % [ self.options.datadir ]
|
202
|
+
Strelka.datadir = Pathname( self.options.datadir )
|
203
|
+
elsif File.directory?( 'data' ) && subdir = Dir[ 'data/*' ].first
|
204
|
+
self.log.debug "Using local data dir: %s" % [ subdir ]
|
205
|
+
Strelka.datadir = subdir
|
206
|
+
end
|
207
|
+
|
208
|
+
# Include a 'lib' directory if there is one
|
209
|
+
$LOAD_PATH.unshift( 'lib' ) if File.directory?( 'lib' )
|
201
210
|
|
211
|
+
# Run the command
|
202
212
|
begin
|
203
213
|
cmd_method = self.method( "#{command}_command" )
|
204
214
|
rescue NameError => err
|
@@ -252,7 +262,12 @@ class Strelka::CLICommand
|
|
252
262
|
paths.each do |gemname, paths|
|
253
263
|
message "\n"
|
254
264
|
|
255
|
-
|
265
|
+
if gemname == ''
|
266
|
+
subheader "Local: "
|
267
|
+
else
|
268
|
+
subheader "Gem: #{gemname}"
|
269
|
+
end
|
270
|
+
|
256
271
|
filenames = paths.map {|path| path.basename.to_s }
|
257
272
|
list( filenames )
|
258
273
|
end
|
@@ -271,7 +286,10 @@ class Strelka::CLICommand
|
|
271
286
|
def start_command( *args )
|
272
287
|
path, appname, gemname = self.find_specified_app( *args )
|
273
288
|
|
274
|
-
header "Starting the %s app
|
289
|
+
header "Starting the %s app%s" % [
|
290
|
+
appname,
|
291
|
+
gemname == '' ? '' : " the #{gemname} gem"
|
292
|
+
]
|
275
293
|
fork do
|
276
294
|
self.log.debug " in the child."
|
277
295
|
Strelka.load_config( self.options.config ) if self.options.config
|
data/lib/strelka/app/errors.rb
CHANGED
@@ -8,15 +8,50 @@ require 'strelka/app' unless defined?( Strelka::App )
|
|
8
8
|
|
9
9
|
# Custom error-handling plugin for Strelka::App.
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# plugin :errors
|
12
12
|
#
|
13
|
-
# Handle
|
13
|
+
# # Handle only status 400 errors
|
14
|
+
# on_status HTTP::BAD_REQUEST do |res, status_info|
|
15
|
+
# # Do something on 400 errors
|
16
|
+
# end
|
17
|
+
#
|
18
|
+
# # Handle any other error in the 4xx range
|
19
|
+
# on_status 400..499 do |res, status_info|
|
20
|
+
# # Do something on 4xx errors
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# If you have the <tt>:templating</tt> plugin loaded, you can substitute a
|
24
|
+
# Symbol that corresponds with one of the declared templates instead:
|
25
|
+
#
|
26
|
+
# class MyApp < Strelka::App
|
27
|
+
# plugins :errors, :templating
|
28
|
+
#
|
29
|
+
# layout 'layout.tmpl'
|
30
|
+
# templates :missing => 'errors/missing.tmpl'
|
31
|
+
#
|
32
|
+
# # Load the 'missing' template, wrap it up in the layout
|
33
|
+
# # template and render that as the body of the 404
|
34
|
+
# # response
|
35
|
+
# on_status HTTP::NOT_FOUND, :missing
|
36
|
+
#
|
37
|
+
# end # class MyApp
|
38
|
+
#
|
39
|
+
# The template can access the status info hash via the +:status_info+ note
|
40
|
+
# on the request or response object:
|
41
|
+
#
|
42
|
+
# <!-- error.tmpl -->
|
43
|
+
# Sorry, there was a <?call request.notes[:status_info][:status] ?> error:
|
44
|
+
# <?escape request.notes[:status_info][:message] ?>.
|
45
|
+
#
|
46
|
+
# If you want to do something application-specific for an error, but still use
|
47
|
+
# the default error-handling, just call finish_with again with the status info
|
48
|
+
# from your status handler:
|
14
49
|
#
|
15
50
|
# class MyApp < Strelka::App
|
16
51
|
# plugins :errors
|
17
52
|
#
|
18
53
|
# # Send an email when an app is going to return a 500 error
|
19
|
-
# on_status HTTP::SERVER_ERROR do |res,
|
54
|
+
# on_status HTTP::SERVER_ERROR do |res, info|
|
20
55
|
# require 'mail'
|
21
56
|
# Mail.deliver do
|
22
57
|
# from 'app@example.com'
|
@@ -26,15 +61,20 @@ require 'strelka/app' unless defined?( Strelka::App )
|
|
26
61
|
# body "Server error while running %p [%s]: %s" %
|
27
62
|
# [ self.class, self.conn, status.message ]
|
28
63
|
# end
|
64
|
+
#
|
65
|
+
# # Finish the transaction
|
66
|
+
# finish_with( info )
|
29
67
|
# end
|
30
68
|
#
|
31
69
|
# def handle( req )
|
32
|
-
# finish_with( HTTP::SERVER_ERROR, "
|
70
|
+
# finish_with( HTTP::SERVER_ERROR, "Ack! Something bad happened." )
|
33
71
|
# end
|
34
72
|
#
|
35
73
|
# end # class MyApp
|
36
74
|
#
|
37
|
-
# See the documentation for ClassMethods.on_status for more details
|
75
|
+
# See the documentation for ClassMethods.on_status for more details on the
|
76
|
+
# status-handler block.
|
77
|
+
#
|
38
78
|
module Strelka::App::Errors
|
39
79
|
extend Strelka::Plugin
|
40
80
|
|
@@ -64,16 +104,6 @@ module Strelka::App::Errors
|
|
64
104
|
### +range+. Range can either be a single integer HTTP status code, or a Range
|
65
105
|
### of the same (e.g., 400..499) for all statuses with that range.
|
66
106
|
###
|
67
|
-
### # Handle only status 400 errors
|
68
|
-
### on_status HTTP::BAD_REQUEST do |res, status|
|
69
|
-
### # Do something on 400 errors
|
70
|
-
### end
|
71
|
-
###
|
72
|
-
### # Handle any other error in the 4xx range
|
73
|
-
### on_status 400..499 do |res, status|
|
74
|
-
### # Do something on 4xx errors
|
75
|
-
### end
|
76
|
-
###
|
77
107
|
### If no +range+ is specified, any of the HTTP error statuses will invoke
|
78
108
|
### the callback.
|
79
109
|
###
|
@@ -84,20 +114,6 @@ module Strelka::App::Errors
|
|
84
114
|
### [+:status+] the HTTP status code that was passed to Strelka::App#finish_with
|
85
115
|
### [+:message+] the message string that was passed to Strelka::App#finish_with
|
86
116
|
###
|
87
|
-
### If you have the <tt>:templating</tt> plugin loaded, you can substitute a
|
88
|
-
### Symbol that corresponds with one of the declared templates instead:
|
89
|
-
#### With the templating plugin, you can also handle it via a custom template.
|
90
|
-
###
|
91
|
-
### class MyApp < Strelka::App
|
92
|
-
### plugins :errors, :templating
|
93
|
-
###
|
94
|
-
### layout 'layout.tmpl'
|
95
|
-
### templates :missing => 'errors/missing.tmpl'
|
96
|
-
###
|
97
|
-
### on_status HTTP::NOT_FOUND, :missing
|
98
|
-
###
|
99
|
-
### end # class MyApp
|
100
|
-
###
|
101
117
|
def on_status( range=DEFAULT_HANDLER_STATUS_RANGE, template=nil, &block )
|
102
118
|
range = Range.new( range, range ) unless range.is_a?( Range )
|
103
119
|
methodname = "for_status_%s" % [ range.begin, range.end ].uniq.join('_to_')
|
data/lib/strelka/app.rb
CHANGED
@@ -79,8 +79,10 @@ class Strelka::App < Mongrel2::Handler
|
|
79
79
|
### Return a Hash of Strelka app files as Pathname objects from installed gems,
|
80
80
|
### keyed by gemspec name .
|
81
81
|
def self::discover_paths
|
82
|
+
Strelka.log.debug "Local paths: %s" % [ Strelka.datadir + APP_GLOB_PATTERN ]
|
83
|
+
|
82
84
|
appfiles = {
|
83
|
-
'
|
85
|
+
'' => Pathname.glob( Strelka.datadir + APP_GLOB_PATTERN )
|
84
86
|
}
|
85
87
|
|
86
88
|
# Find all the gems that depend on Strelka
|
@@ -117,7 +119,7 @@ class Strelka::App < Mongrel2::Handler
|
|
117
119
|
Strelka.log.debug "Loading apps from %d discovered paths" % [ app_paths.length ]
|
118
120
|
app_paths.each do |gemname, paths|
|
119
121
|
Strelka.log.debug " loading gem %s" % [ gemname ]
|
120
|
-
gem( gemname ) unless gemname == '
|
122
|
+
gem( gemname ) unless gemname == ''
|
121
123
|
|
122
124
|
Strelka.log.debug " loading apps from %s: %d handlers" % [ gemname, paths.length ]
|
123
125
|
paths.each do |path|
|
data/lib/strelka/httprequest.rb
CHANGED
@@ -10,12 +10,14 @@ require 'mongrel2/httprequest'
|
|
10
10
|
require 'strelka' unless defined?( Strelka )
|
11
11
|
require 'strelka/httpresponse'
|
12
12
|
require 'strelka/cookieset'
|
13
|
+
require 'strelka/mixins'
|
13
14
|
|
14
15
|
# An HTTP request class.
|
15
16
|
class Strelka::HTTPRequest < Mongrel2::HTTPRequest
|
16
17
|
include Strelka::Loggable,
|
17
18
|
Strelka::Constants,
|
18
|
-
Strelka::ResponseHelpers
|
19
|
+
Strelka::ResponseHelpers,
|
20
|
+
Strelka::DataUtilities
|
19
21
|
|
20
22
|
# Set Mongrel2 to use Strelka's request class for HTTP requests
|
21
23
|
register_request_type( self, *HTTP::RFC2616_VERBS )
|
@@ -53,7 +55,8 @@ class Strelka::HTTPRequest < Mongrel2::HTTPRequest
|
|
53
55
|
attr_writer :params
|
54
56
|
|
55
57
|
# A Hash that plugins can use to pass data amongst themselves. The missing-key
|
56
|
-
# callback is set to auto-create nested sub-hashes.
|
58
|
+
# callback is set to auto-create nested sub-hashes. If you create an HTTPResponse
|
59
|
+
# via #response, the response's notes will be shared with its request.
|
57
60
|
attr_reader :notes
|
58
61
|
|
59
62
|
|
@@ -206,10 +209,4 @@ class Strelka::HTTPRequest < Mongrel2::HTTPRequest
|
|
206
209
|
end
|
207
210
|
|
208
211
|
|
209
|
-
### Create and return a Hash that will auto-vivify any values it is missing with
|
210
|
-
### another auto-vivifying Hash.
|
211
|
-
def autovivify( hash, key )
|
212
|
-
hash[ key ] = Hash.new( &method(:autovivify) )
|
213
|
-
end
|
214
|
-
|
215
212
|
end # class Strelka::HTTPRequest
|
data/lib/strelka/httpresponse.rb
CHANGED
@@ -9,7 +9,8 @@ require 'strelka/cookieset'
|
|
9
9
|
# An HTTP response class.
|
10
10
|
class Strelka::HTTPResponse < Mongrel2::HTTPResponse
|
11
11
|
include Strelka::Loggable,
|
12
|
-
Strelka::Constants
|
12
|
+
Strelka::Constants,
|
13
|
+
Strelka::DataUtilities
|
13
14
|
|
14
15
|
|
15
16
|
# Pattern for matching a 'charset' parameter in a media-type string, such as the
|
@@ -22,6 +23,7 @@ class Strelka::HTTPResponse < Mongrel2::HTTPResponse
|
|
22
23
|
@charset = nil
|
23
24
|
@languages = []
|
24
25
|
@encodings = []
|
26
|
+
@notes = Hash.new( &method(:autovivify) )
|
25
27
|
@cookies = nil
|
26
28
|
|
27
29
|
super
|
@@ -53,6 +55,11 @@ class Strelka::HTTPResponse < Mongrel2::HTTPResponse
|
|
53
55
|
# client. Defaults to the empty Array.
|
54
56
|
attr_accessor :languages
|
55
57
|
|
58
|
+
# A auto-vivifying nested Hash that plugins can use to pass data amongst themselves.
|
59
|
+
# The notes hash is shared between the request and response objects if
|
60
|
+
# the request is set on the response with #request=.
|
61
|
+
attr_reader :notes
|
62
|
+
|
56
63
|
|
57
64
|
### Overridden to add charset, encodings, and languages to outgoing
|
58
65
|
### headers if any of them are set.
|
@@ -86,6 +93,12 @@ class Strelka::HTTPResponse < Mongrel2::HTTPResponse
|
|
86
93
|
end
|
87
94
|
|
88
95
|
|
96
|
+
### Set the request object associated with this response to +request+.
|
97
|
+
def request=( request )
|
98
|
+
super
|
99
|
+
@notes = request.notes
|
100
|
+
end
|
101
|
+
|
89
102
|
|
90
103
|
#########
|
91
104
|
protected
|
data/lib/strelka/mixins.rb
CHANGED
@@ -289,6 +289,13 @@ module Strelka
|
|
289
289
|
end
|
290
290
|
end
|
291
291
|
|
292
|
+
|
293
|
+
### Create and return a Hash that will auto-vivify any values it is missing with
|
294
|
+
### another auto-vivifying Hash.
|
295
|
+
def autovivify( hash, key )
|
296
|
+
hash[ key ] = Hash.new( &Strelka::DataUtilities.method(:autovivify) )
|
297
|
+
end
|
298
|
+
|
292
299
|
end # module DataUtilities
|
293
300
|
|
294
301
|
|
@@ -341,8 +348,18 @@ module Strelka
|
|
341
348
|
### http_status code immediately. The specified +message+ will be logged,
|
342
349
|
### and will be included in any message that is returned as part of the
|
343
350
|
### response. The +headers+ hash will be used to set response headers.
|
344
|
-
|
345
|
-
|
351
|
+
### As a shortcut, you can call #finish_with again with the Hash that it
|
352
|
+
### builds to re-throw it.
|
353
|
+
def finish_with( http_status, message=nil, headers={} )
|
354
|
+
status_info = nil
|
355
|
+
|
356
|
+
if http_status.is_a?( Hash ) && http_status.key?(:status)
|
357
|
+
status_info = http_status
|
358
|
+
else
|
359
|
+
message ||= HTTP::STATUS_NAME[ http_status ]
|
360
|
+
status_info = { :status => http_status, :message => message, :headers => headers }
|
361
|
+
end
|
362
|
+
|
346
363
|
throw :finish, status_info
|
347
364
|
end
|
348
365
|
|
data/lib/strelka/plugins.rb
CHANGED
@@ -257,6 +257,20 @@ module Strelka
|
|
257
257
|
self.plugins_installed_from = caller( 1 ).first
|
258
258
|
end
|
259
259
|
|
260
|
+
|
261
|
+
|
262
|
+
### Output the application stack into the logfile.
|
263
|
+
def dump_application_stack
|
264
|
+
stack = self.class.ancestors.
|
265
|
+
reverse.
|
266
|
+
drop_while {|mod| mod != Strelka::PluginLoader }.
|
267
|
+
select {|mod| mod.respond_to?(:plugin_name) }.
|
268
|
+
collect {|mod| mod.plugin_name }.
|
269
|
+
reverse
|
270
|
+
|
271
|
+
self.log.info "Application stack: request -> %s" % [ stack.join(" -> ") ]
|
272
|
+
end
|
273
|
+
|
260
274
|
end # module PluginLoader
|
261
275
|
|
262
276
|
end # class Strelka
|
data/lib/strelka.rb
CHANGED
@@ -21,7 +21,7 @@ module Strelka
|
|
21
21
|
VERSION = '0.0.1'
|
22
22
|
|
23
23
|
# Version-control revision constant
|
24
|
-
REVISION = %q$Revision:
|
24
|
+
REVISION = %q$Revision: c3e9ce4035b6 $
|
25
25
|
|
26
26
|
|
27
27
|
require 'strelka/logging'
|
@@ -51,9 +51,15 @@ module Strelka
|
|
51
51
|
##
|
52
52
|
# The Pathname of the directory that will be searched for default applications,
|
53
53
|
# config, etc.
|
54
|
-
|
54
|
+
singleton_attr_reader :datadir
|
55
|
+
|
56
|
+
### Set the local data directory to +dir+.
|
57
|
+
def self::datadir=( dir )
|
58
|
+
@datadir = Pathname( dir )
|
59
|
+
end
|
55
60
|
self.datadir = DEFAULT_DATADIR
|
56
61
|
|
62
|
+
|
57
63
|
require 'strelka/app'
|
58
64
|
require 'strelka/httprequest'
|
59
65
|
require 'strelka/httpresponse'
|
@@ -88,10 +88,10 @@ describe Strelka::App::Filters do
|
|
88
88
|
before( :each ) do
|
89
89
|
@app.class_eval do
|
90
90
|
filter do |reqres|
|
91
|
-
if reqres.
|
92
|
-
reqres.notes[:
|
91
|
+
if reqres.is_a?( Strelka::HTTPRequest )
|
92
|
+
reqres.notes[:saw][:request] = true
|
93
93
|
else
|
94
|
-
reqres.
|
94
|
+
reqres.notes[:saw][:response] = true
|
95
95
|
end
|
96
96
|
end
|
97
97
|
end
|
@@ -117,8 +117,8 @@ describe Strelka::App::Filters do
|
|
117
117
|
|
118
118
|
res = @app.new.handle( req )
|
119
119
|
|
120
|
-
req.notes[:
|
121
|
-
res.
|
120
|
+
req.notes[:saw][:request].should be_true()
|
121
|
+
res.notes[:saw][:response].should be_true()
|
122
122
|
end
|
123
123
|
|
124
124
|
end
|
@@ -128,10 +128,10 @@ describe Strelka::App::Filters do
|
|
128
128
|
before( :each ) do
|
129
129
|
@app.class_eval do
|
130
130
|
filter( :request ) do |reqres|
|
131
|
-
if reqres.
|
132
|
-
reqres.notes[:
|
131
|
+
if reqres.is_a?( Strelka::HTTPRequest )
|
132
|
+
reqres.notes[:saw][:request] = true
|
133
133
|
else
|
134
|
-
reqres.
|
134
|
+
reqres.notes[:saw][:response] = true
|
135
135
|
end
|
136
136
|
end
|
137
137
|
end
|
@@ -157,8 +157,8 @@ describe Strelka::App::Filters do
|
|
157
157
|
|
158
158
|
res = @app.new.handle( req )
|
159
159
|
|
160
|
-
req.notes[:
|
161
|
-
res.
|
160
|
+
req.notes[:saw][:request].should be_true()
|
161
|
+
res.notes[:saw][:response].should be_empty()
|
162
162
|
end
|
163
163
|
|
164
164
|
end
|
@@ -168,10 +168,10 @@ describe Strelka::App::Filters do
|
|
168
168
|
before( :each ) do
|
169
169
|
@app.class_eval do
|
170
170
|
filter( :response ) do |reqres|
|
171
|
-
if reqres.
|
172
|
-
reqres.notes[:
|
171
|
+
if reqres.is_a?( Strelka::HTTPRequest )
|
172
|
+
reqres.notes[:saw][:request] = true
|
173
173
|
else
|
174
|
-
reqres.
|
174
|
+
reqres.notes[:saw][:response] = true
|
175
175
|
end
|
176
176
|
end
|
177
177
|
end
|
@@ -197,8 +197,8 @@ describe Strelka::App::Filters do
|
|
197
197
|
|
198
198
|
res = @app.new.handle( req )
|
199
199
|
|
200
|
-
req.notes[:
|
201
|
-
res.
|
200
|
+
req.notes[:saw][:request].should be_empty()
|
201
|
+
res.notes[:saw][:response].should be_true()
|
202
202
|
end
|
203
203
|
|
204
204
|
end
|
@@ -25,7 +25,8 @@ describe Strelka::HTTPResponse do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
before( :each ) do
|
28
|
-
@
|
28
|
+
@req = @request_factory.get( '/glossary/reduct' )
|
29
|
+
@res = @req.response
|
29
30
|
end
|
30
31
|
|
31
32
|
after( :all ) do
|
@@ -116,12 +117,17 @@ describe Strelka::HTTPResponse do
|
|
116
117
|
@res.header_data.should =~ /set-cookie: foom=chuckufarly/i
|
117
118
|
end
|
118
119
|
|
119
|
-
it "allows cookies to appended" do
|
120
|
+
it "allows cookies to be appended" do
|
120
121
|
@res.cookies << Strelka::Cookie.new( 'session', '64a3a92eb7403a8199301e03e8b83810' )
|
121
122
|
@res.cookies << Strelka::Cookie.new( 'cn', '18', :expires => '+1d' )
|
122
123
|
@res.header_data.should =~ /set-cookie: session=64a3a92eb7403a8199301e03e8b83810/i
|
123
124
|
@res.header_data.should =~ /set-cookie: cn=18; expires=/i
|
124
125
|
end
|
125
126
|
|
127
|
+
|
128
|
+
it "shares a 'notes' Hash with its associated request" do
|
129
|
+
@res.notes.should be( @req.notes )
|
130
|
+
end
|
131
|
+
|
126
132
|
end
|
127
133
|
|
data.tar.gz.sig
CHANGED
Binary file
|
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.199
|
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-20 00:00:00.000000000 Z
|
40
40
|
dependencies:
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: trollop
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirement: &70346770348920 !ruby/object:Gem::Requirement
|
44
44
|
none: false
|
45
45
|
requirements:
|
46
46
|
- - ~>
|
@@ -48,15 +48,10 @@ dependencies:
|
|
48
48
|
version: '1.16'
|
49
49
|
type: :runtime
|
50
50
|
prerelease: false
|
51
|
-
version_requirements:
|
52
|
-
none: false
|
53
|
-
requirements:
|
54
|
-
- - ~>
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
version: '1.16'
|
51
|
+
version_requirements: *70346770348920
|
57
52
|
- !ruby/object:Gem::Dependency
|
58
53
|
name: highline
|
59
|
-
requirement: !ruby/object:Gem::Requirement
|
54
|
+
requirement: &70346770348380 !ruby/object:Gem::Requirement
|
60
55
|
none: false
|
61
56
|
requirements:
|
62
57
|
- - ~>
|
@@ -64,15 +59,10 @@ dependencies:
|
|
64
59
|
version: '1.6'
|
65
60
|
type: :runtime
|
66
61
|
prerelease: false
|
67
|
-
version_requirements:
|
68
|
-
none: false
|
69
|
-
requirements:
|
70
|
-
- - ~>
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: '1.6'
|
62
|
+
version_requirements: *70346770348380
|
73
63
|
- !ruby/object:Gem::Dependency
|
74
64
|
name: sysexits
|
75
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
+
requirement: &70346770347880 !ruby/object:Gem::Requirement
|
76
66
|
none: false
|
77
67
|
requirements:
|
78
68
|
- - ~>
|
@@ -80,15 +70,10 @@ dependencies:
|
|
80
70
|
version: '1.0'
|
81
71
|
type: :runtime
|
82
72
|
prerelease: false
|
83
|
-
version_requirements:
|
84
|
-
none: false
|
85
|
-
requirements:
|
86
|
-
- - ~>
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
version: '1.0'
|
73
|
+
version_requirements: *70346770347880
|
89
74
|
- !ruby/object:Gem::Dependency
|
90
75
|
name: formvalidator
|
91
|
-
requirement: !ruby/object:Gem::Requirement
|
76
|
+
requirement: &70346770347340 !ruby/object:Gem::Requirement
|
92
77
|
none: false
|
93
78
|
requirements:
|
94
79
|
- - ~>
|
@@ -96,15 +81,10 @@ dependencies:
|
|
96
81
|
version: '0.1'
|
97
82
|
type: :runtime
|
98
83
|
prerelease: false
|
99
|
-
version_requirements:
|
100
|
-
none: false
|
101
|
-
requirements:
|
102
|
-
- - ~>
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
version: '0.1'
|
84
|
+
version_requirements: *70346770347340
|
105
85
|
- !ruby/object:Gem::Dependency
|
106
86
|
name: inversion
|
107
|
-
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirement: &70346770346760 !ruby/object:Gem::Requirement
|
108
88
|
none: false
|
109
89
|
requirements:
|
110
90
|
- - ~>
|
@@ -112,15 +92,10 @@ dependencies:
|
|
112
92
|
version: '0.8'
|
113
93
|
type: :runtime
|
114
94
|
prerelease: false
|
115
|
-
version_requirements:
|
116
|
-
none: false
|
117
|
-
requirements:
|
118
|
-
- - ~>
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
version: '0.8'
|
95
|
+
version_requirements: *70346770346760
|
121
96
|
- !ruby/object:Gem::Dependency
|
122
97
|
name: mongrel2
|
123
|
-
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirement: &70346770346280 !ruby/object:Gem::Requirement
|
124
99
|
none: false
|
125
100
|
requirements:
|
126
101
|
- - ~>
|
@@ -128,15 +103,10 @@ dependencies:
|
|
128
103
|
version: '0.20'
|
129
104
|
type: :runtime
|
130
105
|
prerelease: false
|
131
|
-
version_requirements:
|
132
|
-
none: false
|
133
|
-
requirements:
|
134
|
-
- - ~>
|
135
|
-
- !ruby/object:Gem::Version
|
136
|
-
version: '0.20'
|
106
|
+
version_requirements: *70346770346280
|
137
107
|
- !ruby/object:Gem::Dependency
|
138
108
|
name: uuidtools
|
139
|
-
requirement: !ruby/object:Gem::Requirement
|
109
|
+
requirement: &70346770345820 !ruby/object:Gem::Requirement
|
140
110
|
none: false
|
141
111
|
requirements:
|
142
112
|
- - ~>
|
@@ -144,15 +114,10 @@ dependencies:
|
|
144
114
|
version: '2.1'
|
145
115
|
type: :runtime
|
146
116
|
prerelease: false
|
147
|
-
version_requirements:
|
148
|
-
none: false
|
149
|
-
requirements:
|
150
|
-
- - ~>
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '2.1'
|
117
|
+
version_requirements: *70346770345820
|
153
118
|
- !ruby/object:Gem::Dependency
|
154
119
|
name: configurability
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirement: &70346899262780 !ruby/object:Gem::Requirement
|
156
121
|
none: false
|
157
122
|
requirements:
|
158
123
|
- - ~>
|
@@ -160,15 +125,10 @@ dependencies:
|
|
160
125
|
version: '1.0'
|
161
126
|
type: :runtime
|
162
127
|
prerelease: false
|
163
|
-
version_requirements:
|
164
|
-
none: false
|
165
|
-
requirements:
|
166
|
-
- - ~>
|
167
|
-
- !ruby/object:Gem::Version
|
168
|
-
version: '1.0'
|
128
|
+
version_requirements: *70346899262780
|
169
129
|
- !ruby/object:Gem::Dependency
|
170
130
|
name: pluginfactory
|
171
|
-
requirement: !ruby/object:Gem::Requirement
|
131
|
+
requirement: &70346899262200 !ruby/object:Gem::Requirement
|
172
132
|
none: false
|
173
133
|
requirements:
|
174
134
|
- - ~>
|
@@ -176,15 +136,10 @@ dependencies:
|
|
176
136
|
version: '1.0'
|
177
137
|
type: :runtime
|
178
138
|
prerelease: false
|
179
|
-
version_requirements:
|
180
|
-
none: false
|
181
|
-
requirements:
|
182
|
-
- - ~>
|
183
|
-
- !ruby/object:Gem::Version
|
184
|
-
version: '1.0'
|
139
|
+
version_requirements: *70346899262200
|
185
140
|
- !ruby/object:Gem::Dependency
|
186
141
|
name: hoe-mercurial
|
187
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirement: &70346899261640 !ruby/object:Gem::Requirement
|
188
143
|
none: false
|
189
144
|
requirements:
|
190
145
|
- - ~>
|
@@ -192,15 +147,10 @@ dependencies:
|
|
192
147
|
version: 1.4.0
|
193
148
|
type: :development
|
194
149
|
prerelease: false
|
195
|
-
version_requirements:
|
196
|
-
none: false
|
197
|
-
requirements:
|
198
|
-
- - ~>
|
199
|
-
- !ruby/object:Gem::Version
|
200
|
-
version: 1.4.0
|
150
|
+
version_requirements: *70346899261640
|
201
151
|
- !ruby/object:Gem::Dependency
|
202
152
|
name: hoe-manualgen
|
203
|
-
requirement: !ruby/object:Gem::Requirement
|
153
|
+
requirement: &70346899261120 !ruby/object:Gem::Requirement
|
204
154
|
none: false
|
205
155
|
requirements:
|
206
156
|
- - ~>
|
@@ -208,15 +158,10 @@ dependencies:
|
|
208
158
|
version: 0.3.0
|
209
159
|
type: :development
|
210
160
|
prerelease: false
|
211
|
-
version_requirements:
|
212
|
-
none: false
|
213
|
-
requirements:
|
214
|
-
- - ~>
|
215
|
-
- !ruby/object:Gem::Version
|
216
|
-
version: 0.3.0
|
161
|
+
version_requirements: *70346899261120
|
217
162
|
- !ruby/object:Gem::Dependency
|
218
163
|
name: hoe-highline
|
219
|
-
requirement: !ruby/object:Gem::Requirement
|
164
|
+
requirement: &70346899260640 !ruby/object:Gem::Requirement
|
220
165
|
none: false
|
221
166
|
requirements:
|
222
167
|
- - ~>
|
@@ -224,15 +169,10 @@ dependencies:
|
|
224
169
|
version: 0.1.0
|
225
170
|
type: :development
|
226
171
|
prerelease: false
|
227
|
-
version_requirements:
|
228
|
-
none: false
|
229
|
-
requirements:
|
230
|
-
- - ~>
|
231
|
-
- !ruby/object:Gem::Version
|
232
|
-
version: 0.1.0
|
172
|
+
version_requirements: *70346899260640
|
233
173
|
- !ruby/object:Gem::Dependency
|
234
174
|
name: rdoc
|
235
|
-
requirement: !ruby/object:Gem::Requirement
|
175
|
+
requirement: &70346899260100 !ruby/object:Gem::Requirement
|
236
176
|
none: false
|
237
177
|
requirements:
|
238
178
|
- - ~>
|
@@ -240,15 +180,10 @@ dependencies:
|
|
240
180
|
version: '3.10'
|
241
181
|
type: :development
|
242
182
|
prerelease: false
|
243
|
-
version_requirements:
|
244
|
-
none: false
|
245
|
-
requirements:
|
246
|
-
- - ~>
|
247
|
-
- !ruby/object:Gem::Version
|
248
|
-
version: '3.10'
|
183
|
+
version_requirements: *70346899260100
|
249
184
|
- !ruby/object:Gem::Dependency
|
250
185
|
name: hoe-deveiate
|
251
|
-
requirement: !ruby/object:Gem::Requirement
|
186
|
+
requirement: &70346899259600 !ruby/object:Gem::Requirement
|
252
187
|
none: false
|
253
188
|
requirements:
|
254
189
|
- - ~>
|
@@ -256,15 +191,10 @@ dependencies:
|
|
256
191
|
version: '0.1'
|
257
192
|
type: :development
|
258
193
|
prerelease: false
|
259
|
-
version_requirements:
|
260
|
-
none: false
|
261
|
-
requirements:
|
262
|
-
- - ~>
|
263
|
-
- !ruby/object:Gem::Version
|
264
|
-
version: '0.1'
|
194
|
+
version_requirements: *70346899259600
|
265
195
|
- !ruby/object:Gem::Dependency
|
266
196
|
name: simplecov
|
267
|
-
requirement: !ruby/object:Gem::Requirement
|
197
|
+
requirement: &70346899259040 !ruby/object:Gem::Requirement
|
268
198
|
none: false
|
269
199
|
requirements:
|
270
200
|
- - ~>
|
@@ -272,15 +202,10 @@ dependencies:
|
|
272
202
|
version: '0.6'
|
273
203
|
type: :development
|
274
204
|
prerelease: false
|
275
|
-
version_requirements:
|
276
|
-
none: false
|
277
|
-
requirements:
|
278
|
-
- - ~>
|
279
|
-
- !ruby/object:Gem::Version
|
280
|
-
version: '0.6'
|
205
|
+
version_requirements: *70346899259040
|
281
206
|
- !ruby/object:Gem::Dependency
|
282
207
|
name: hoe
|
283
|
-
requirement: !ruby/object:Gem::Requirement
|
208
|
+
requirement: &70346899258540 !ruby/object:Gem::Requirement
|
284
209
|
none: false
|
285
210
|
requirements:
|
286
211
|
- - ~>
|
@@ -288,12 +213,7 @@ dependencies:
|
|
288
213
|
version: '3.0'
|
289
214
|
type: :development
|
290
215
|
prerelease: false
|
291
|
-
version_requirements:
|
292
|
-
none: false
|
293
|
-
requirements:
|
294
|
-
- - ~>
|
295
|
-
- !ruby/object:Gem::Version
|
296
|
-
version: '3.0'
|
216
|
+
version_requirements: *70346899258540
|
297
217
|
description: ! 'Strelka is a framework for creating and deploying Mongrel2 web applications
|
298
218
|
|
299
219
|
in Ruby, and for managing a Mongrel2 cluster.
|
@@ -444,7 +364,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
444
364
|
version: '0'
|
445
365
|
requirements: []
|
446
366
|
rubyforge_project: strelka
|
447
|
-
rubygems_version: 1.8.
|
367
|
+
rubygems_version: 1.8.16
|
448
368
|
signing_key:
|
449
369
|
specification_version: 3
|
450
370
|
summary: Strelka is a framework for creating and deploying Mongrel2 web applications
|
metadata.gz.sig
CHANGED
Binary file
|