Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 373
- Log:
Initial import of Radiant 0.9.1, which is now packaged as a gem. This is an
import of the tagged 0.9.1 source checked out from GitHub, which isn't quite
the same as the gem distribution - but it doesn't seem to be available in an
archived form and the installed gem already has modifications, so this is
the closest I can get.
- Author:
- rool
- Date:
- Mon Mar 21 13:40:05 +0000 2011
- Size:
- 1542 Bytes
1 | require 'thread' |
2 | |
3 | module ActionController |
4 | class Reloader |
5 | @@default_lock = Mutex.new |
6 | cattr_accessor :default_lock |
7 | |
8 | class BodyWrapper |
9 | def initialize(body, lock) |
10 | @body = body |
11 | @lock = lock |
12 | end |
13 | |
14 | def close |
15 | @body.close if @body.respond_to?(:close) |
16 | ensure |
17 | Dispatcher.cleanup_application |
18 | @lock.unlock |
19 | end |
20 | |
21 | def method_missing(*args, &block) |
22 | @body.send(*args, &block) |
23 | end |
24 | |
25 | def respond_to?(symbol, include_private = false) |
26 | symbol == :close || @body.respond_to?(symbol, include_private) |
27 | end |
28 | end |
29 | |
30 | def self.run(lock = @@default_lock) |
31 | lock.lock |
32 | begin |
33 | Dispatcher.reload_application |
34 | status, headers, body = yield |
35 | # We do not want to call 'cleanup_application' in an ensure block |
36 | # because the returned Rack response body may lazily generate its data. This |
37 | # is for example the case if one calls |
38 | # |
39 | # render :text => lambda { ... code here which refers to application models ... } |
40 | # |
41 | # in an ActionController. |
42 | # |
43 | # Instead, we will want to cleanup the application code after the request is |
44 | # completely finished. So we wrap the body in a BodyWrapper class so that |
45 | # when the Rack handler calls #close during the end of the request, we get to |
46 | # run our cleanup code. |
47 | [status, headers, BodyWrapper.new(body, lock)] |
48 | rescue Exception |
49 | lock.unlock |
50 | raise |
51 | end |
52 | end |
53 | end |
54 | end |