aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource
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 /activeresource
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 'activeresource')
-rw-r--r--activeresource/lib/active_resource.rb11
-rw-r--r--activeresource/test/abstract_unit.rb8
2 files changed, 9 insertions, 10 deletions
diff --git a/activeresource/lib/active_resource.rb b/activeresource/lib/active_resource.rb
index 9357dd852f..84baf4227a 100644
--- a/activeresource/lib/active_resource.rb
+++ b/activeresource/lib/active_resource.rb
@@ -21,12 +21,13 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#++
-activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib"
-$:.unshift(activesupport_path) if File.directory?(activesupport_path)
-require 'active_support'
+activesupport_path = File.expand_path('../../../activesupport/lib', __FILE__)
+$:.unshift(activesupport_path) if File.directory?(activesupport_path) && !$:.include?(activesupport_path)
+
+activemodel_path = File.expand_path('../../../activemodel/lib', __FILE__)
+$:.unshift(activemodel_path) if File.directory?(activemodel_path) && !$:.include?(activemodel_path)
-activemodel_path = "#{File.dirname(__FILE__)}/../../activemodel/lib"
-$:.unshift(activemodel_path) if File.directory?(activemodel_path)
+require 'active_support'
require 'active_model'
module ActiveResource
diff --git a/activeresource/test/abstract_unit.rb b/activeresource/test/abstract_unit.rb
index 3d684ff347..5fa6d3023b 100644
--- a/activeresource/test/abstract_unit.rb
+++ b/activeresource/test/abstract_unit.rb
@@ -1,18 +1,16 @@
-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")
end
-lib = File.expand_path("#{File.dirname(__FILE__)}/../lib")
+lib = File.expand_path('../../lib', __FILE__)
$:.unshift(lib) unless $:.include?('lib') || $:.include?(lib)
require 'rubygems'
require 'test/unit'
+require 'active_resource'
require 'active_support'
require 'active_support/test_case'
-require 'active_resource'
require 'active_model/test_case'
$:.unshift "#{File.dirname(__FILE__)}/../test"