mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[bundler/bundler] Use rubygems utility if available
https://github.com/bundler/bundler/commit/7eccba0e52
This commit is contained in:
parent
e111f38f34
commit
81779e2246
3 changed files with 14 additions and 2 deletions
|
@ -99,7 +99,7 @@ module Bundler
|
|||
|
||||
uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
|
||||
if uri.scheme == "file"
|
||||
path = Gem.win_platform? ? uri.path[1..-1] : uri.path
|
||||
path = Bundler.rubygems.correct_for_windows_path(uri.path)
|
||||
Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
|
||||
elsif cached_spec_path = gemspec_cached_path(spec_file_name)
|
||||
Bundler.load_gemspec(cached_spec_path)
|
||||
|
|
|
@ -30,7 +30,7 @@ module Bundler
|
|||
|
||||
uri = URI.parse("#{remote_uri}#{Gem::MARSHAL_SPEC_DIR}#{spec_file_name}.rz")
|
||||
if uri.scheme == "file"
|
||||
path = Gem.win_platform? ? uri.path[1..-1] : uri.path
|
||||
path = Bundler.rubygems.correct_for_windows_path(uri.path)
|
||||
Bundler.load_marshal Bundler.rubygems.inflate(Gem.read_binary(path))
|
||||
elsif cached_spec_path = gemspec_cached_path(spec_file_name)
|
||||
Bundler.load_gemspec(cached_spec_path)
|
||||
|
|
|
@ -146,6 +146,18 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
def correct_for_windows_path(path)
|
||||
require "rubygems/util"
|
||||
|
||||
if Gem::Util.respond_to?(:correct_for_windows_path)
|
||||
Gem::Util.correct_for_windows_path(path)
|
||||
elsif path[0].chr == "/" && path[1].chr =~ /[a-z]/i && path[2].chr == ":"
|
||||
path[1..-1]
|
||||
else
|
||||
path
|
||||
end
|
||||
end
|
||||
|
||||
def sources=(val)
|
||||
# Gem.configuration creates a new Gem::ConfigFile, which by default will read ~/.gemrc
|
||||
# If that file exists, its settings (including sources) will overwrite the values we
|
||||
|
|
Loading…
Reference in a new issue