strelka 0.0.1.pre177 → 0.0.1.pre184
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +111 -16
- data/Manifest.txt +8 -8
- data/Rakefile +3 -3
- data/bin/leash +51 -28
- data/examples/{auth-demo.rb → apps/auth-demo} +3 -3
- data/examples/{auth-demo2.rb → apps/auth-demo2} +0 -0
- data/examples/{sessions-demo.rb → apps/sessions-demo} +0 -0
- data/examples/config.yml +5 -1
- data/examples/{examples.css → static/examples.css} +0 -0
- data/examples/{examples.html → static/examples.html} +0 -0
- data/examples/{auth-form.tmpl → templates/auth-form.tmpl} +0 -0
- data/examples/{auth-success.tmpl → templates/auth-success.tmpl} +0 -0
- data/examples/{layout.tmpl → templates/layout.tmpl} +0 -0
- data/lib/strelka/app/auth.rb +18 -8
- data/lib/strelka/app/errors.rb +3 -2
- data/lib/strelka/app/filters.rb +2 -0
- data/lib/strelka/app/negotiation.rb +2 -0
- data/lib/strelka/app/parameters.rb +18 -140
- data/lib/strelka/app/plugins.rb +84 -26
- data/lib/strelka/app/restresources.rb +26 -18
- data/lib/strelka/app/routing.rb +8 -2
- data/lib/strelka/app/sessions.rb +7 -0
- data/lib/strelka/app/templating.rb +1 -1
- data/lib/strelka/app.rb +25 -1
- data/lib/strelka/constants.rb +3 -1
- data/lib/strelka/paramvalidator.rb +251 -74
- data/lib/strelka/session/default.rb +1 -1
- data/spec/strelka/app/auth_spec.rb +37 -0
- data/spec/strelka/app/errors_spec.rb +0 -2
- data/spec/strelka/app/filters_spec.rb +1 -1
- data/spec/strelka/app/parameters_spec.rb +4 -92
- data/spec/strelka/app/plugins_spec.rb +64 -2
- data/spec/strelka/app/restresources_spec.rb +3 -0
- data/spec/strelka/app/routing_spec.rb +5 -5
- data/spec/strelka/paramvalidator_spec.rb +294 -385
- data.tar.gz.sig +0 -0
- metadata +126 -46
- metadata.gz.sig +0 -0
data/ChangeLog
CHANGED
@@ -1,22 +1,100 @@
|
|
1
|
-
2012-04-
|
1
|
+
2012-04-11 Michael Granger <ged@FaerieMUD.org>
|
2
2
|
|
3
|
-
* lib/strelka/app
|
4
|
-
lib/strelka/
|
5
|
-
lib/strelka/
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
* Rakefile, lib/strelka/app.rb, lib/strelka/app/auth.rb,
|
4
|
+
lib/strelka/app/errors.rb, lib/strelka/app/filters.rb,
|
5
|
+
lib/strelka/app/negotiation.rb, lib/strelka/app/parameters.rb,
|
6
|
+
lib/strelka/app/plugins.rb, lib/strelka/app/restresources.rb,
|
7
|
+
lib/strelka/app/routing.rb, lib/strelka/app/sessions.rb,
|
8
|
+
spec/strelka/app/auth_spec.rb, spec/strelka/app/errors_spec.rb,
|
9
|
+
spec/strelka/app/filters_spec.rb, spec/strelka/app/plugins_spec.rb,
|
10
|
+
spec/strelka/app/restresources_spec.rb,
|
11
|
+
spec/strelka/app/routing_spec.rb:
|
12
|
+
Fixing specs broken by the deferred plugins change. Ugh, I suck.
|
13
|
+
[d762ebcce3a6] [tip]
|
10
14
|
|
11
|
-
*
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
[
|
15
|
+
* Merging with ssh://hg@deveiate.org/Strelka@8f1c27819e70
|
16
|
+
[5fcd76455aad]
|
17
|
+
|
18
|
+
* Manifest.txt:
|
19
|
+
Updating the manifest
|
20
|
+
[35165b3d01cc]
|
21
|
+
|
22
|
+
2012-04-11 Mahlon E. Smith <mahlon@martini.nu>
|
23
|
+
|
24
|
+
* lib/strelka/session/default.rb:
|
25
|
+
Use the built-in securerandom method for obtaining a hex value.
|
26
|
+
[8f1c27819e70]
|
27
|
+
|
28
|
+
2012-04-10 Michael Granger <ged@FaerieMUD.org>
|
29
|
+
|
30
|
+
* lib/strelka/app/auth.rb, lib/strelka/app/parameters.rb,
|
31
|
+
lib/strelka/app/restresources.rb, lib/strelka/app/routing.rb,
|
32
|
+
lib/strelka/paramvalidator.rb, spec/strelka/app/auth_spec.rb,
|
33
|
+
spec/strelka/app/parameters_spec.rb,
|
34
|
+
spec/strelka/app/routing_spec.rb,
|
35
|
+
spec/strelka/paramvalidator_spec.rb:
|
36
|
+
Rework the paramvalidator and parameters plugin to allow per-request
|
37
|
+
overrides
|
38
|
+
[e7393474988b]
|
39
|
+
|
40
|
+
* bin/leash, examples/apps/auth-demo, examples/apps/auth-demo2,
|
41
|
+
examples/apps/sessions-demo, examples/auth-demo.rb, examples/auth-
|
42
|
+
demo2.rb, examples/auth-form.tmpl, examples/auth-success.tmpl,
|
43
|
+
examples/config.yml, examples/examples.css, examples/examples.html,
|
44
|
+
examples/layout.tmpl, examples/sessions-demo.rb,
|
45
|
+
examples/static/examples.css, examples/static/examples.html,
|
46
|
+
examples/templates/auth-form.tmpl, examples/templates/auth-
|
47
|
+
success.tmpl, examples/templates/layout.tmpl, lib/strelka/app.rb,
|
48
|
+
lib/strelka/app/auth.rb, lib/strelka/app/plugins.rb,
|
49
|
+
lib/strelka/constants.rb, spec/strelka/app/plugins_spec.rb:
|
50
|
+
Modify the plugins mixin to defer adding the mixin part of plugins
|
51
|
+
as long as possible.
|
52
|
+
|
53
|
+
This allows someone to call plugin/plugins multiple times without
|
54
|
+
having to worry about what order they're called in, and makes using
|
55
|
+
a common Strelka::App subclass for a suite of applications easier.
|
56
|
+
[546809f3204f]
|
57
|
+
|
58
|
+
2012-04-09 Mahlon E. Smith <mahlon@martini.nu>
|
59
|
+
|
60
|
+
* lib/strelka/app/templating.rb:
|
61
|
+
Ensure the templating plugin runs before the errors plugin, so
|
62
|
+
symbols are properly converted to Strelka::HTTPResponse objects
|
63
|
+
before errors see them.
|
64
|
+
[9423c8ba3ee0]
|
17
65
|
|
18
66
|
2012-04-06 Michael Granger <ged@FaerieMUD.org>
|
19
67
|
|
68
|
+
* lib/strelka/session/db.rb:
|
69
|
+
Change the DB session class to default to Mongrel2's in-memory DB.
|
70
|
+
|
71
|
+
Use Mongrel2's in-memory config db for unconfigured db sessions
|
72
|
+
instead of depending on the sqlite3 gem.
|
73
|
+
[2a1129fed218]
|
74
|
+
|
75
|
+
* Manifest.txt:
|
76
|
+
Update the manifest
|
77
|
+
[54d6bde6cb0c]
|
78
|
+
|
79
|
+
* Merged with 49e538cdee68
|
80
|
+
[05d72a2ed8cc]
|
81
|
+
|
82
|
+
* lib/strelka.rb:
|
83
|
+
Set some RDoc metadata from the main module
|
84
|
+
[28465ed81190]
|
85
|
+
|
86
|
+
* lib/strelka/logging.rb:
|
87
|
+
Remove ERB dependency from the HTML logger
|
88
|
+
[6e6a14f86dc6]
|
89
|
+
|
90
|
+
* spec/lib/helpers.rb:
|
91
|
+
Update the setup_config_db helper for Mongrel2-0.20.x
|
92
|
+
[9f5393deb2da]
|
93
|
+
|
94
|
+
* .hgignore:
|
95
|
+
Add the ChangeLog to the ignorefile
|
96
|
+
[cc8c30d38652]
|
97
|
+
|
20
98
|
* lib/strelka/app/templating.rb:
|
21
99
|
Add API docs to the :templating plugin module
|
22
100
|
[3c160d996320]
|
@@ -33,11 +111,28 @@
|
|
33
111
|
Update dependencies
|
34
112
|
[787e523777d1]
|
35
113
|
|
114
|
+
2012-04-06 Mahlon E. Smith <mahlon@martini.nu>
|
115
|
+
|
116
|
+
* lib/strelka/app/sessions.rb, lib/strelka/cookie.rb,
|
117
|
+
lib/strelka/cookieset.rb, lib/strelka/session.rb,
|
118
|
+
lib/strelka/session/db.rb, lib/strelka/session/default.rb,
|
119
|
+
spec/strelka/cookie_spec.rb, spec/strelka/session/db_spec.rb,
|
120
|
+
spec/strelka/session/default_spec.rb:
|
121
|
+
Expose cookie options to the default and db session stores.
|
122
|
+
[49e538cdee68]
|
123
|
+
|
124
|
+
* Manifest.txt, lib/strelka/app/sessions.rb, lib/strelka/session.rb,
|
125
|
+
lib/strelka/session/db.rb, lib/strelka/session/default.rb,
|
126
|
+
spec/strelka/session/db_spec.rb,
|
127
|
+
spec/strelka/session/default_spec.rb:
|
128
|
+
Add a persistent DB session store, using sequel.
|
129
|
+
[99f3c3f5d6ca]
|
130
|
+
|
36
131
|
2012-04-04 Michael Granger <ged@FaerieMUD.org>
|
37
132
|
|
38
133
|
* manual/src/tutorial.page:
|
39
134
|
Add a bit more content to the manual.
|
40
|
-
[79a26c9e4dd5]
|
135
|
+
[79a26c9e4dd5]
|
41
136
|
|
42
137
|
2012-04-02 Michael Granger <ged@FaerieMUD.org>
|
43
138
|
|
@@ -88,7 +183,7 @@
|
|
88
183
|
* examples/auth-demo.rb, lib/strelka/app/auth.rb,
|
89
184
|
lib/strelka/authprovider.rb, spec/strelka/app/auth_spec.rb:
|
90
185
|
Merging with accidentally-committed auth patch on Github
|
91
|
-
[3025b5711352]
|
186
|
+
[3025b5711352] [github/master]
|
92
187
|
|
93
188
|
2012-03-20 Michael Granger <ged@FaerieMUD.org>
|
94
189
|
|
data/Manifest.txt
CHANGED
@@ -16,16 +16,16 @@ contrib/hoetemplate/data/project/templates/top.tmpl.erb
|
|
16
16
|
contrib/hoetemplate/lib/file_name.rb.erb
|
17
17
|
contrib/hoetemplate/spec/file_name_spec.rb.erb
|
18
18
|
data/strelka/apps/hello-world
|
19
|
-
examples/auth-demo
|
20
|
-
examples/auth-demo2
|
21
|
-
examples/
|
22
|
-
examples/auth-success.tmpl
|
19
|
+
examples/apps/auth-demo
|
20
|
+
examples/apps/auth-demo2
|
21
|
+
examples/apps/sessions-demo
|
23
22
|
examples/config.yml
|
24
|
-
examples/examples.css
|
25
|
-
examples/examples.html
|
26
23
|
examples/gen-config.rb
|
27
|
-
examples/
|
28
|
-
examples/
|
24
|
+
examples/static/examples.css
|
25
|
+
examples/static/examples.html
|
26
|
+
examples/templates/auth-form.tmpl
|
27
|
+
examples/templates/auth-success.tmpl
|
28
|
+
examples/templates/layout.tmpl
|
29
29
|
lib/strelka.rb
|
30
30
|
lib/strelka/app.rb
|
31
31
|
lib/strelka/app/auth.rb
|
data/Rakefile
CHANGED
@@ -25,11 +25,11 @@ hoespec = Hoe.spec 'strelka' do
|
|
25
25
|
self.dependency 'highline', '~> 1.6'
|
26
26
|
self.dependency 'sysexits', '~> 1.0'
|
27
27
|
self.dependency 'formvalidator', '~> 0.1'
|
28
|
-
self.dependency 'inversion
|
28
|
+
self.dependency 'inversion', '~> 0.8'
|
29
29
|
self.dependency 'mongrel2', '~> 0.20'
|
30
|
-
self.dependency 'uuidtools
|
30
|
+
self.dependency 'uuidtools', '~> 2.1'
|
31
31
|
self.dependency 'configurability', '~> 1.0'
|
32
|
-
self.dependency 'pluginfactory
|
32
|
+
self.dependency 'pluginfactory', '~> 1.0'
|
33
33
|
|
34
34
|
self.dependency 'hoe-deveiate', '~> 0.1', :developer
|
35
35
|
self.dependency 'hoe-manualgen', '~> 0.3', :developer
|
data/bin/leash
CHANGED
@@ -103,7 +103,7 @@ class Strelka::LeashCommand
|
|
103
103
|
text ''
|
104
104
|
|
105
105
|
text 'Global Options'
|
106
|
-
opt :config, "Specify the config file to load."
|
106
|
+
opt :config, "Specify the config file to load.", :type => :string
|
107
107
|
text ''
|
108
108
|
|
109
109
|
text 'Other Options:'
|
@@ -163,7 +163,7 @@ class Strelka::LeashCommand
|
|
163
163
|
### Create a new instance of the command and set it up with the given
|
164
164
|
### +options+.
|
165
165
|
def initialize( options )
|
166
|
-
Strelka.logger.formatter = Strelka::Logging::ColorFormatter.new( Strelka.logger )
|
166
|
+
Strelka.logger.formatter = Strelka::Logging::ColorFormatter.new( Strelka.logger ) if $stderr.tty?
|
167
167
|
@options = options
|
168
168
|
|
169
169
|
if @options.debug
|
@@ -196,8 +196,8 @@ class Strelka::LeashCommand
|
|
196
196
|
|
197
197
|
begin
|
198
198
|
cmd_method = self.method( "#{command}_command" )
|
199
|
-
rescue
|
200
|
-
error "No such command"
|
199
|
+
rescue NameError => err
|
200
|
+
error "No such command %p" % [ command ]
|
201
201
|
exit :usage
|
202
202
|
end
|
203
203
|
|
@@ -264,8 +264,19 @@ class Strelka::LeashCommand
|
|
264
264
|
|
265
265
|
### The 'start' command
|
266
266
|
def start_command( *args )
|
267
|
+
path, appname, gemname = self.find_specified_app( *args )
|
268
|
+
|
269
|
+
header "Starting the %s app from the %s gem" % [ appname, gemname ]
|
270
|
+
fork do
|
271
|
+
self.log.debug " in the child."
|
272
|
+
Strelka.load_config( self.options.config ) if self.options.config
|
273
|
+
Kernel.load( path )
|
274
|
+
end
|
275
|
+
|
276
|
+
message "started. Waiting for shutdown."
|
277
|
+
Process.wait
|
267
278
|
end
|
268
|
-
help :start, "Start
|
279
|
+
help :start, "Start a Strelka app"
|
269
280
|
|
270
281
|
|
271
282
|
### The 'version' command
|
@@ -276,36 +287,48 @@ class Strelka::LeashCommand
|
|
276
287
|
|
277
288
|
|
278
289
|
#
|
279
|
-
#
|
290
|
+
# Helper methods
|
280
291
|
#
|
281
292
|
|
282
|
-
###
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
293
|
+
### Find the app specified in the specified +args+ and return the Pathname to it and the
|
294
|
+
### name of the gem it belongs to. Raises a RuntimeError if the +args+ didn't contain a
|
295
|
+
### valid application specification.
|
296
|
+
def find_specified_app( *args )
|
297
|
+
appname = args.pop
|
298
|
+
gemname = args.pop
|
299
|
+
discovered_apps = Strelka::App.discover_paths
|
300
|
+
|
301
|
+
path = nil
|
302
|
+
if gemname
|
303
|
+
discovered_apps[ gemname ].each do |apppath|
|
304
|
+
self.log.debug " %s (%s)" % [ apppath, apppath.basename('.rb') ]
|
305
|
+
if apppath.basename('.rb').to_s == appname
|
306
|
+
path = apppath
|
307
|
+
break
|
308
|
+
end
|
309
|
+
end
|
310
|
+
else
|
311
|
+
self.log.debug "No gem name; searching them all:"
|
312
|
+
discovered_apps.each do |disc_gemname, paths|
|
313
|
+
self.log.debug " %s: %d paths" % [ disc_gemname, paths.length ]
|
314
|
+
path = paths.find do |apppath|
|
315
|
+
self.log.debug " %s (%s)" % [ apppath, apppath.basename('.rb') ]
|
316
|
+
self.log.debug " %p vs. %p" % [ apppath.basename('.rb').to_s, appname ]
|
317
|
+
apppath.basename('.rb').to_s == appname
|
318
|
+
end or next
|
319
|
+
gemname = disc_gemname
|
320
|
+
break
|
291
321
|
end
|
292
322
|
end
|
293
323
|
|
294
|
-
|
295
|
-
|
296
|
-
|
324
|
+
unless path
|
325
|
+
msg = "Couldn't find an app named '#{appname}'"
|
326
|
+
msg << " in the #{gemname} gem" if gemname
|
327
|
+
raise( msg )
|
297
328
|
end
|
329
|
+
self.log.debug " found: %s" % [ path ]
|
298
330
|
|
299
|
-
|
300
|
-
source = configfile.read
|
301
|
-
runspace.module_eval( source, configfile.to_s, 1 )
|
302
|
-
end
|
303
|
-
|
304
|
-
|
305
|
-
### Set up the mongrel2 chroot directory for Strelka's adminserver by copying static
|
306
|
-
### files, and creating the necessary directories. This depends on the configuration
|
307
|
-
### being installed.
|
308
|
-
def setup_runtime_directory
|
331
|
+
return path, appname, gemname
|
309
332
|
end
|
310
333
|
|
311
334
|
|
@@ -9,9 +9,11 @@ class AuthDemo < Strelka::App
|
|
9
9
|
# The Mongrel2 appid of this app
|
10
10
|
ID = 'auth-demo'
|
11
11
|
|
12
|
-
|
12
|
+
plugin :auth
|
13
13
|
auth_provider :basic
|
14
14
|
|
15
|
+
plugin :routing
|
16
|
+
|
15
17
|
### Handle any (authenticated) HTTP request
|
16
18
|
get do |req|
|
17
19
|
res = req.response
|
@@ -27,6 +29,4 @@ class AuthDemo < Strelka::App
|
|
27
29
|
|
28
30
|
end # class AuthDemo
|
29
31
|
|
30
|
-
|
31
|
-
Strelka.load_config( 'examples/config.yml' )
|
32
32
|
AuthDemo.run
|
File without changes
|
File without changes
|
data/examples/config.yml
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
mongrel2:
|
2
|
-
configdb: examples/mongrel2.sqlite
|
2
|
+
configdb: amalgalite://examples/mongrel2.sqlite
|
3
3
|
|
4
4
|
auth:
|
5
5
|
realm: Examples
|
@@ -13,3 +13,7 @@ sessions:
|
|
13
13
|
options:
|
14
14
|
cookie-name: "session-demo"
|
15
15
|
|
16
|
+
templates:
|
17
|
+
template_paths:
|
18
|
+
- examples/templates
|
19
|
+
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/strelka/app/auth.rb
CHANGED
@@ -31,7 +31,7 @@ require 'strelka/authprovider'
|
|
31
31
|
#
|
32
32
|
# == Applying Authentication
|
33
33
|
#
|
34
|
-
# The default authentication policy is to require
|
34
|
+
# The default authentication policy is to require authentication from every
|
35
35
|
# request, but sometimes you may wish to narrow the restrictions a bit.
|
36
36
|
#
|
37
37
|
# === Relaxing \Auth for A Few Methods
|
@@ -51,7 +51,8 @@ require 'strelka/authprovider'
|
|
51
51
|
# A String or a Regexp argument will be used to match against the request's
|
52
52
|
# {#app_path}[rdoc-ref:Strelka::HTTPRequest#app_path] (the path of the request
|
53
53
|
# URI with the Mongrel2 route omitted), and any requests which match are sent
|
54
|
-
# along as-is.
|
54
|
+
# along as-is. A String will match the path exactly, with any leading or trailing
|
55
|
+
# '/' characters removed, and a Regexp will be tested against the \#app_path as-is.
|
55
56
|
#
|
56
57
|
# If you require some more-complex criteria for determining if the request should
|
57
58
|
# skip the auth plugin, you can provide a block to +no_auth_for+ instead.
|
@@ -325,10 +326,12 @@ module Strelka::App::Auth
|
|
325
326
|
"defining both positive and negative auth criteria is unsupported."
|
326
327
|
end
|
327
328
|
|
328
|
-
criteria <<
|
329
|
+
criteria << nil if criteria.empty?
|
329
330
|
block ||= Proc.new { true }
|
330
331
|
|
331
332
|
criteria.each do |pattern|
|
333
|
+
pattern.gsub!( %r{^/+|/+$}, '' ) if pattern.respond_to?( :gsub! )
|
334
|
+
Strelka.log.debug " adding require_auth for %p" % [ pattern ]
|
332
335
|
self.positive_auth_criteria[ pattern ] = block
|
333
336
|
end
|
334
337
|
end
|
@@ -342,10 +345,12 @@ module Strelka::App::Auth
|
|
342
345
|
"defining both positive and negative auth criteria is unsupported."
|
343
346
|
end
|
344
347
|
|
345
|
-
criteria <<
|
348
|
+
criteria << nil if criteria.empty?
|
346
349
|
block ||= Proc.new { true }
|
347
350
|
|
348
351
|
criteria.each do |pattern|
|
352
|
+
pattern.gsub!( %r{^/+|/+$}, '' ) if pattern.respond_to?( :gsub! )
|
353
|
+
Strelka.log.debug " adding no_auth for %p" % [ pattern ]
|
349
354
|
self.negative_auth_criteria[ pattern ] = block
|
350
355
|
end
|
351
356
|
end
|
@@ -382,7 +387,7 @@ module Strelka::App::Auth
|
|
382
387
|
### Check authentication and authorization for requests that need it before
|
383
388
|
### sending them on.
|
384
389
|
def handle_request( request, &block )
|
385
|
-
self.log.debug "
|
390
|
+
self.log.debug "[:auth] Wrapping request in auth with a %p" % [ self.auth_provider ]
|
386
391
|
|
387
392
|
self.authenticate_and_authorize( request ) if self.request_should_auth?( request )
|
388
393
|
|
@@ -396,7 +401,7 @@ module Strelka::App::Auth
|
|
396
401
|
|
397
402
|
### Returns +true+ if the given +request+ requires authentication.
|
398
403
|
def request_should_auth?( request )
|
399
|
-
self.log.debug "Checking to see if Auth(entication/orization) should be applied for %
|
404
|
+
self.log.debug "Checking to see if Auth(entication/orization) should be applied for app_path: %p" %
|
400
405
|
[ request.app_path ]
|
401
406
|
|
402
407
|
# If there are positive criteria, return true if the request matches any of them,
|
@@ -430,6 +435,10 @@ module Strelka::App::Auth
|
|
430
435
|
### at least one of them.
|
431
436
|
def request_matches_criteria( request, pattern )
|
432
437
|
case pattern
|
438
|
+
when nil
|
439
|
+
self.log.debug " no pattern; calling the block"
|
440
|
+
return yield( request )
|
441
|
+
|
433
442
|
when Regexp
|
434
443
|
self.log.debug " matching app_path with regexp: %p" % [ pattern ]
|
435
444
|
matchdata = pattern.match( request.app_path ) or return false
|
@@ -437,8 +446,8 @@ module Strelka::App::Auth
|
|
437
446
|
return yield( request, matchdata )
|
438
447
|
|
439
448
|
when String
|
440
|
-
self.log.debug " matching app_path
|
441
|
-
request.app_path.
|
449
|
+
self.log.debug " matching app_path: %p" % [ pattern ]
|
450
|
+
request.app_path.gsub( %r{^/+|/+$}, '' ) == pattern or return false
|
442
451
|
self.log.debug " calling the block"
|
443
452
|
return yield( request )
|
444
453
|
|
@@ -475,6 +484,7 @@ module Strelka::App::Auth
|
|
475
484
|
provider.authorize( credentials, request, &callback )
|
476
485
|
end
|
477
486
|
|
487
|
+
|
478
488
|
end # module Strelka::App::Auth
|
479
489
|
|
480
490
|
|
data/lib/strelka/app/errors.rb
CHANGED
@@ -113,6 +113,7 @@ module Strelka::App::Errors
|
|
113
113
|
|
114
114
|
### Check for a status response that is hooked, and run the hook if one is found.
|
115
115
|
def handle_request( request )
|
116
|
+
self.log.debug "[:errors] Wrapping request in custom error-handling."
|
116
117
|
response = nil
|
117
118
|
|
118
119
|
# Catch a finish_with; the status_response will only be non-nil
|
@@ -126,7 +127,7 @@ module Strelka::App::Errors
|
|
126
127
|
if status_response
|
127
128
|
response = request.response
|
128
129
|
status = status_response[:status]
|
129
|
-
self.log.info "Handling a status response: %d" % [ status ]
|
130
|
+
self.log.info "[:errors] Handling a status response: %d" % [ status ]
|
130
131
|
|
131
132
|
# If we can't find a custom handler for this status, re-throw
|
132
133
|
# to the default handler instead
|
@@ -145,7 +146,7 @@ module Strelka::App::Errors
|
|
145
146
|
|
146
147
|
### Find a status handler for the given +status_code+ and return it as an UnboundMethod.
|
147
148
|
def status_handler_for( status_code )
|
148
|
-
self.log.debug "Looking for a status handler for %d responses" % [ status_code ]
|
149
|
+
self.log.debug "[:errors] Looking for a status handler for %d responses" % [ status_code ]
|
149
150
|
handlers = self.class.status_handlers
|
150
151
|
ranges = handlers.keys
|
151
152
|
|
data/lib/strelka/app/filters.rb
CHANGED
@@ -51,6 +51,8 @@ module Strelka::App::Filters
|
|
51
51
|
### Apply filters to the given +request+ before yielding back to the App, then apply
|
52
52
|
### filters to the response that comes back.
|
53
53
|
def handle_request( request )
|
54
|
+
self.log.debug "[:filters] Wrapping request with request/response filters."
|
55
|
+
|
54
56
|
self.apply_request_filters( request )
|
55
57
|
response = super
|
56
58
|
self.apply_response_filters( response )
|
@@ -83,6 +83,8 @@ module Strelka::App::Negotiation
|
|
83
83
|
|
84
84
|
### Start content-negotiation when the response has returned.
|
85
85
|
def handle_request( request )
|
86
|
+
self.log.debug "[:negotiation] Wrapping response with HTTP content negotiation."
|
87
|
+
|
86
88
|
response = super
|
87
89
|
response.negotiate
|
88
90
|
|