summaryrefslogtreecommitdiff
path: root/lib/bundler/source.rb
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2013-10-17 09:30:10 -0700
committerAndre Arko <andre@arko.net>2013-10-17 09:30:10 -0700
commit49aa5c5b13fd0e454a74e79de759a3c818fd68e2 (patch)
tree4aed5c8f29eb37815ce4e9e3d5fb0424dfe28579 /lib/bundler/source.rb
parent31cc97aaac0263671ee2bc6b75ffc45b33b27157 (diff)
downloadbundler-49aa5c5b13fd0e454a74e79de759a3c818fd68e2.tar.gz
move RubygemsMirror.to_uri to Source.mirror_for
Diffstat (limited to 'lib/bundler/source.rb')
-rw-r--r--lib/bundler/source.rb13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/bundler/source.rb b/lib/bundler/source.rb
index c75599f4db..a0977b8580 100644
--- a/lib/bundler/source.rb
+++ b/lib/bundler/source.rb
@@ -1,7 +1,16 @@
module Bundler
module Source
autoload :Rubygems, 'bundler/source/rubygems'
- autoload :Path, 'bundler/source/path'
- autoload :Git, 'bundler/source/git'
+ autoload :Path, 'bundler/source/path'
+ autoload :Git, 'bundler/source/git'
+
+ def self.mirror_for(uri)
+ # Settings keys are all downcased
+ mirrors = Bundler.settings.gem_mirrors
+ normalized_key = URI(uri.to_s.downcase)
+
+ mirrors[normalized_key] || URI(uri)
+ end
+
end
end