aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-12-16 11:56:51 -0600
committerJoshua Peek <josh@joshpeek.com>2009-12-16 11:56:51 -0600
commit7ee5843c3cedfe36a680d5b28aa31eef45296c50 (patch)
treed399cb71b2533ec353ebbb5cc19a0c0902da1987 /actionpack
parent1ab35020c152575c84d4ca95842d55be307e1fee (diff)
downloadrails-7ee5843c3cedfe36a680d5b28aa31eef45296c50.tar.gz
rails-7ee5843c3cedfe36a680d5b28aa31eef45296c50.tar.bz2
rails-7ee5843c3cedfe36a680d5b28aa31eef45296c50.zip
Fully expand relative rails framework paths and make sure we aren't
adding any to the load path more than once.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/abstract_controller.rb8
-rw-r--r--actionpack/lib/action_controller.rb4
-rw-r--r--actionpack/lib/action_dispatch.rb8
-rw-r--r--actionpack/lib/action_view.rb13
-rw-r--r--actionpack/test/abstract_unit.rb15
5 files changed, 26 insertions, 22 deletions
diff --git a/actionpack/lib/abstract_controller.rb b/actionpack/lib/abstract_controller.rb
index 92d2971ec3..109a3a3385 100644
--- a/actionpack/lib/abstract_controller.rb
+++ b/actionpack/lib/abstract_controller.rb
@@ -1,5 +1,9 @@
-require "active_support/core_ext/module/attr_internal"
-require "active_support/core_ext/module/delegation"
+activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
+$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
+
+require 'active_support'
+require 'active_support/core_ext/module/attr_internal'
+require 'active_support/core_ext/module/delegation'
module AbstractController
extend ActiveSupport::Autoload
diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb
index 2113d791f5..37ff10e852 100644
--- a/actionpack/lib/action_controller.rb
+++ b/actionpack/lib/action_controller.rb
@@ -1,4 +1,6 @@
-require "active_support"
+activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
+$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
+require 'active_support'
module ActionController
extend ActiveSupport::Autoload
diff --git a/actionpack/lib/action_dispatch.rb b/actionpack/lib/action_dispatch.rb
index d1c191d652..feed6a8e25 100644
--- a/actionpack/lib/action_dispatch.rb
+++ b/actionpack/lib/action_dispatch.rb
@@ -21,6 +21,10 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
+activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
+$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
+require 'active_support'
+
require 'rack'
module Rack
@@ -74,7 +78,3 @@ module ActionDispatch
end
autoload :Mime, 'action_dispatch/http/mime_type'
-
-activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
-$:.unshift activesupport_path if File.directory?(activesupport_path)
-require 'active_support'
diff --git a/actionpack/lib/action_view.rb b/actionpack/lib/action_view.rb
index 06238ca747..c3e42ac0d5 100644
--- a/actionpack/lib/action_view.rb
+++ b/actionpack/lib/action_view.rb
@@ -21,7 +21,12 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
-require File.join(File.dirname(__FILE__), "action_pack")
+activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
+$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
+require 'active_support'
+require 'active_support/core_ext/class/attribute_accessors'
+
+require 'action_pack'
module ActionView
extend ActiveSupport::Autoload
@@ -51,10 +56,4 @@ end
require 'action_view/erb/util'
-
I18n.load_path << "#{File.dirname(__FILE__)}/action_view/locale/en.yml"
-
-activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
-$:.unshift activesupport_path if File.directory?(activesupport_path)
-require 'active_support'
-require 'active_support/core_ext/class/attribute_accessors'
diff --git a/actionpack/test/abstract_unit.rb b/actionpack/test/abstract_unit.rb
index 4dae1ab873..a9341b60df 100644
--- a/actionpack/test/abstract_unit.rb
+++ b/actionpack/test/abstract_unit.rb
@@ -1,12 +1,9 @@
-root = File.expand_path('../../..', __FILE__)
begin
- require "#{root}/vendor/gems/environment"
+ require File.expand_path('../../../vendor/gems/environment', __FILE__)
rescue LoadError
- $:.unshift "#{root}/activesupport/lib"
- $:.unshift "#{root}/activemodel/lib"
end
-lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
+lib = File.expand_path('../../lib', __FILE__)
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
$:.unshift(File.dirname(__FILE__) + '/lib')
@@ -16,18 +13,20 @@ $:.unshift(File.dirname(__FILE__) + '/fixtures/alternate_helpers')
ENV['TMPDIR'] = File.join(File.dirname(__FILE__), 'tmp')
require 'test/unit'
-require 'active_support'
-require 'active_support/test_case'
require 'abstract_controller'
require 'action_controller'
require 'action_view'
require 'action_view/base'
require 'action_dispatch'
-require 'active_model'
require 'fixture_template'
+require 'active_support/test_case'
require 'action_view/test_case'
require 'active_support/dependencies'
+activemodel_path = File.expand_path('../../../activemodel/lib', __FILE__)
+$:.unshift(activemodel_path) if File.directory?(activemodel_path) && !$:.include?(activemodel_path)
+require 'active_model'
+
begin
require 'ruby-debug'
Debugger.settings[:autoeval] = true