diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-09-24 19:10:31 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-09-24 19:10:31 -0700 |
commit | 018ba2770158c7daaa3f0381d3a8c4e40ccd3232 (patch) | |
tree | ca9e0eaf2c9d6b19732cdff7348837e3effd3f10 /activesupport/lib/active_support/vendor.rb | |
parent | 0bd6e933c01868db7c7e20d46c972c4e7395b743 (diff) | |
download | rails-018ba2770158c7daaa3f0381d3a8c4e40ccd3232.tar.gz rails-018ba2770158c7daaa3f0381d3a8c4e40ccd3232.tar.bz2 rails-018ba2770158c7daaa3f0381d3a8c4e40ccd3232.zip |
Skip addition to load path if an externally-provided lib is already in place. Just to keep the path shorter.
Diffstat (limited to 'activesupport/lib/active_support/vendor.rb')
-rw-r--r-- | activesupport/lib/active_support/vendor.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/vendor.rb b/activesupport/lib/active_support/vendor.rb index d9dfc184da..8ba1dade91 100644 --- a/activesupport/lib/active_support/vendor.rb +++ b/activesupport/lib/active_support/vendor.rb @@ -4,7 +4,10 @@ gem lib, "~> #{version}" # Use the vendored lib if the gem's missing or we aren't using RubyGems. rescue LoadError, NoMethodError - # Push, not unshift, so the vendored lib is lowest priority. - $LOAD_PATH << File.expand_path("#{File.dirname(__FILE__)}/vendor/#{lib}-#{version}/lib") + # Skip if there's already a vendored lib already provided. + if $LOAD_PATH.grep(Regexp.new(lib)).empty? + # Push, not unshift, so the vendored lib is lowest priority. + $LOAD_PATH << File.expand_path("#{File.dirname(__FILE__)}/vendor/#{lib}-#{version}/lib") + end end end |