forked from kookster/activemessaging
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Applying patch from woodhull for defect kookster#40
- Loading branch information
Showing
1 changed file
with
11 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,14 @@ | ||
# # experimenting with adding processors to the load paths, doesn't seem to work | ||
# Dependencies.load_paths += ["#{APP_ROOT}/app/processors"] | ||
require 'dispatcher' unless defined?(::Dispatcher) | ||
::Dispatcher.class_eval do | ||
|
||
if defined? Rails | ||
logger.info "Rails available: Adding reload hooks." | ||
require 'dispatcher' unless defined?(::Dispatcher) | ||
::Dispatcher.class_eval do | ||
|
||
def self.prepare_application_for_dispatch | ||
if (self.private_methods.include? "prepare_application") | ||
prepare_application | ||
else | ||
disp = new(STDOUT) | ||
if disp.respond_to?(:prepare_application) | ||
disp.prepare_application | ||
elsif disp.respond_to?(:reload_application) | ||
disp.reload_application | ||
end | ||
end | ||
end | ||
|
||
def self.reset_application_after_dispatch | ||
if (self.private_methods.include? "reset_after_dispatch") | ||
reset_after_dispatch | ||
else | ||
disp = new(STDOUT) | ||
if disp.respond_to?(:cleanup_application) | ||
disp.cleanup_application | ||
end | ||
end | ||
end | ||
def self.prepare_application_for_dispatch | ||
disp = new(STDOUT) | ||
disp.run_callbacks :before_dispatch | ||
end | ||
|
||
def self.reset_application_after_dispatch | ||
disp = new(STDOUT) | ||
disp.run_callbacks :after_dispatch, :enumerator => :reverse_each | ||
end | ||
|
||
end |