Skip to content
This repository
Browse code

Skip addition to load path if an externally-provided lib is already i…

…n place. Just to keep the path shorter.
  • Loading branch information...
commit 018ba2770158c7daaa3f0381d3a8c4e40ccd3232 1 parent 0bd6e93
Jeremy Kemper jeremy authored

Showing 1 changed file with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. +5 2 activesupport/lib/active_support/vendor.rb
7 activesupport/lib/active_support/vendor.rb
@@ -4,7 +4,10 @@
4 4 gem lib, "~> #{version}"
5 5 # Use the vendored lib if the gem's missing or we aren't using RubyGems.
6 6 rescue LoadError, NoMethodError
7   - # Push, not unshift, so the vendored lib is lowest priority.
8   - $LOAD_PATH << File.expand_path("#{File.dirname(__FILE__)}/vendor/#{lib}-#{version}/lib")
  7 + # Skip if there's already a vendored lib already provided.
  8 + if $LOAD_PATH.grep(Regexp.new(lib)).empty?
  9 + # Push, not unshift, so the vendored lib is lowest priority.
  10 + $LOAD_PATH << File.expand_path("#{File.dirname(__FILE__)}/vendor/#{lib}-#{version}/lib")
  11 + end
9 12 end
10 13 end

0 comments on commit 018ba27

Please sign in to comment.
Something went wrong with that request. Please try again.