aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-08-25 21:22:34 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-08-25 21:22:34 -0700
commit172606e21f54fea39af68ede5f55a43deaf3ac68 (patch)
tree19c336e1ebc76a53a4d15b2573d7cce6fbad74c8
parentb7a37b742c0abd1df8ea48cc82f76385cc0c41ea (diff)
downloadrails-172606e21f54fea39af68ede5f55a43deaf3ac68.tar.gz
rails-172606e21f54fea39af68ede5f55a43deaf3ac68.tar.bz2
rails-172606e21f54fea39af68ede5f55a43deaf3ac68.zip
Harmonize framework require strategy. Don't add self to load path since Rails initializer and RubyGems handle it.
-rw-r--r--actionmailer/lib/action_mailer.rb12
-rw-r--r--actionpack/lib/action_controller.rb15
-rw-r--r--actionpack/lib/action_view.rb11
-rw-r--r--activerecord/lib/active_record.rb17
-rw-r--r--activeresource/lib/active_resource.rb17
-rw-r--r--activesupport/lib/active_support.rb2
6 files changed, 36 insertions, 38 deletions
diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb
index 2e324d4637..2a9210deb9 100644
--- a/actionmailer/lib/action_mailer.rb
+++ b/actionmailer/lib/action_mailer.rb
@@ -21,13 +21,13 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
-unless defined?(ActionController)
- begin
- $:.unshift "#{File.dirname(__FILE__)}/../../actionpack/lib"
+begin
+ require 'action_controller'
+rescue LoadError
+ actionpack_path = "#{File.dirname(__FILE__)}/../../actionpack/lib"
+ if File.directory?(actionpack_path)
+ $:.unshift actionpack_path
require 'action_controller'
- rescue LoadError
- require 'rubygems'
- gem 'actionpack', '>= 1.12.5'
end
end
diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb
index 3c4a339d50..e58071d4af 100644
--- a/actionpack/lib/action_controller.rb
+++ b/actionpack/lib/action_controller.rb
@@ -21,16 +21,13 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
-$:.unshift(File.dirname(__FILE__)) unless
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
-
-unless defined?(ActiveSupport)
- begin
- $:.unshift "#{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'
- rescue LoadError
- require 'rubygems'
- gem 'activesupport'
end
end
diff --git a/actionpack/lib/action_view.rb b/actionpack/lib/action_view.rb
index 3f35303a51..3590ab6d49 100644
--- a/actionpack/lib/action_view.rb
+++ b/actionpack/lib/action_view.rb
@@ -21,6 +21,15 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
+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
require 'action_view/template_handlers'
require 'action_view/renderable'
@@ -35,7 +44,7 @@ require 'action_view/partials'
require 'action_view/template_error'
I18n.backend.populate do
- I18n.load_translations File.dirname(__FILE__) + '/action_view/locale/en-US.yml'
+ I18n.load_translations "#{File.dirname(__FILE__)}/action_view/locale/en-US.yml"
end
require 'action_view/helpers'
diff --git a/activerecord/lib/active_record.rb b/activerecord/lib/active_record.rb
index 7612015ca5..e9767c2d5e 100644
--- a/activerecord/lib/active_record.rb
+++ b/activerecord/lib/active_record.rb
@@ -21,17 +21,14 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
-$:.unshift(File.dirname(__FILE__)) unless
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
-
-active_support_path = File.dirname(__FILE__) + "/../../activesupport/lib"
-if File.exist?(active_support_path)
- $:.unshift active_support_path
- require 'active_support'
-else
- require 'rubygems'
- gem 'activesupport'
+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
require 'active_record/base'
diff --git a/activeresource/lib/active_resource.rb b/activeresource/lib/active_resource.rb
index 18347457aa..db9007060f 100644
--- a/activeresource/lib/active_resource.rb
+++ b/activeresource/lib/active_resource.rb
@@ -21,16 +21,13 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
-$:.unshift(File.dirname(__FILE__)) unless
- $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
-
-unless defined?(ActiveSupport)
- begin
- $:.unshift(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'
- rescue LoadError
- require 'rubygems'
- gem 'activesupport'
end
end
@@ -44,4 +41,4 @@ module ActiveResource
include Validations
include CustomMethods
end
-end \ No newline at end of file
+end
diff --git a/activesupport/lib/active_support.rb b/activesupport/lib/active_support.rb
index b6c8be37c5..ae3e2360cd 100644
--- a/activesupport/lib/active_support.rb
+++ b/activesupport/lib/active_support.rb
@@ -21,8 +21,6 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
-$:.unshift(File.dirname(__FILE__))
-
require 'active_support/vendor'
require 'active_support/basic_object'
require 'active_support/inflector'