diff options
author | David RodrÃguez <[email protected]> | 2019-05-28 08:45:27 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <[email protected]> | 2019-08-03 09:29:55 +0900 |
commit | 81779e22469d89c38ee653e3de032144af0891f7 (patch) | |
tree | 16690d94035d45e80797be15ad2d7f18153ca7c7 /lib | |
parent | e111f38f34ea6b48446a0c29e142ccf44cfff282 (diff) |
[bundler/bundler] Use rubygems utility if available
https://github.com/bundler/bundler/commit/7eccba0e52
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/fetcher.rb | 2 | ||||
-rw-r--r-- | lib/bundler/fetcher/index.rb | 2 | ||||
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 12 |
3 files changed, 14 insertions, 2 deletions
diff --git a/lib/bundler/fetcher.rb b/lib/bundler/fetcher.rb index 8084a530d1..8118c2b2e7 100644 --- a/lib/bundler/fetcher.rb +++ b/lib/bundler/fetcher.rb @@ -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) diff --git a/lib/bundler/fetcher/index.rb b/lib/bundler/fetcher/index.rb index d10c21b041..d2ad657fe6 100644 --- a/lib/bundler/fetcher/index.rb +++ b/lib/bundler/fetcher/index.rb @@ -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) diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 9df0897ca2..3e74acf694 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -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 |