diff options
author | Carlhuda <carlhuda@engineyard.com> | 2009-12-02 10:14:02 -0800 |
---|---|---|
committer | Carlhuda <carlhuda@engineyard.com> | 2009-12-02 11:35:47 -0800 |
commit | 39034997d1bd1fbaf33ddf1d6e3996b3c298a409 (patch) | |
tree | 208fe4a9c798b5420a8f11c3a2b2576e5d996cdd /railties | |
parent | 8ff310aef4e7ed424429059d10e3af0f169323fb (diff) | |
download | rails-39034997d1bd1fbaf33ddf1d6e3996b3c298a409.tar.gz rails-39034997d1bd1fbaf33ddf1d6e3996b3c298a409.tar.bz2 rails-39034997d1bd1fbaf33ddf1d6e3996b3c298a409.zip |
Add support for bare ActiveSupport via config.active_support.bare
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/application.rb | 17 | ||||
-rw-r--r-- | railties/test/application/configuration_test.rb | 9 | ||||
-rw-r--r-- | railties/test/application/initializer_test.rb | 4 |
4 files changed, 18 insertions, 16 deletions
diff --git a/railties/lib/rails.rb b/railties/lib/rails.rb index aeac85f4b3..b7cae9a9ac 100644 --- a/railties/lib/rails.rb +++ b/railties/lib/rails.rb @@ -1,5 +1,9 @@ require "pathname" +require 'active_support' +require 'active_support/core_ext/kernel/reporting' +require 'active_support/core_ext/logger' + require 'rails/initializable' require 'rails/application' require 'rails/railties_path' diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 41ae3f9687..be71469752 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -93,18 +93,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 @@ -308,9 +298,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+ diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index a3e1916494..fc21d4e5fd 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -44,5 +44,14 @@ module ApplicationTests assert_equal Pathname.new("#{app_path}/app"), Rails.application.root end end + + test "config.active_support.bare does not require all of ActiveSupport" do + add_to_config "config.frameworks = []; config.active_support.bare = true" + + Dir.chdir("#{app_path}/app") do + require "#{app_path}/config/environment" + assert_raises(NoMethodError, /day/) { 1.day } + end + end end end
\ No newline at end of file diff --git a/railties/test/application/initializer_test.rb b/railties/test/application/initializer_test.rb index 1b319e8a6d..56582c5772 100644 --- a/railties/test/application/initializer_test.rb +++ b/railties/test/application/initializer_test.rb @@ -25,7 +25,9 @@ module ApplicationTests config.frameworks << :action_foo end - assert_raises RuntimeError do + require "active_support/core_ext/load_error" + + assert_raises MissingSourceFile do Rails.initialize! end end |