Skip addition to load path if an externally-provided lib is already in place. Just to keep the path shorter.

This commit is contained in:
Jeremy Kemper
2009-09-24 19:10:31 -07:00
parent 0bd6e933c0
commit 018ba27701

View File

@@ -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