|
Revision 7640, 0.9 kB
(checked in by bitsweat, 1 year ago)
|
Move Railties' Dispatcher to ActionController::Dispatcher, introduce before_ and after_dispatch callbacks, and warm up to non-CGI requests.
|
| Line | |
|---|
| 1 |
require 'action_controller/integration' |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
Test::Unit.run = true if Test::Unit.respond_to?(:run=) |
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
def app(create=false) |
|---|
| 9 |
@app_integration_instance = nil if create |
|---|
| 10 |
@app_integration_instance ||= new_session do |sess| |
|---|
| 11 |
sess.host! "www.example.com" |
|---|
| 12 |
end |
|---|
| 13 |
end |
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
def new_session |
|---|
| 18 |
session = ActionController::Integration::Session.new |
|---|
| 19 |
yield session if block_given? |
|---|
| 20 |
session |
|---|
| 21 |
end |
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
def reload! |
|---|
| 25 |
puts "Reloading..." |
|---|
| 26 |
dispatcher = ActionController::Dispatcher.new($stdout) |
|---|
| 27 |
dispatcher.cleanup_application(true) |
|---|
| 28 |
dispatcher.prepare_application(true) |
|---|
| 29 |
true |
|---|
| 30 |
end |
|---|