strelka 0.0.1.pre.203 → 0.0.1.pre.214
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +6 -2
- data/ChangeLog +103 -26
- data/MILESTONES.rdoc +16 -0
- data/Manifest.txt +1 -0
- data/Rakefile +1 -0
- data/lib/strelka/app.rb +39 -22
- data/lib/strelka/app/errors.rb +22 -1
- data/lib/strelka/app/parameters.rb +3 -4
- data/lib/strelka/app/templating.rb +49 -28
- data/lib/strelka/logging.rb +1 -1
- data/lib/strelka/mixins.rb +9 -0
- data/lib/strelka/paramvalidator.rb +2 -1
- data/lib/strelka/plugins.rb +10 -8
- data/spec/strelka/app/errors_spec.rb +23 -0
- data/spec/strelka/app/templating_spec.rb +19 -0
- data/spec/strelka/app_spec.rb +21 -0
- data/spec/strelka/httpresponse/negotiation_spec.rb +1 -0
- data/spec/strelka/paramvalidator_spec.rb +780 -707
- data/spec/strelka/plugins_spec.rb +27 -1
- metadata +117 -35
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
@@ -1,2 +1,6 @@
|
|
1
|
-
|
2
|
-
�
|
1
|
+
"�߾7�jC�W���Hk�~d
|
2
|
+
�n�C�f��V9w:
|
3
|
+
Z���B}V���b�7T����� mL��ewҲ��2^f{(��S���BmV
|
4
|
+
L�D����(6�/L�>'?�b�?:�?�LÖ��o�@�;��i���4�s�z�T�E-��P�p�>¥BJE��Iȸ��Z<�?�]�Q�ŋ�
|
5
|
+
X
|
6
|
+
��Br +�R!
|
data/ChangeLog
CHANGED
@@ -1,8 +1,89 @@
|
|
1
|
+
2012-05-02 Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
* MILESTONES.rdoc, Manifest.txt:
|
4
|
+
Adding a MILESTONES file.
|
5
|
+
|
6
|
+
We'll use this as a checklist of what needs to be done for the next
|
7
|
+
release.
|
8
|
+
[d8e74e3bf97b] [tip]
|
9
|
+
|
10
|
+
* lib/strelka/logging.rb:
|
11
|
+
Change fatal output color to be more readable
|
12
|
+
[403cf0ef01f0]
|
13
|
+
|
14
|
+
2012-04-25 Michael Granger <ged@FaerieMUD.org>
|
15
|
+
|
16
|
+
* lib/strelka/app.rb, lib/strelka/plugins.rb,
|
17
|
+
spec/strelka/httpresponse/negotiation_spec.rb,
|
18
|
+
spec/strelka/plugins_spec.rb:
|
19
|
+
Add an #application_stack method to the PluginLoader mixin
|
20
|
+
[7427a74ae313] [github/master]
|
21
|
+
|
22
|
+
* lib/strelka/app.rb, spec/strelka/app_spec.rb:
|
23
|
+
Add configurable ::devmode? setting to Strelka::App
|
24
|
+
[c94cf810fdf7]
|
25
|
+
|
26
|
+
* lib/strelka/plugins.rb, spec/strelka/plugins_spec.rb:
|
27
|
+
Fix plugins clobbering their Class ivars if registered more than
|
28
|
+
once
|
29
|
+
[d9ff6bdd0177]
|
30
|
+
|
31
|
+
* lib/strelka/mixins.rb:
|
32
|
+
Add a 'singleton_method_alias' declarative to MethodUtilities
|
33
|
+
[e33e97ad96bd]
|
34
|
+
|
35
|
+
* lib/strelka/app/errors.rb, lib/strelka/mixins.rb,
|
36
|
+
spec/strelka/app/errors_spec.rb:
|
37
|
+
Add an exception-handler to the :errors plugin.
|
38
|
+
[53001e8ff327]
|
39
|
+
|
40
|
+
2012-04-24 Michael Granger <ged@FaerieMUD.org>
|
41
|
+
|
42
|
+
* lib/strelka/app/templating.rb, spec/strelka/app/templating_spec.rb:
|
43
|
+
Refactored on of the big methods in :templating.
|
44
|
+
[f933118fb9db]
|
45
|
+
|
46
|
+
2012-04-23 Michael Granger <ged@FaerieMUD.org>
|
47
|
+
|
48
|
+
* .rvm.gems:
|
49
|
+
Bumped hoe-deveiate in the dev gemset
|
50
|
+
[2a0529c51350]
|
51
|
+
|
52
|
+
* Rakefile:
|
53
|
+
Activate deveiate Hoe plugin
|
54
|
+
[74927b62af8f]
|
55
|
+
|
56
|
+
* lib/strelka/app/parameters.rb, lib/strelka/paramvalidator.rb,
|
57
|
+
spec/strelka/paramvalidator_spec.rb:
|
58
|
+
Clean up ParamValidator specs,
|
59
|
+
[90ca23f958cd]
|
60
|
+
|
61
|
+
2012-04-21 Mahlon E. Smith <mahlon@martini.nu>
|
62
|
+
|
63
|
+
* lib/strelka/paramvalidator.rb, spec/strelka/app/parameters_spec.rb,
|
64
|
+
spec/strelka/paramvalidator_spec.rb:
|
65
|
+
Ensure form data is revalidated when its profile is changed.
|
66
|
+
|
67
|
+
This also fixes some Symbol/String bugs in the internals.
|
68
|
+
[f343990cae18]
|
69
|
+
|
1
70
|
2012-04-21 Michael Granger <ged@FaerieMUD.org>
|
2
71
|
|
72
|
+
* lib/strelka/mixins.rb, spec/lib/helpers.rb,
|
73
|
+
spec/strelka/authprovider/basic_spec.rb,
|
74
|
+
spec/strelka/authprovider_spec.rb, spec/strelka/httprequest_spec.rb,
|
75
|
+
spec/strelka/router/default_spec.rb,
|
76
|
+
spec/strelka/router/exclusive_spec.rb:
|
77
|
+
Add the backtrace to the finish_with status_info.
|
78
|
+
|
79
|
+
This release also adds a 'finish_with' matcher that will eliminate
|
80
|
+
the need to duplicate the status_info struct exactly to test
|
81
|
+
abnormal status responses.
|
82
|
+
[8f6441fd0751]
|
83
|
+
|
3
84
|
* lib/strelka/app/parameters.rb:
|
4
85
|
Add some better docs for the :parameters plugin
|
5
|
-
[f0c8f37e24d7]
|
86
|
+
[f0c8f37e24d7]
|
6
87
|
|
7
88
|
2012-04-20 Michael Granger <ged@FaerieMUD.org>
|
8
89
|
|
@@ -80,7 +161,7 @@
|
|
80
161
|
|
81
162
|
* Strelka::App::Plugin is now Strelka::Plugin
|
82
163
|
* Strelka::App::Plugins is now Strelka::PluginLoader
|
83
|
-
[ea4c4358a943]
|
164
|
+
[ea4c4358a943]
|
84
165
|
|
85
166
|
2012-04-16 Mahlon E. Smith <mahlon@martini.nu>
|
86
167
|
|
@@ -163,18 +244,16 @@
|
|
163
244
|
* Merging with ssh://hg@deveiate.org/Strelka@8f1c27819e70
|
164
245
|
[5fcd76455aad]
|
165
246
|
|
247
|
+
* Manifest.txt:
|
248
|
+
Updating the manifest
|
249
|
+
[35165b3d01cc]
|
250
|
+
|
166
251
|
2012-04-11 Mahlon E. Smith <mahlon@martini.nu>
|
167
252
|
|
168
253
|
* lib/strelka/session/default.rb:
|
169
254
|
Use the built-in securerandom method for obtaining a hex value.
|
170
255
|
[8f1c27819e70]
|
171
256
|
|
172
|
-
2012-04-11 Michael Granger <ged@FaerieMUD.org>
|
173
|
-
|
174
|
-
* Manifest.txt:
|
175
|
-
Updating the manifest
|
176
|
-
[35165b3d01cc]
|
177
|
-
|
178
257
|
2012-04-10 Michael Granger <ged@FaerieMUD.org>
|
179
258
|
|
180
259
|
* lib/strelka/app/auth.rb, lib/strelka/app/parameters.rb,
|
@@ -245,6 +324,22 @@
|
|
245
324
|
Add the ChangeLog to the ignorefile
|
246
325
|
[cc8c30d38652]
|
247
326
|
|
327
|
+
* lib/strelka/app/templating.rb:
|
328
|
+
Add API docs to the :templating plugin module
|
329
|
+
[3c160d996320]
|
330
|
+
|
331
|
+
* README.rdoc:
|
332
|
+
Add more URLs
|
333
|
+
[060962556bd1]
|
334
|
+
|
335
|
+
* Rakefile:
|
336
|
+
Oops. Fix typo
|
337
|
+
[5a8aa207860b]
|
338
|
+
|
339
|
+
* .rvm.gems, Rakefile:
|
340
|
+
Update dependencies
|
341
|
+
[787e523777d1]
|
342
|
+
|
248
343
|
2012-04-06 Mahlon E. Smith <mahlon@martini.nu>
|
249
344
|
|
250
345
|
* lib/strelka/app/sessions.rb, lib/strelka/cookie.rb,
|
@@ -262,24 +357,6 @@
|
|
262
357
|
Add a persistent DB session store, using sequel.
|
263
358
|
[99f3c3f5d6ca]
|
264
359
|
|
265
|
-
2012-04-06 Michael Granger <ged@FaerieMUD.org>
|
266
|
-
|
267
|
-
* lib/strelka/app/templating.rb:
|
268
|
-
Add API docs to the :templating plugin module
|
269
|
-
[3c160d996320]
|
270
|
-
|
271
|
-
* README.rdoc:
|
272
|
-
Add more URLs
|
273
|
-
[060962556bd1]
|
274
|
-
|
275
|
-
* Rakefile:
|
276
|
-
Oops. Fix typo
|
277
|
-
[5a8aa207860b]
|
278
|
-
|
279
|
-
* .rvm.gems, Rakefile:
|
280
|
-
Update dependencies
|
281
|
-
[787e523777d1]
|
282
|
-
|
283
360
|
2012-04-04 Michael Granger <ged@FaerieMUD.org>
|
284
361
|
|
285
362
|
* manual/src/tutorial.page:
|
data/MILESTONES.rdoc
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
= Strelka Milestones
|
2
|
+
|
3
|
+
== v0.0.1
|
4
|
+
|
5
|
+
* Ensure the README is up to date
|
6
|
+
* Update the IDEAS doc
|
7
|
+
* Finish the 'setup' task in bin/strelka
|
8
|
+
* Extract the rest of the manual out into RDoc for the app classes
|
9
|
+
* Lay out the framework for the 'cookbook' section of the manual
|
10
|
+
* Mix in the 18pt awesomesauce.
|
11
|
+
|
12
|
+
|
13
|
+
== v0.1.0
|
14
|
+
|
15
|
+
* Add WebSocketService and plugins
|
16
|
+
|
data/Manifest.txt
CHANGED
data/Rakefile
CHANGED
data/lib/strelka/app.rb
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
require 'rubygems' # For the Rubygems API
|
6
6
|
|
7
|
+
require 'configurability'
|
7
8
|
require 'mongrel2/handler'
|
8
9
|
require 'strelka' unless defined?( Strelka )
|
9
10
|
require 'strelka/mixins'
|
@@ -12,18 +13,22 @@ require 'strelka/plugins'
|
|
12
13
|
|
13
14
|
# The application base class.
|
14
15
|
class Strelka::App < Mongrel2::Handler
|
15
|
-
extend
|
16
|
+
extend Configurability,
|
17
|
+
Strelka::MethodUtilities,
|
16
18
|
Strelka::PluginLoader
|
17
19
|
include Strelka::Loggable,
|
18
20
|
Strelka::Constants,
|
19
21
|
Strelka::ResponseHelpers
|
20
22
|
|
21
23
|
|
24
|
+
# Configurability API -- use the 'app' section of the config file.
|
25
|
+
config_key :app
|
26
|
+
|
22
27
|
# Glob for matching Strelka apps relative to a gem's data directory
|
23
28
|
APP_GLOB_PATTERN = '{apps,handlers}/**/*'
|
24
29
|
|
25
|
-
|
26
30
|
# Class instance variables
|
31
|
+
@devmode = false
|
27
32
|
@default_type = nil
|
28
33
|
@loading_file = nil
|
29
34
|
@subclasses = Hash.new {|h,k| h[k] = [] }
|
@@ -34,6 +39,10 @@ class Strelka::App < Mongrel2::Handler
|
|
34
39
|
# loaded from, or +nil+ if they weren't loaded via ::load.
|
35
40
|
singleton_attr_reader :subclasses
|
36
41
|
|
42
|
+
##
|
43
|
+
# 'Developer mode' flag.
|
44
|
+
singleton_attr_writer :devmode
|
45
|
+
|
37
46
|
|
38
47
|
### Inheritance callback -- add subclasses to @subclasses so .load can figure out which
|
39
48
|
### classes correspond to which files.
|
@@ -43,13 +52,14 @@ class Strelka::App < Mongrel2::Handler
|
|
43
52
|
end
|
44
53
|
|
45
54
|
|
55
|
+
|
46
56
|
### Overridden from Mongrel2::Handler -- use the value returned from .default_appid if
|
47
57
|
### one is not specified, and automatically install the config DB if it hasn't been
|
48
58
|
### already.
|
49
59
|
def self::run( appid=nil )
|
50
60
|
appid ||= self.default_appid
|
51
61
|
|
52
|
-
Strelka.logger.level = Logger::DEBUG if
|
62
|
+
Strelka.logger.level = Logger::DEBUG if self.devmode?
|
53
63
|
Strelka.logger.formatter = Strelka::Logging::ColorFormatter.new( Strelka.logger ) if $stderr.tty?
|
54
64
|
|
55
65
|
Strelka.log.info "Starting up with appid %p." % [ appid ]
|
@@ -157,6 +167,29 @@ class Strelka::App < Mongrel2::Handler
|
|
157
167
|
end
|
158
168
|
|
159
169
|
|
170
|
+
### Configure the App. Override this if you wish to add additional configuration
|
171
|
+
### to the 'app' section of the config that will be passed to you when the config
|
172
|
+
### is loaded.
|
173
|
+
def self::configure( config=nil )
|
174
|
+
if config
|
175
|
+
self.devmode = true if config[:devmode]
|
176
|
+
else
|
177
|
+
self.devmode = $DEBUG ? true : false
|
178
|
+
end
|
179
|
+
|
180
|
+
Strelka.log.info "Enabled developer mode." if self.devmode?
|
181
|
+
end
|
182
|
+
|
183
|
+
|
184
|
+
### Returns +true+ if the application has been configured to run in 'developer mode'.
|
185
|
+
### Developer mode is mostly informational by default (it just makes logging more
|
186
|
+
### verbose), but plugins and such might alter their behavior based on this setting.
|
187
|
+
def self::devmode?
|
188
|
+
return @devmode
|
189
|
+
end
|
190
|
+
singleton_method_alias :in_devmode?, :devmode?
|
191
|
+
|
192
|
+
|
160
193
|
#
|
161
194
|
# :section: Application declarative methods
|
162
195
|
#
|
@@ -175,7 +208,7 @@ class Strelka::App < Mongrel2::Handler
|
|
175
208
|
|
176
209
|
### Dump the application stack when a new instance is created.
|
177
210
|
def initialize( * )
|
178
|
-
self.dump_application_stack
|
211
|
+
self.class.dump_application_stack
|
179
212
|
super
|
180
213
|
end
|
181
214
|
|
@@ -221,8 +254,7 @@ class Strelka::App < Mongrel2::Handler
|
|
221
254
|
|
222
255
|
return response
|
223
256
|
rescue => err
|
224
|
-
|
225
|
-
self.log.error( msg )
|
257
|
+
self.log.error "%s: %s %s" % [ err.class.name, err.message, err.backtrace.first ]
|
226
258
|
err.backtrace[ 1..-1 ].each {|frame| self.log.debug(' ' + frame) }
|
227
259
|
|
228
260
|
status_info = { :status => HTTP::SERVER_ERROR, :message => 'internal server error' }
|
@@ -325,8 +357,6 @@ class Strelka::App < Mongrel2::Handler
|
|
325
357
|
|
326
358
|
### Create a response to specified +request+ based on the specified +status_code+
|
327
359
|
### and +message+.
|
328
|
-
### :TODO: Document and test the :content_type status_info field.
|
329
|
-
### :TODO: Implement a way to set headers from the status_info.
|
330
360
|
def prepare_status_response( request, status_info )
|
331
361
|
status_code, message = status_info.values_at( :status, :message )
|
332
362
|
self.log.info "Non-OK response: %d (%s)" % [ status_code, message ]
|
@@ -338,7 +368,7 @@ class Strelka::App < Mongrel2::Handler
|
|
338
368
|
|
339
369
|
# Some status codes allow explanatory text to be returned; some forbid it. Append the
|
340
370
|
# message for those that allow one.
|
341
|
-
unless request.verb == :HEAD ||
|
371
|
+
unless request.verb == :HEAD || response.bodiless?
|
342
372
|
response.content_type = 'text/plain'
|
343
373
|
response.puts( message )
|
344
374
|
end
|
@@ -353,18 +383,5 @@ class Strelka::App < Mongrel2::Handler
|
|
353
383
|
return response
|
354
384
|
end
|
355
385
|
|
356
|
-
|
357
|
-
### Output the application stack into the logfile.
|
358
|
-
def dump_application_stack
|
359
|
-
stack = self.class.ancestors.
|
360
|
-
reverse.
|
361
|
-
drop_while {|mod| mod != Strelka::App }.
|
362
|
-
select {|mod| mod.respond_to?(:plugin_name) }.
|
363
|
-
reverse.
|
364
|
-
collect {|mod| mod.plugin_name }
|
365
|
-
|
366
|
-
self.log.info "Application stack: request -> %s" % [ stack.join(" -> ") ]
|
367
|
-
end
|
368
|
-
|
369
386
|
end # class Strelka::App
|
370
387
|
|
data/lib/strelka/app/errors.rb
CHANGED
@@ -77,9 +77,15 @@ require 'strelka/app' unless defined?( Strelka::App )
|
|
77
77
|
#
|
78
78
|
module Strelka::App::Errors
|
79
79
|
extend Strelka::Plugin
|
80
|
+
include Strelka::Constants
|
80
81
|
|
82
|
+
|
83
|
+
# The range of status codes to delegate to an on_status handler that doesn't
|
84
|
+
# specify one
|
81
85
|
DEFAULT_HANDLER_STATUS_RANGE = 400..599
|
82
86
|
|
87
|
+
|
88
|
+
# Plugin load order
|
83
89
|
run_before :routing
|
84
90
|
|
85
91
|
|
@@ -141,7 +147,22 @@ module Strelka::App::Errors
|
|
141
147
|
|
142
148
|
# Catch a finish_with; the status_response will only be non-nil
|
143
149
|
status_response = catch( :finish ) do
|
144
|
-
|
150
|
+
|
151
|
+
# Provide our own exception-handling and translate them into server errors
|
152
|
+
begin
|
153
|
+
response = super
|
154
|
+
rescue => err
|
155
|
+
self.log.error "%s: %s %s" % [ err.class.name, err.message, err.backtrace.first ]
|
156
|
+
err.backtrace[ 1..-1 ].each {|frame| self.log.debug(' ' + frame) }
|
157
|
+
|
158
|
+
finish_with(
|
159
|
+
status: HTTP::SERVER_ERROR,
|
160
|
+
message: err.message,
|
161
|
+
headers: {},
|
162
|
+
backtrace: err.backtrace,
|
163
|
+
exception: err
|
164
|
+
)
|
165
|
+
end
|
145
166
|
nil
|
146
167
|
end
|
147
168
|
|
@@ -20,12 +20,11 @@ require 'strelka/paramvalidator'
|
|
20
20
|
#
|
21
21
|
# class UserManager < Strelka::App
|
22
22
|
#
|
23
|
-
#
|
23
|
+
# plugin :parameters
|
24
24
|
#
|
25
|
-
# param :username, /\w+/, "User login", :required
|
26
25
|
# param :email
|
27
26
|
# param :id, /\d+/, "The user's numeric ID"
|
28
|
-
# param :mode, [
|
27
|
+
# param :mode, /^\s*(?<prefix>[A-Z]{2})-(?<sku>\p{Print}+)/
|
29
28
|
#
|
30
29
|
# The first item is the parameter _key_, which corresponds to the field 'name' attribute for
|
31
30
|
# a form, or the key for JSON or YAML data.
|
@@ -68,7 +67,7 @@ require 'strelka/paramvalidator'
|
|
68
67
|
#
|
69
68
|
# end # class UserManager
|
70
69
|
#
|
71
|
-
# [:FIXME:] Add more docs
|
70
|
+
# [:FIXME:] Add more docs.
|
72
71
|
module Strelka::App::Parameters
|
73
72
|
extend Strelka::Plugin
|
74
73
|
|
@@ -185,52 +185,73 @@ module Strelka::App::Templating
|
|
185
185
|
response = super
|
186
186
|
|
187
187
|
self.log.debug "Templating: examining %p response." % [ response.class ]
|
188
|
-
template =
|
188
|
+
template = self.extract_template_from_response( response ) or
|
189
|
+
return response
|
190
|
+
|
191
|
+
# Wrap the template in a layout if there is one
|
192
|
+
template = self.wrap_in_layout( template )
|
193
|
+
|
194
|
+
# Set some default stuff on the top-level template
|
195
|
+
self.set_common_attributes( template, request )
|
196
|
+
|
197
|
+
# Now render the response body
|
198
|
+
self.log.debug " rendering the template into the response body"
|
199
|
+
response = request.response unless response.is_a?( Mongrel2::Response )
|
200
|
+
response.body = template.render
|
201
|
+
response.status ||= HTTP::OK
|
202
|
+
|
203
|
+
return response
|
204
|
+
end
|
205
|
+
|
206
|
+
|
207
|
+
### Fetch the template from the +response+ (if there is one) and return it. If
|
208
|
+
### +response+ itself is a template.
|
209
|
+
def extract_template_from_response( response )
|
189
210
|
|
190
211
|
# Response is a template name
|
191
212
|
if response.is_a?( Symbol ) && self.template_map.key?( response )
|
192
213
|
self.log.debug " response is a template name (Symbol); using the %p template" % [ response ]
|
193
|
-
|
194
|
-
response = request.response
|
214
|
+
return self.template( response )
|
195
215
|
|
196
216
|
# Template object
|
197
|
-
elsif response.
|
198
|
-
self.log.debug " response is
|
199
|
-
|
200
|
-
response = request.response
|
217
|
+
elsif response.respond_to?( :render )
|
218
|
+
self.log.debug " response is a #renderable %p; returning it as-is" % [ response.class ]
|
219
|
+
return response
|
201
220
|
|
202
221
|
# Template object already in a Response
|
203
|
-
elsif response.is_a?( Mongrel2::Response ) && response.body.
|
204
|
-
|
205
|
-
|
222
|
+
elsif response.is_a?( Mongrel2::Response ) && response.body.respond_to?( :render )
|
223
|
+
self.log.debug " response is a %p in the body of a %p" % [ response.body.class, response.class ]
|
224
|
+
return response.body
|
206
225
|
|
207
226
|
# Not templated; returned as-is
|
208
227
|
else
|
209
|
-
self.log.debug " response isn't templated; returning
|
210
|
-
return
|
228
|
+
self.log.debug " response isn't templated; returning nil"
|
229
|
+
return nil
|
211
230
|
end
|
231
|
+
end
|
212
232
|
|
213
|
-
# Wrap the template in a layout if there is one
|
214
|
-
if self.layout
|
215
|
-
self.layout.reload if self.layout.changed?
|
216
|
-
l_template = self.layout.dup
|
217
|
-
self.log.debug " wrapping response in layout %p" % [ l_template ]
|
218
|
-
l_template.body = template
|
219
|
-
template = l_template
|
220
|
-
end
|
221
233
|
|
222
|
-
|
234
|
+
### Wrap the specified +content+ template in the layout template and
|
235
|
+
### return it. If there isn't a layout declared, just return +content+ as-is.
|
236
|
+
def wrap_in_layout( content )
|
237
|
+
return content unless self.layout
|
238
|
+
|
239
|
+
self.layout.reload if self.layout.changed?
|
240
|
+
l_template = self.layout.dup
|
241
|
+
self.log.debug " wrapping response in layout %p" % [ l_template ]
|
242
|
+
l_template.body = content
|
243
|
+
|
244
|
+
return l_template
|
245
|
+
end
|
246
|
+
|
247
|
+
|
248
|
+
### Set some default values from the +request+ in the given top-level +template+.
|
249
|
+
def set_common_attributes( template, request )
|
223
250
|
template.request = request
|
251
|
+
template.app = self
|
224
252
|
template.strelka_version = Strelka.version_string( true )
|
225
253
|
template.mongrel2_version = Mongrel2.version_string( true )
|
226
254
|
template.route = request.notes[:routing][:route]
|
227
|
-
|
228
|
-
# Now render the response body
|
229
|
-
self.log.debug " rendering the template into the response body"
|
230
|
-
response.body = template.render
|
231
|
-
response.status ||= HTTP::OK
|
232
|
-
|
233
|
-
return response
|
234
255
|
end
|
235
256
|
|
236
257
|
end # module Strelka::App::Templating
|