Skip to content

Commit

Permalink
Fully expand relative rails framework paths and make sure we aren't
Browse files Browse the repository at this point in the history
adding any to the load path more than once.
  • Loading branch information
josh committed Dec 16, 2009
1 parent 0316d51 commit 8cfb531
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
11 changes: 6 additions & 5 deletions lib/active_resource.rb
Expand Up @@ -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
Expand Down
8 changes: 3 additions & 5 deletions 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"
Expand Down

0 comments on commit 8cfb531

Please sign in to comment.