[rubygems/rubygems] Merge Gem::UriParser and Gem::PrintableUri into a Gem::Uri class

The new class is a wrapper on top of an URI. And then, when you want
credentials redacted, you call `#redacted` that returns a copy of itself,
but with credentials redacted.

9581c2740a
This commit is contained in:
David Rodríguez 2021-08-24 12:02:29 +02:00 committed by Hiroshi SHIBATA
parent f0c6cc14b1
commit 1e290c31f4
Notes: git 2021-08-31 19:06:53 +09:00
9 changed files with 145 additions and 178 deletions

View file

@ -5,7 +5,6 @@ require_relative '../dependency_installer'
require_relative '../local_remote_options'
require_relative '../validator'
require_relative '../version_option'
require_relative '../printable_uri'
##
# Gem installer command line tool
@ -261,8 +260,8 @@ You can use `i` command instead of `install`.
errors.each do |x|
return unless Gem::SourceFetchProblem === x
printable_uri = Gem::PrintableUri.parse_uri(x.source.uri.clone)
msg = "Unable to pull data from '#{printable_uri}': #{x.error.message}"
require_relative "../uri"
msg = "Unable to pull data from '#{Gem::Uri.new(x.source.uri).redacted}': #{x.error.message}"
alert_warning msg
end