aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/lib/action_controller.rb1
-rw-r--r--actionpack/lib/action_dispatch.rb1
-rw-r--r--actionpack/lib/action_view.rb1
-rw-r--r--activemodel/lib/active_model/core.rb15
-rw-r--r--activerecord/lib/active_record.rb1
-rw-r--r--activeresource/lib/active_resource.rb1
-rw-r--r--activesupport/CHANGELOG2
-rw-r--r--activesupport/lib/active_support.rb3
-rw-r--r--activesupport/lib/active_support/core/all.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/kernel/requires.rb4
-rw-r--r--railties/Rakefile4
-rw-r--r--railties/lib/rails/plugin.rb10
-rw-r--r--railties/lib/rails/rack/metal.rb1
-rw-r--r--railties/lib/rails_generator.rb14
14 files changed, 38 insertions, 21 deletions
diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb
index 100a0be1db..aee6b9dc9f 100644
--- a/actionpack/lib/action_controller.rb
+++ b/actionpack/lib/action_controller.rb
@@ -30,6 +30,7 @@ rescue LoadError
require 'active_support'
end
end
+require 'active_support/core/all'
require File.join(File.dirname(__FILE__), "action_pack")
diff --git a/actionpack/lib/action_dispatch.rb b/actionpack/lib/action_dispatch.rb
index bd5a38cc82..5feb8a4863 100644
--- a/actionpack/lib/action_dispatch.rb
+++ b/actionpack/lib/action_dispatch.rb
@@ -30,6 +30,7 @@ rescue LoadError
require 'active_support'
end
end
+require 'active_support/core/all'
$:.unshift "#{File.dirname(__FILE__)}/action_dispatch/vendor/rack-1.0"
begin
diff --git a/actionpack/lib/action_view.rb b/actionpack/lib/action_view.rb
index e604c2a581..dd352f9ce0 100644
--- a/actionpack/lib/action_view.rb
+++ b/actionpack/lib/action_view.rb
@@ -30,6 +30,7 @@ rescue LoadError
require 'active_support'
end
end
+require 'active_support/core/all'
require File.join(File.dirname(__FILE__), "action_pack")
diff --git a/activemodel/lib/active_model/core.rb b/activemodel/lib/active_model/core.rb
index 47b968e121..6b2bee53d9 100644
--- a/activemodel/lib/active_model/core.rb
+++ b/activemodel/lib/active_model/core.rb
@@ -1,7 +1,12 @@
-# This file is required by each major ActiveModel component for the core requirements. This allows you to
-# load individual pieces of ActiveModel as needed.
-$LOAD_PATH << File.join(File.dirname(__FILE__), '..', '..', '..', 'activesupport', 'lib')
+begin
+ require 'active_support'
+rescue LoadError
+ activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
+ if File.directory?(activesupport_path)
+ $:.unshift activesupport_path
+ require 'active_support'
+ end
+end
-# premature optimization?
# So far, we only need the string inflections and not the rest of ActiveSupport.
-require 'active_support/inflector' \ No newline at end of file
+require 'active_support/inflector'
diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb
index 2f8c5c712f..500a90d6cb 100644
--- a/activerecord/lib/active_record.rb
+++ b/activerecord/lib/active_record.rb
@@ -30,6 +30,7 @@ rescue LoadError
require 'active_support'
end
end
+require 'active_support/core/all'
module ActiveRecord
# TODO: Review explicit loads to see if they will automatically be handled by the initilizer.
diff --git a/activeresource/lib/active_resource.rb b/activeresource/lib/active_resource.rb
index db9007060f..2f0c8d1a8e 100644
--- a/activeresource/lib/active_resource.rb
+++ b/activeresource/lib/active_resource.rb
@@ -30,6 +30,7 @@ rescue LoadError
require 'active_support'
end
end
+require 'active_support/core/all'
require 'active_resource/formats'
require 'active_resource/base'
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index e208f56455..cd7b47d780 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*Edge*
+* require 'active_support' no longer orders the whole menu of core extensions. Ask for just what you need: e.g. require 'active_support/core/time' to use timezones, durations, and stdlib date/time extensions. [Jeremy Kemper]
+
* Removed rarely-used DRb cache store. [Jeremy Kemper]
* TimeWithZone.name returns 'Time', to further thwart type checking [Geoff Buesing]
diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb
index 21b730fa0c..84bf372163 100644
--- a/activesupport/lib/active_support.rb
+++ b/activesupport/lib/active_support.rb
@@ -50,10 +50,7 @@ module ActiveSupport
autoload :XmlMini, 'active_support/xml_mini'
end
-require 'active_support/core/all'
-
require 'active_support/vendor'
-require 'active_support/core_ext'
require 'active_support/dependencies'
require 'active_support/json'
diff --git a/activesupport/lib/active_support/core/all.rb b/activesupport/lib/active_support/core/all.rb
index f397f48e9c..55e8b4cfac 100644
--- a/activesupport/lib/active_support/core/all.rb
+++ b/activesupport/lib/active_support/core/all.rb
@@ -1,3 +1,4 @@
+require 'active_support/core_ext'
require 'active_support/core'
Dir["#{File.dirname(__FILE__)}/*.rb"].sort.each do |path|
require "active_support/core/#{File.basename(path, '.rb')}"
diff --git a/activesupport/lib/active_support/core_ext/kernel/requires.rb b/activesupport/lib/active_support/core_ext/kernel/requires.rb
index 323fea49fe..d2238898d6 100644
--- a/activesupport/lib/active_support/core_ext/kernel/requires.rb
+++ b/activesupport/lib/active_support/core_ext/kernel/requires.rb
@@ -1,3 +1,5 @@
+require 'active_support/core_ext/kernel/reporting'
+
module Kernel
# Require a library with fallback to RubyGems. Warnings during library
# loading are silenced to increase signal/noise for application warnings.
@@ -21,4 +23,4 @@ module Kernel
end
end
end
-end \ No newline at end of file
+end
diff --git a/railties/Rakefile b/railties/Rakefile
index a9adbda0b5..9cd102df0f 100644
--- a/railties/Rakefile
+++ b/railties/Rakefile
@@ -29,12 +29,12 @@ task :default => :test
task :test do
Dir['test/**/*_test.rb'].all? do |file|
ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
- system(ruby, '-Itest', file)
+ system(ruby, '-Itest', "-I#{File.dirname(__FILE__)}/../activesupport/lib", file)
end or raise "Failures"
end
Rake::TestTask.new("regular_test") do |t|
- t.libs << 'test'
+ t.libs << 'test' << "#{File.dirname(__FILE__)}/../activesupport/lib"
t.pattern = 'test/**/*_test.rb'
t.warning = true
t.verbose = true
diff --git a/railties/lib/rails/plugin.rb b/railties/lib/rails/plugin.rb
index 80deb73bbb..e66166306a 100644
--- a/railties/lib/rails/plugin.rb
+++ b/railties/lib/rails/plugin.rb
@@ -1,3 +1,5 @@
+require 'active_support/core_ext/kernel/reporting'
+
module Rails
# The Plugin class should be an object which provides the following methods:
#
@@ -35,10 +37,10 @@ module Rails
def load_paths
report_nonexistant_or_empty_plugin! unless valid?
- returning [] do |load_paths|
- load_paths << lib_path if has_lib_directory?
- load_paths << app_paths if has_app_directory?
- end.flatten
+ load_paths = []
+ load_paths << lib_path if has_lib_directory?
+ load_paths << app_paths if has_app_directory?
+ load_paths.flatten
end
# Evaluates a plugin's init.rb file.
diff --git a/railties/lib/rails/rack/metal.rb b/railties/lib/rails/rack/metal.rb
index adc43da864..7a616c7911 100644
--- a/railties/lib/rails/rack/metal.rb
+++ b/railties/lib/rails/rack/metal.rb
@@ -1,4 +1,5 @@
require 'active_support/ordered_hash'
+require 'active_support/core_ext/class/attribute_accessors'
module Rails
module Rack
diff --git a/railties/lib/rails_generator.rb b/railties/lib/rails_generator.rb
index 9f0ffc1562..201a9e0f91 100644
--- a/railties/lib/rails_generator.rb
+++ b/railties/lib/rails_generator.rb
@@ -21,16 +21,18 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
-$:.unshift(File.dirname(__FILE__))
-$:.unshift(File.dirname(__FILE__) + "/../../activesupport/lib")
-
begin
- require 'active_support'
+ require 'active_support'
rescue LoadError
- require 'rubygems'
- gem 'activesupport'
+ activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
+ if File.directory?(activesupport_path)
+ $:.unshift activesupport_path
+ require 'active_support'
+ end
end
+require 'active_support/core/all'
+$:.unshift(File.dirname(__FILE__))
require 'rails_generator/base'
require 'rails_generator/lookup'
require 'rails_generator/commands'