diff options
author | José Valim <jose.valim@gmail.com> | 2010-01-12 17:48:09 +0100 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-01-13 01:19:23 +0100 |
commit | fe3ceabeed6bde67eb9c0e64b27e133a66e13d83 (patch) | |
tree | 523dcb635d1d8934e035e54c8ece3b49413688ed /railties/lib | |
parent | 7f25ccf38d6cab2b96494ed1a6b7cdffeef8eae7 (diff) | |
download | rails-fe3ceabeed6bde67eb9c0e64b27e133a66e13d83.tar.gz rails-fe3ceabeed6bde67eb9c0e64b27e133a66e13d83.tar.bz2 rails-fe3ceabeed6bde67eb9c0e64b27e133a66e13d83.zip |
Set up subscriber on initialization.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/application.rb | 3 | ||||
-rw-r--r-- | railties/lib/rails/bootstrap.rb | 13 | ||||
-rw-r--r-- | railties/lib/rails/configuration.rb | 15 |
3 files changed, 22 insertions, 9 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 6034aa8485..c95316a4da 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -104,9 +104,6 @@ module Rails @app.call(env) end - # # bail out if gems are missing - note that check_gem_dependencies will have - # # already called abort() unless $gems_rake_task is set - # return unless gems_dependencies_loaded initializer :load_application_initializers do Dir["#{root}/config/initializers/**/*.rb"].sort.each do |initializer| load(initializer) diff --git a/railties/lib/rails/bootstrap.rb b/railties/lib/rails/bootstrap.rb index 5d9165bf9a..8a65b3fa98 100644 --- a/railties/lib/rails/bootstrap.rb +++ b/railties/lib/rails/bootstrap.rb @@ -128,5 +128,18 @@ module Rails end end end + + initializer :initialize_notifications do + require 'active_support/notifications' + + if config.colorize_logging == false + Rails::Subscriber.colorize_logging = false + config.generators.colorize_logging = false + end + + ActiveSupport::Notifications.subscribe do |*args| + Rails::Subscriber.dispatch(args) + end + end end end diff --git a/railties/lib/rails/configuration.rb b/railties/lib/rails/configuration.rb index eed9834203..9991288cc5 100644 --- a/railties/lib/rails/configuration.rb +++ b/railties/lib/rails/configuration.rb @@ -64,17 +64,16 @@ module Rails end class Configuration < Railtie::Configuration - attr_accessor :after_initialize_blocks, :cache_classes, - :consider_all_requests_local, :dependency_loading, :gems, + attr_accessor :after_initialize_blocks, :cache_classes, :colorize_logging, + :consider_all_requests_local, :dependency_loading, :load_once_paths, :logger, :metals, :plugins, :preload_frameworks, :reload_plugins, :serve_static_assets, :time_zone, :whiny_nils attr_writer :cache_store, :controller_paths, :database_configuration_file, :eager_load_paths, - :i18n, :load_paths, - :log_level, :log_path, :paths, :routes_configuration_file, - :view_path + :i18n, :load_paths, :log_level, :log_path, :paths, + :routes_configuration_file, :view_path def initialize(base = nil) super @@ -287,10 +286,14 @@ module Rails end end - # Allows Notifications queue to be modified. + # Allow Notifications queue to be modified or add subscriptions: # # config.notifications.queue = MyNewQueue.new # + # config.notifications.subscribe /action_dispatch.show_exception/ do |*args| + # ExceptionDeliver.deliver_exception(args) + # end + # def notifications ActiveSupport::Notifications end |