Skip to content
Browse files

Rejig active support dependencies to behave better with the boot process

  • Loading branch information...
1 parent b825bef commit acd5db300b755d5abae2748f239441fb865c6b62 @jeremy jeremy committed Apr 28, 2009
View
10 railties/lib/initializer.rb
@@ -5,12 +5,9 @@
$LOAD_PATH.unshift File.dirname(__FILE__)
require 'railties_path'
require 'rails/version'
-require 'rails/plugin/locator'
-require 'rails/plugin/loader'
require 'rails/gem_dependency'
require 'rails/rack'
-
RAILS_ENV = (ENV['RAILS_ENV'] || 'development').dup unless defined?(RAILS_ENV)
module Rails
@@ -244,6 +241,7 @@ def set_load_path
# Set the paths from which Rails will automatically load source files, and
# the load_once paths.
def set_autoload_paths
+ require 'active_support/dependencies'
ActiveSupport::Dependencies.load_paths = configuration.load_paths.uniq
ActiveSupport::Dependencies.load_once_paths = configuration.load_once_paths.uniq
@@ -263,6 +261,8 @@ def set_autoload_paths
# list. By default, all frameworks (Active Record, Active Support,
# Action Pack, Action Mailer, and Active Resource) are loaded.
def require_frameworks
+ require 'active_support'
+ require 'active_support/core/all'
configuration.frameworks.each { |framework| require(framework.to_s) }
rescue LoadError => e
# Re-raise as RuntimeError because Mongrel would swallow LoadError.
@@ -289,10 +289,12 @@ def add_support_load_paths
# Adds all load paths from plugins to the global set of load paths, so that
# code from plugins can be required (explicitly or automatically via ActiveSupport::Dependencies).
def add_plugin_load_paths
+ require 'active_support/dependencies'
plugin_loader.add_plugin_load_paths
end
def add_gem_load_paths
+ require 'rails/gem_dependency'
Rails::GemDependency.add_frozen_gem_path
unless @configuration.gems.empty?
require "rubygems"
@@ -1037,12 +1039,14 @@ def default_plugin_paths
end
def default_plugin_locators
+ require 'rails/plugin/locator'
locators = []
locators << Plugin::GemLocator if defined? Gem
locators << Plugin::FileSystemLocator
end
def default_plugin_loader
+ require 'rails/plugin/loader'
Plugin::Loader
end
View
3 railties/lib/rails/backtrace_cleaner.rb
@@ -1,3 +1,6 @@
+require 'active_support/backtrace_cleaner'
+require 'rails/gem_dependency'
+
module Rails
class BacktraceCleaner < ActiveSupport::BacktraceCleaner
ERB_METHOD_SIG = /:in `_run_erb_.*/
View
5 railties/lib/rails/plugin.rb
@@ -1,8 +1,3 @@
-require 'active_support'
-require 'active_support/core_ext/kernel/reporting'
-require 'active_support/core_ext/symbol'
-require 'active_support/dependencies'
-
module Rails
# The Plugin class should be an object which provides the following methods:
#
View
1 railties/test/boot_test.rb
@@ -1,6 +1,7 @@
require 'abstract_unit'
require 'initializer'
require "#{File.dirname(__FILE__)}/../environments/boot"
+require 'rails/gem_dependency'
class BootTest < Test::Unit::TestCase
def test_boot_returns_if_booted
View
1 railties/test/gem_dependency_test.rb
@@ -1,4 +1,5 @@
require 'plugin_test_helper'
+require 'rails/gem_dependency'
class Rails::GemDependency
public :install_command, :unpack_command

0 comments on commit acd5db3

Please sign in to comment.
Something went wrong with that request. Please try again.