diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-12-02 14:12:35 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-12-02 14:12:35 -0600 |
commit | de2cd8e39f68d874b833b3a4860769c4edc57cbe (patch) | |
tree | eb9ef69f38bf19dc79023971f8be964a95607746 /railties/lib/rails/application.rb | |
parent | 8db038227ca4cbcba01a86ef5fb94cb13c780463 (diff) | |
parent | c446b1b12b6b54e61136410c6dfe69de3678eae9 (diff) | |
download | rails-de2cd8e39f68d874b833b3a4860769c4edc57cbe.tar.gz rails-de2cd8e39f68d874b833b3a4860769c4edc57cbe.tar.bz2 rails-de2cd8e39f68d874b833b3a4860769c4edc57cbe.zip |
Merge branch 'master' of github.com:rails/rails
Diffstat (limited to 'railties/lib/rails/application.rb')
-rw-r--r-- | railties/lib/rails/application.rb | 52 |
1 files changed, 17 insertions, 35 deletions
diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 73198d68ca..110311558c 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -82,8 +82,21 @@ module Rails @app.call(env) end - initializer :initialize_rails do - Rails.run_initializers + + # Loads the environment specified by Configuration#environment_path, which + # is typically one of development, test, or production. + initializer :load_environment do + next unless File.file?(config.environment_path) + + config = self.config + + Kernel.class_eval do + meth = instance_method(:config) if Object.respond_to?(:config) + define_method(:config) { config } + require config.environment_path + remove_method :config + define_method(:config, &meth) if meth + end end # Set the <tt>$LOAD_PATH</tt> based on the value of @@ -97,18 +110,8 @@ module Rails # list. By default, all frameworks (Active Record, Active Support, # Action Pack, Action Mailer, and Active Resource) are loaded. initializer :require_frameworks do - begin - require 'active_support' - require 'active_support/core_ext/kernel/reporting' - require 'active_support/core_ext/logger' - - # TODO: This is here to make Sam Ruby's tests pass. Needs discussion. - require 'active_support/core_ext/numeric/bytes' - config.frameworks.each { |framework| require(framework.to_s) } - rescue LoadError => e - # Re-raise as RuntimeError because Mongrel would swallow LoadError. - raise e.to_s - end + require 'active_support/all' unless config.active_support.bare + config.frameworks.each { |framework| require(framework.to_s) } end # Set the paths from which Rails will automatically load source files, and @@ -137,24 +140,6 @@ module Rails end end - # Loads the environment specified by Configuration#environment_path, which - # is typically one of development, test, or production. - initializer :load_environment do - silence_warnings do - next if @environment_loaded - next unless File.file?(config.environment_path) - - @environment_loaded = true - constants = self.class.constants - - eval(IO.read(config.environment_path), binding, config.environment_path) - - (self.class.constants - constants).each do |const| - Object.const_set(const, self.class.const_get(const)) - end - end - end - # Preload all frameworks specified by the Configuration#frameworks. # Used by Passenger to ensure everything's loaded before forking and # to avoid autoload race conditions in JRuby. @@ -312,9 +297,6 @@ module Rails base_class.send("#{setting}=", value) end end - config.active_support.each do |setting, value| - ActiveSupport.send("#{setting}=", value) - end end # Sets +ActionController::Base#view_paths+ and +ActionMailer::Base#template_root+ |