rubygems-update 3.5.4 → 3.5.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +48 -1
- data/Manifest.txt +77 -60
- data/POLICIES.md +5 -5
- data/bundler/CHANGELOG.md +27 -1
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/gem.rb +1 -1
- data/bundler/lib/bundler/cli/lock.rb +5 -4
- data/bundler/lib/bundler/cli.rb +1 -1
- data/bundler/lib/bundler/compact_index_client/updater.rb +4 -4
- data/bundler/lib/bundler/definition.rb +54 -28
- data/bundler/lib/bundler/dsl.rb +7 -7
- data/bundler/lib/bundler/environment_preserver.rb +3 -3
- data/bundler/lib/bundler/fetcher/downloader.rb +1 -1
- data/bundler/lib/bundler/fetcher.rb +2 -2
- data/bundler/lib/bundler/injector.rb +1 -1
- data/bundler/lib/bundler/installer.rb +2 -2
- data/bundler/lib/bundler/man/bundle-config.1 +2 -2
- data/bundler/lib/bundler/man/bundle-config.1.ronn +2 -2
- data/bundler/lib/bundler/mirror.rb +3 -3
- data/bundler/lib/bundler/plugin/api/source.rb +2 -2
- data/bundler/lib/bundler/runtime.rb +1 -1
- data/bundler/lib/bundler/settings.rb +4 -4
- data/bundler/lib/bundler/source/git/git_proxy.rb +1 -1
- data/bundler/lib/bundler/source/git.rb +1 -1
- data/bundler/lib/bundler/source/rubygems/remote.rb +1 -1
- data/bundler/lib/bundler/source/rubygems.rb +2 -2
- data/bundler/lib/bundler/spec_set.rb +1 -1
- data/bundler/lib/bundler/uri_credentials_filter.rb +2 -2
- data/bundler/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +22 -22
- data/bundler/lib/bundler/vendored_uri.rb +18 -1
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler/yaml_serializer.rb +12 -0
- data/bundler/lib/bundler.rb +3 -2
- data/lib/rubygems/commands/sources_command.rb +2 -2
- data/lib/rubygems/core_ext/kernel_require.rb +11 -2
- data/lib/rubygems/defaults.rb +1 -1
- data/lib/rubygems/gemcutter_utilities/webauthn_listener.rb +1 -1
- data/lib/rubygems/gemcutter_utilities.rb +39 -22
- data/lib/rubygems/local_remote_options.rb +6 -6
- data/lib/rubygems/net/http.rb +1 -1
- data/lib/rubygems/optparse.rb +1 -1
- data/lib/rubygems/remote_fetcher.rb +2 -2
- data/lib/rubygems/request.rb +4 -4
- data/lib/rubygems/requirement.rb +5 -0
- data/lib/rubygems/resolver/api_set.rb +1 -1
- data/lib/rubygems/resolver/best_set.rb +1 -1
- data/lib/rubygems/resolver.rb +5 -5
- data/lib/rubygems/s3_uri_signer.rb +2 -2
- data/lib/rubygems/source/git.rb +2 -2
- data/lib/rubygems/source_list.rb +1 -1
- data/lib/rubygems/specification.rb +6 -6
- data/lib/rubygems/specification_policy.rb +6 -6
- data/lib/rubygems/timeout.rb +1 -1
- data/lib/rubygems/tsort.rb +1 -1
- data/lib/rubygems/uri.rb +6 -6
- data/lib/rubygems/util.rb +1 -1
- data/lib/rubygems/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +57 -0
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/delegates/specification_provider.rb +11 -11
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/action.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/log.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/set_payload.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/tag.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph/vertex.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/dependency_graph.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/errors.rb +1 -1
- data/lib/rubygems/vendor/molinillo/lib/molinillo/gem_metadata.rb +6 -0
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/modules/specification_provider.rb +2 -2
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/modules/ui.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/resolution.rb +3 -3
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/resolver.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo/state.rb +1 -1
- data/lib/rubygems/{resolver → vendor}/molinillo/lib/molinillo.rb +2 -2
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/generic_request.rb +9 -9
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/header.rb +2 -2
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/request.rb +3 -3
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/requests.rb +30 -30
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/response.rb +2 -2
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/responses.rb +6 -6
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/status.rb +1 -1
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http.rb +15 -15
- data/lib/rubygems/{net-http → vendor/net-http}/lib/net/https.rb +1 -1
- data/lib/rubygems/vendor/optparse/lib/optparse/uri.rb +7 -0
- data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse.rb +11 -11
- data/lib/rubygems/{timeout → vendor/timeout}/lib/timeout.rb +1 -1
- data/lib/rubygems/{tsort → vendor/tsort}/lib/tsort.rb +2 -2
- data/lib/rubygems/vendor/uri/.document +1 -0
- data/lib/rubygems/vendor/uri/LICENSE.txt +22 -0
- data/lib/rubygems/vendor/uri/lib/uri/common.rb +853 -0
- data/lib/rubygems/vendor/uri/lib/uri/file.rb +100 -0
- data/lib/rubygems/vendor/uri/lib/uri/ftp.rb +267 -0
- data/lib/rubygems/vendor/uri/lib/uri/generic.rb +1588 -0
- data/lib/rubygems/vendor/uri/lib/uri/http.rb +125 -0
- data/lib/rubygems/vendor/uri/lib/uri/https.rb +23 -0
- data/lib/rubygems/vendor/uri/lib/uri/ldap.rb +261 -0
- data/lib/rubygems/vendor/uri/lib/uri/ldaps.rb +22 -0
- data/lib/rubygems/vendor/uri/lib/uri/mailto.rb +293 -0
- data/lib/rubygems/vendor/uri/lib/uri/rfc2396_parser.rb +539 -0
- data/lib/rubygems/vendor/uri/lib/uri/rfc3986_parser.rb +183 -0
- data/lib/rubygems/vendor/uri/lib/uri/version.rb +6 -0
- data/lib/rubygems/vendor/uri/lib/uri/ws.rb +83 -0
- data/lib/rubygems/vendor/uri/lib/uri/wss.rb +23 -0
- data/lib/rubygems/vendor/uri/lib/uri.rb +104 -0
- data/lib/rubygems/vendored_molinillo.rb +3 -0
- data/lib/rubygems/yaml_serializer.rb +12 -0
- data/lib/rubygems.rb +8 -1
- data/rubygems-update.gemspec +7 -2
- metadata +83 -63
- data/lib/rubygems/optparse/lib/optparse/uri.rb +0 -7
- data/lib/rubygems/resolver/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
- data/lib/rubygems/resolver/molinillo/lib/molinillo/gem_metadata.rb +0 -6
- data/lib/rubygems/resolver/molinillo.rb +0 -3
- /data/lib/rubygems/{net-http → vendor/molinillo}/.document +0 -0
- /data/lib/rubygems/{resolver → vendor}/molinillo/LICENSE +0 -0
- /data/lib/rubygems/{net-protocol → vendor/net-http}/.document +0 -0
- /data/lib/rubygems/{net-http → vendor/net-http}/LICENSE.txt +0 -0
- /data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/backward.rb +0 -0
- /data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/exceptions.rb +0 -0
- /data/lib/rubygems/{net-http → vendor/net-http}/lib/net/http/proxy_delta.rb +0 -0
- /data/lib/rubygems/{optparse → vendor/net-protocol}/.document +0 -0
- /data/lib/rubygems/{net-protocol → vendor/net-protocol}/LICENSE.txt +0 -0
- /data/lib/rubygems/{net-protocol → vendor/net-protocol}/lib/net/protocol.rb +0 -0
- /data/lib/rubygems/{resolv → vendor/optparse}/.document +0 -0
- /data/lib/rubygems/{optparse → vendor/optparse}/COPYING +0 -0
- /data/lib/rubygems/{optparse → vendor/optparse}/lib/optionparser.rb +0 -0
- /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/ac.rb +0 -0
- /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/date.rb +0 -0
- /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/kwargs.rb +0 -0
- /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/shellwords.rb +0 -0
- /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/time.rb +0 -0
- /data/lib/rubygems/{optparse → vendor/optparse}/lib/optparse/version.rb +0 -0
- /data/lib/rubygems/{resolver/molinillo → vendor/resolv}/.document +0 -0
- /data/lib/rubygems/{resolv → vendor/resolv}/LICENSE.txt +0 -0
- /data/lib/rubygems/{resolv → vendor/resolv}/lib/resolv.rb +0 -0
- /data/lib/rubygems/{timeout → vendor/timeout}/.document +0 -0
- /data/lib/rubygems/{timeout → vendor/timeout}/LICENSE.txt +0 -0
- /data/lib/rubygems/{tsort → vendor/tsort}/.document +0 -0
- /data/lib/rubygems/{tsort → vendor/tsort}/LICENSE.txt +0 -0
@@ -107,7 +107,7 @@ module Bundler
|
|
107
107
|
def install_path
|
108
108
|
@install_path ||=
|
109
109
|
begin
|
110
|
-
base_name = File.basename(
|
110
|
+
base_name = File.basename(Gem::URI.parse(uri).normalize.path)
|
111
111
|
|
112
112
|
gem_install_dir.join("#{base_name}-#{uri_hash[0..11]}")
|
113
113
|
end
|
@@ -176,7 +176,7 @@ module Bundler
|
|
176
176
|
#
|
177
177
|
# This is used by `app_cache_path`
|
178
178
|
def app_cache_dirname
|
179
|
-
base_name = File.basename(
|
179
|
+
base_name = File.basename(Gem::URI.parse(uri).normalize.path)
|
180
180
|
"#{base_name}-#{uri_hash}"
|
181
181
|
end
|
182
182
|
|
@@ -95,7 +95,7 @@ module Bundler
|
|
95
95
|
|
96
96
|
def lock(opts = {})
|
97
97
|
return if @definition.no_resolve_needed?
|
98
|
-
@definition.lock(
|
98
|
+
@definition.lock(opts[:preserve_unknown_sections])
|
99
99
|
end
|
100
100
|
|
101
101
|
alias_method :gems, :specs
|
@@ -189,7 +189,7 @@ module Bundler
|
|
189
189
|
def mirror_for(uri)
|
190
190
|
if uri.is_a?(String)
|
191
191
|
require_relative "vendored_uri"
|
192
|
-
uri =
|
192
|
+
uri = Gem::URI(uri)
|
193
193
|
end
|
194
194
|
|
195
195
|
gem_mirrors.for(uri.to_s).uri
|
@@ -549,7 +549,7 @@ module Bundler
|
|
549
549
|
end
|
550
550
|
uri = URINormalizer.normalize_suffix(uri)
|
551
551
|
require_relative "vendored_uri"
|
552
|
-
uri =
|
552
|
+
uri = Gem::URI(uri)
|
553
553
|
unless uri.absolute?
|
554
554
|
raise ArgumentError, format("Gem sources must be absolute. You provided '%s'.", uri)
|
555
555
|
end
|
@@ -564,7 +564,7 @@ module Bundler
|
|
564
564
|
key
|
565
565
|
when Symbol
|
566
566
|
key.name
|
567
|
-
when
|
567
|
+
when Gem::URI::HTTP
|
568
568
|
key.to_s
|
569
569
|
else
|
570
570
|
raise ArgumentError, "Invalid key: #{key.inspect}"
|
@@ -577,7 +577,7 @@ module Bundler
|
|
577
577
|
key
|
578
578
|
when Symbol
|
579
579
|
key.to_s
|
580
|
-
when
|
580
|
+
when Gem::URI::HTTP
|
581
581
|
key.to_s
|
582
582
|
else
|
583
583
|
raise ArgumentError, "Invalid key: #{key.inspect}"
|
@@ -320,7 +320,7 @@ module Bundler
|
|
320
320
|
# Adds credentials to the URI
|
321
321
|
def configured_uri
|
322
322
|
if /https?:/.match?(uri)
|
323
|
-
remote =
|
323
|
+
remote = Gem::URI(uri)
|
324
324
|
config_auth = Bundler.settings[remote.to_s] || Bundler.settings[remote.host]
|
325
325
|
remote.userinfo ||= config_auth
|
326
326
|
remote.to_s
|
@@ -326,7 +326,7 @@ module Bundler
|
|
326
326
|
if %r{^\w+://(\w+@)?}.match?(uri)
|
327
327
|
# Downcase the domain component of the URI
|
328
328
|
# and strip off a trailing slash, if one is present
|
329
|
-
input =
|
329
|
+
input = Gem::URI.parse(uri).normalize.to_s.sub(%r{/$}, "")
|
330
330
|
else
|
331
331
|
# If there is no URI scheme, assume it is an ssh/git URI
|
332
332
|
input = uri
|
@@ -48,7 +48,7 @@ module Bundler
|
|
48
48
|
end
|
49
49
|
|
50
50
|
uri
|
51
|
-
rescue
|
51
|
+
rescue Gem::URI::InvalidComponentError
|
52
52
|
error_message = "Please CGI escape your usernames and passwords before " \
|
53
53
|
"setting them for authentication."
|
54
54
|
raise HTTPError.new(error_message)
|
@@ -349,9 +349,9 @@ module Bundler
|
|
349
349
|
def normalize_uri(uri)
|
350
350
|
uri = URINormalizer.normalize_suffix(uri.to_s)
|
351
351
|
require_relative "../vendored_uri"
|
352
|
-
uri =
|
352
|
+
uri = Gem::URI(uri)
|
353
353
|
raise ArgumentError, "The source must be an absolute URI. For example:\n" \
|
354
|
-
"source 'https://rubygems.org'" if !uri.absolute? || (uri.is_a?(
|
354
|
+
"source 'https://rubygems.org'" if !uri.absolute? || (uri.is_a?(Gem::URI::HTTP) && uri.host.nil?)
|
355
355
|
uri
|
356
356
|
end
|
357
357
|
|
@@ -65,7 +65,7 @@ module Bundler
|
|
65
65
|
|
66
66
|
platforms.concat(new_platforms)
|
67
67
|
|
68
|
-
less_specific_platform = new_platforms.find {|platform| platform != Gem::Platform::RUBY &&
|
68
|
+
less_specific_platform = new_platforms.find {|platform| platform != Gem::Platform::RUBY && Bundler.local_platform === platform }
|
69
69
|
platforms.delete(Bundler.local_platform) if less_specific_platform
|
70
70
|
|
71
71
|
platforms
|
@@ -11,7 +11,7 @@ module Bundler
|
|
11
11
|
return uri if File.exist?(uri)
|
12
12
|
|
13
13
|
require_relative "vendored_uri"
|
14
|
-
uri =
|
14
|
+
uri = Gem::URI(uri)
|
15
15
|
end
|
16
16
|
|
17
17
|
if uri.userinfo
|
@@ -25,7 +25,7 @@ module Bundler
|
|
25
25
|
end
|
26
26
|
return uri.to_s if uri_to_anonymize.is_a?(String)
|
27
27
|
uri
|
28
|
-
rescue
|
28
|
+
rescue Gem::URI::InvalidURIError # uri is not canonical uri scheme
|
29
29
|
uri
|
30
30
|
end
|
31
31
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require_relative '../../../../../vendored_net_http'
|
2
|
-
require_relative '
|
2
|
+
require_relative '../../../../../vendored_uri'
|
3
3
|
require 'cgi' # for escaping
|
4
4
|
require_relative '../../../../connection_pool/lib/connection_pool'
|
5
5
|
|
@@ -22,7 +22,7 @@ autoload :OpenSSL, 'openssl'
|
|
22
22
|
#
|
23
23
|
# require 'bundler/vendor/net-http-persistent/lib/net/http/persistent'
|
24
24
|
#
|
25
|
-
# uri =
|
25
|
+
# uri = Gem::URI 'http://example.com/awesome/web/service'
|
26
26
|
#
|
27
27
|
# http = Gem::Net::HTTP::Persistent.new
|
28
28
|
#
|
@@ -39,17 +39,17 @@ autoload :OpenSSL, 'openssl'
|
|
39
39
|
# post = Gem::Net::HTTP::Post.new post_uri.path
|
40
40
|
# post.set_form_data 'some' => 'cool data'
|
41
41
|
#
|
42
|
-
# # perform the POST, the
|
42
|
+
# # perform the POST, the Gem::URI is always required
|
43
43
|
# response http.request post_uri, post
|
44
44
|
#
|
45
45
|
# Note that for GET, HEAD and other requests that do not have a body you want
|
46
|
-
# to use
|
46
|
+
# to use Gem::URI#request_uri not Gem::URI#path. The request_uri contains the query
|
47
47
|
# params which are sent in the body for other requests.
|
48
48
|
#
|
49
49
|
# == TLS/SSL
|
50
50
|
#
|
51
51
|
# TLS connections are automatically created depending upon the scheme of the
|
52
|
-
#
|
52
|
+
# Gem::URI. TLS connections are automatically verified against the default
|
53
53
|
# certificate store for your computer. You can override this by changing
|
54
54
|
# verify_mode or by specifying an alternate cert_store.
|
55
55
|
#
|
@@ -72,7 +72,7 @@ autoload :OpenSSL, 'openssl'
|
|
72
72
|
# == Proxies
|
73
73
|
#
|
74
74
|
# A proxy can be set through #proxy= or at initialization time by providing a
|
75
|
-
# second argument to ::new. The proxy may be the
|
75
|
+
# second argument to ::new. The proxy may be the Gem::URI of the proxy server or
|
76
76
|
# <code>:ENV</code> which will consult environment variables.
|
77
77
|
#
|
78
78
|
# See #proxy= and #proxy_from_env for details.
|
@@ -197,7 +197,7 @@ class Gem::Net::HTTP::Persistent
|
|
197
197
|
# NOTE: This may not work on ruby > 1.9.
|
198
198
|
|
199
199
|
def self.detect_idle_timeout uri, max = 10
|
200
|
-
uri =
|
200
|
+
uri = Gem::URI uri unless Gem::URI::Generic === uri
|
201
201
|
uri += '/'
|
202
202
|
|
203
203
|
req = Gem::Net::HTTP::Head.new uri.request_uri
|
@@ -455,13 +455,13 @@ class Gem::Net::HTTP::Persistent
|
|
455
455
|
# Set a +name+ for fun. Your library name should be good enough, but this
|
456
456
|
# otherwise has no purpose.
|
457
457
|
#
|
458
|
-
# +proxy+ may be set to a
|
458
|
+
# +proxy+ may be set to a Gem::URI::HTTP or :ENV to pick up proxy options from
|
459
459
|
# the environment. See proxy_from_env for details.
|
460
460
|
#
|
461
|
-
# In order to use a
|
462
|
-
# beyond
|
461
|
+
# In order to use a Gem::URI for the proxy you may need to do some extra work
|
462
|
+
# beyond Gem::URI parsing if the proxy requires a password:
|
463
463
|
#
|
464
|
-
# proxy =
|
464
|
+
# proxy = Gem::URI 'http://proxy.example'
|
465
465
|
# proxy.user = 'AzureDiamond'
|
466
466
|
# proxy.password = 'hunter2'
|
467
467
|
#
|
@@ -510,7 +510,7 @@ class Gem::Net::HTTP::Persistent
|
|
510
510
|
@verify_mode = nil
|
511
511
|
@cert_store = nil
|
512
512
|
|
513
|
-
@generation = 0 # incremented when proxy
|
513
|
+
@generation = 0 # incremented when proxy Gem::URI changes
|
514
514
|
|
515
515
|
if HAVE_OPENSSL then
|
516
516
|
@verify_mode = OpenSSL::SSL::VERIFY_PEER
|
@@ -720,12 +720,12 @@ class Gem::Net::HTTP::Persistent
|
|
720
720
|
alias key= private_key=
|
721
721
|
|
722
722
|
##
|
723
|
-
# Sets the proxy server. The +proxy+ may be the
|
723
|
+
# Sets the proxy server. The +proxy+ may be the Gem::URI of the proxy server,
|
724
724
|
# the symbol +:ENV+ which will read the proxy from the environment or nil to
|
725
725
|
# disable use of a proxy. See #proxy_from_env for details on setting the
|
726
726
|
# proxy from the environment.
|
727
727
|
#
|
728
|
-
# If the proxy
|
728
|
+
# If the proxy Gem::URI is set after requests have been made, the next request
|
729
729
|
# will shut-down and re-open all connections.
|
730
730
|
#
|
731
731
|
# The +no_proxy+ query parameter can be used to specify hosts which shouldn't
|
@@ -736,9 +736,9 @@ class Gem::Net::HTTP::Persistent
|
|
736
736
|
def proxy= proxy
|
737
737
|
@proxy_uri = case proxy
|
738
738
|
when :ENV then proxy_from_env
|
739
|
-
when
|
739
|
+
when Gem::URI::HTTP then proxy
|
740
740
|
when nil then # ignore
|
741
|
-
else raise ArgumentError, 'proxy must be :ENV or a
|
741
|
+
else raise ArgumentError, 'proxy must be :ENV or a Gem::URI::HTTP'
|
742
742
|
end
|
743
743
|
|
744
744
|
@no_proxy.clear
|
@@ -763,13 +763,13 @@ class Gem::Net::HTTP::Persistent
|
|
763
763
|
end
|
764
764
|
|
765
765
|
##
|
766
|
-
# Creates a
|
766
|
+
# Creates a Gem::URI for an HTTP proxy server from ENV variables.
|
767
767
|
#
|
768
768
|
# If +HTTP_PROXY+ is set a proxy will be returned.
|
769
769
|
#
|
770
|
-
# If +HTTP_PROXY_USER+ or +HTTP_PROXY_PASS+ are set the
|
770
|
+
# If +HTTP_PROXY_USER+ or +HTTP_PROXY_PASS+ are set the Gem::URI is given the
|
771
771
|
# indicated user and password unless HTTP_PROXY contains either of these in
|
772
|
-
# the
|
772
|
+
# the Gem::URI.
|
773
773
|
#
|
774
774
|
# The +NO_PROXY+ ENV variable can be used to specify hosts which shouldn't
|
775
775
|
# be reached via proxy; if set it should be a comma separated list of
|
@@ -785,7 +785,7 @@ class Gem::Net::HTTP::Persistent
|
|
785
785
|
|
786
786
|
return nil if env_proxy.nil? or env_proxy.empty?
|
787
787
|
|
788
|
-
uri =
|
788
|
+
uri = Gem::URI normalize_uri env_proxy
|
789
789
|
|
790
790
|
env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
|
791
791
|
|
@@ -863,7 +863,7 @@ class Gem::Net::HTTP::Persistent
|
|
863
863
|
# +req+ must be a Gem::Net::HTTPGenericRequest subclass (see Gem::Net::HTTP for a list).
|
864
864
|
|
865
865
|
def request uri, req = nil, &block
|
866
|
-
uri =
|
866
|
+
uri = Gem::URI uri
|
867
867
|
req = request_setup req || uri
|
868
868
|
response = nil
|
869
869
|
|
@@ -896,7 +896,7 @@ class Gem::Net::HTTP::Persistent
|
|
896
896
|
end
|
897
897
|
|
898
898
|
##
|
899
|
-
# Creates a GET request if +req_or_uri+ is a
|
899
|
+
# Creates a GET request if +req_or_uri+ is a Gem::URI and adds headers to the
|
900
900
|
# request.
|
901
901
|
#
|
902
902
|
# Returns the request.
|
@@ -1,4 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Bundler; end
|
4
|
-
|
4
|
+
|
5
|
+
# Use RubyGems vendored copy when available. Otherwise fallback to Bundler
|
6
|
+
# vendored copy. The vendored copy in Bundler can be removed once support for
|
7
|
+
# RubyGems 3.5 is dropped.
|
8
|
+
|
9
|
+
begin
|
10
|
+
require "rubygems/vendor/uri/lib/uri"
|
11
|
+
rescue LoadError
|
12
|
+
require_relative "vendor/uri/lib/uri"
|
13
|
+
Gem::URI = Bundler::URI
|
14
|
+
|
15
|
+
module Gem
|
16
|
+
def URI(uri) # rubocop:disable Naming/MethodName
|
17
|
+
Bundler::URI(uri)
|
18
|
+
end
|
19
|
+
module_function :URI
|
20
|
+
end
|
21
|
+
end
|
@@ -58,6 +58,8 @@ module Bundler
|
|
58
58
|
str.split(/\r?\n/) do |line|
|
59
59
|
if match = HASH_REGEX.match(line)
|
60
60
|
indent, key, quote, val = match.captures
|
61
|
+
val = strip_comment(val)
|
62
|
+
|
61
63
|
convert_to_backward_compatible_key!(key)
|
62
64
|
depth = indent.size / 2
|
63
65
|
if quote.empty? && val.empty?
|
@@ -72,6 +74,8 @@ module Bundler
|
|
72
74
|
end
|
73
75
|
elsif match = ARRAY_REGEX.match(line)
|
74
76
|
_, val = match.captures
|
77
|
+
val = strip_comment(val)
|
78
|
+
|
75
79
|
last_hash[last_empty_key] = [] unless last_hash[last_empty_key].is_a?(Array)
|
76
80
|
|
77
81
|
last_hash[last_empty_key].push(val)
|
@@ -80,6 +84,14 @@ module Bundler
|
|
80
84
|
res
|
81
85
|
end
|
82
86
|
|
87
|
+
def strip_comment(val)
|
88
|
+
if val.include?("#") && !val.start_with?("#")
|
89
|
+
val.split("#", 2).first.strip
|
90
|
+
else
|
91
|
+
val
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
83
95
|
# for settings' keys
|
84
96
|
def convert_to_backward_compatible_key!(key)
|
85
97
|
key << "/" if /https?:/i.match?(key) && !%r{/\Z}.match?(key)
|
data/bundler/lib/bundler.rb
CHANGED
@@ -200,12 +200,13 @@ module Bundler
|
|
200
200
|
#
|
201
201
|
# @param unlock [Hash, Boolean, nil] Gems that have been requested
|
202
202
|
# to be updated or true if all gems should be updated
|
203
|
+
# @param lockfile [Pathname] Path to Gemfile.lock
|
203
204
|
# @return [Bundler::Definition]
|
204
|
-
def definition(unlock = nil)
|
205
|
+
def definition(unlock = nil, lockfile = default_lockfile)
|
205
206
|
@definition = nil if unlock
|
206
207
|
@definition ||= begin
|
207
208
|
configure
|
208
|
-
Definition.build(default_gemfile,
|
209
|
+
Definition.build(default_gemfile, lockfile, unlock)
|
209
210
|
end
|
210
211
|
end
|
211
212
|
|
@@ -59,7 +59,7 @@ class Gem::Commands::SourcesCommand < Gem::Command
|
|
59
59
|
|
60
60
|
say "#{source_uri} added to sources"
|
61
61
|
end
|
62
|
-
rescue URI::Error, ArgumentError
|
62
|
+
rescue Gem::URI::Error, ArgumentError
|
63
63
|
say "#{source_uri} is not a URI"
|
64
64
|
terminate_interaction 1
|
65
65
|
rescue Gem::RemoteFetcher::FetchError => e
|
@@ -81,7 +81,7 @@ Do you want to add this source?
|
|
81
81
|
end
|
82
82
|
|
83
83
|
def check_rubygems_https(source_uri) # :nodoc:
|
84
|
-
uri = URI source_uri
|
84
|
+
uri = Gem::URI source_uri
|
85
85
|
|
86
86
|
if uri.scheme && uri.scheme.casecmp("http").zero? &&
|
87
87
|
uri.host.casecmp("rubygems.org").zero?
|
@@ -39,7 +39,14 @@ module Kernel
|
|
39
39
|
RUBYGEMS_ACTIVATION_MONITOR.synchronize do
|
40
40
|
path = File.path(path)
|
41
41
|
|
42
|
-
|
42
|
+
# If +path+ belongs to a default gem, we activate it and then go straight
|
43
|
+
# to normal require
|
44
|
+
|
45
|
+
if spec = Gem.find_default_spec(path)
|
46
|
+
name = spec.name
|
47
|
+
|
48
|
+
next if Gem.loaded_specs[name]
|
49
|
+
|
43
50
|
# Ensure -I beats a default gem
|
44
51
|
resolved_path = begin
|
45
52
|
rp = nil
|
@@ -57,8 +64,10 @@ module Kernel
|
|
57
64
|
rp
|
58
65
|
end
|
59
66
|
|
60
|
-
Kernel.send(:gem,
|
67
|
+
Kernel.send(:gem, name, Gem::Requirement.default_prerelease) unless
|
61
68
|
resolved_path
|
69
|
+
|
70
|
+
next
|
62
71
|
end
|
63
72
|
|
64
73
|
# If there are no unresolved deps, then we can use just try
|
data/lib/rubygems/defaults.rb
CHANGED
@@ -24,7 +24,7 @@ module Gem
|
|
24
24
|
default_spec_cache_dir = File.join Gem.user_home, ".gem", "specs"
|
25
25
|
|
26
26
|
unless File.exist?(default_spec_cache_dir)
|
27
|
-
default_spec_cache_dir = File.join Gem.
|
27
|
+
default_spec_cache_dir = File.join Gem.cache_home, "gem", "specs"
|
28
28
|
end
|
29
29
|
|
30
30
|
default_spec_cache_dir
|
@@ -10,7 +10,8 @@ require_relative "gemcutter_utilities/webauthn_poller"
|
|
10
10
|
|
11
11
|
module Gem::GemcutterUtilities
|
12
12
|
ERROR_CODE = 1
|
13
|
-
API_SCOPES = [:index_rubygems, :push_rubygem, :yank_rubygem, :add_owner, :remove_owner, :access_webhooks
|
13
|
+
API_SCOPES = [:index_rubygems, :push_rubygem, :yank_rubygem, :add_owner, :remove_owner, :access_webhooks].freeze
|
14
|
+
EXCLUSIVELY_API_SCOPES = [:show_dashboard].freeze
|
14
15
|
|
15
16
|
include Gem::Text
|
16
17
|
|
@@ -93,8 +94,8 @@ module Gem::GemcutterUtilities
|
|
93
94
|
end
|
94
95
|
|
95
96
|
if allowed_push_host
|
96
|
-
allowed_host_uri = URI.parse(allowed_push_host)
|
97
|
-
host_uri = URI.parse(self.host)
|
97
|
+
allowed_host_uri = Gem::URI.parse(allowed_push_host)
|
98
|
+
host_uri = Gem::URI.parse(self.host)
|
98
99
|
|
99
100
|
unless (host_uri.scheme == allowed_host_uri.scheme) && (host_uri.host == allowed_host_uri.host)
|
100
101
|
alert_error "#{self.host.inspect} is not allowed by the gemspec, which only allows #{allowed_push_host.inspect}"
|
@@ -102,7 +103,7 @@ module Gem::GemcutterUtilities
|
|
102
103
|
end
|
103
104
|
end
|
104
105
|
|
105
|
-
uri = URI.parse "#{self.host}/#{path}"
|
106
|
+
uri = Gem::URI.parse "#{self.host}/#{path}"
|
106
107
|
response = request_with_otp(method, uri, &block)
|
107
108
|
|
108
109
|
if mfa_unauthorized?(response)
|
@@ -129,14 +130,14 @@ module Gem::GemcutterUtilities
|
|
129
130
|
|
130
131
|
say "The existing key doesn't have access of #{scope} on #{pretty_host}. Please sign in to update access."
|
131
132
|
|
132
|
-
|
133
|
-
password
|
133
|
+
identifier = ask "Username/email: "
|
134
|
+
password = ask_for_password " Password: "
|
134
135
|
|
135
136
|
response = rubygems_api_request(:put, "api/v1/api_key",
|
136
137
|
sign_in_host, scope: scope) do |request|
|
137
|
-
request.basic_auth
|
138
|
+
request.basic_auth identifier, password
|
138
139
|
request["OTP"] = otp if otp
|
139
|
-
request.body = URI.encode_www_form({ api_key: api_key }.merge(update_scope_params))
|
140
|
+
request.body = Gem::URI.encode_www_form({ api_key: api_key }.merge(update_scope_params))
|
140
141
|
end
|
141
142
|
|
142
143
|
with_response response do |_resp|
|
@@ -158,25 +159,25 @@ module Gem::GemcutterUtilities
|
|
158
159
|
say "Don't have an account yet? " \
|
159
160
|
"Create one at #{sign_in_host}/sign_up"
|
160
161
|
|
161
|
-
|
162
|
-
password
|
162
|
+
identifier = ask "Username/email: "
|
163
|
+
password = ask_for_password " Password: "
|
163
164
|
say "\n"
|
164
165
|
|
165
166
|
key_name = get_key_name(scope)
|
166
167
|
scope_params = get_scope_params(scope)
|
167
|
-
profile = get_user_profile(
|
168
|
+
profile = get_user_profile(identifier, password)
|
168
169
|
mfa_params = get_mfa_params(profile)
|
169
170
|
all_params = scope_params.merge(mfa_params)
|
170
171
|
warning = profile["warning"]
|
171
|
-
credentials = {
|
172
|
+
credentials = { identifier: identifier, password: password }
|
172
173
|
|
173
174
|
say "#{warning}\n" if warning
|
174
175
|
|
175
176
|
response = rubygems_api_request(:post, "api/v1/api_key",
|
176
177
|
sign_in_host, credentials: credentials, scope: scope) do |request|
|
177
|
-
request.basic_auth
|
178
|
+
request.basic_auth identifier, password
|
178
179
|
request["OTP"] = otp if otp
|
179
|
-
request.body = URI.encode_www_form({ name: key_name }.merge(all_params))
|
180
|
+
request.body = Gem::URI.encode_www_form({ name: key_name }.merge(all_params))
|
180
181
|
end
|
181
182
|
|
182
183
|
with_response response do |resp|
|
@@ -294,7 +295,7 @@ module Gem::GemcutterUtilities
|
|
294
295
|
if credentials.empty?
|
295
296
|
request.add_field "Authorization", api_key
|
296
297
|
else
|
297
|
-
request.basic_auth credentials[:
|
298
|
+
request.basic_auth credentials[:identifier], credentials[:password]
|
298
299
|
end
|
299
300
|
end
|
300
301
|
response.is_a?(Gem::Net::HTTPSuccess) ? response.body : nil
|
@@ -309,15 +310,31 @@ module Gem::GemcutterUtilities
|
|
309
310
|
end
|
310
311
|
|
311
312
|
def get_scope_params(scope)
|
312
|
-
scope_params = {}
|
313
|
+
scope_params = { index_rubygems: true }
|
313
314
|
|
314
315
|
if scope
|
315
316
|
scope_params = { scope => true }
|
316
317
|
else
|
317
|
-
say "
|
318
|
-
|
319
|
-
|
320
|
-
|
318
|
+
say "The default access scope is:"
|
319
|
+
scope_params.each do |k, _v|
|
320
|
+
say " #{k}: y"
|
321
|
+
end
|
322
|
+
say "\n"
|
323
|
+
customise = ask_yes_no("Do you want to customise scopes?", false)
|
324
|
+
if customise
|
325
|
+
EXCLUSIVELY_API_SCOPES.each do |excl_scope|
|
326
|
+
selected = ask_yes_no("#{excl_scope} (exclusive scope, answering yes will not prompt for other scopes)", false)
|
327
|
+
next unless selected
|
328
|
+
|
329
|
+
return { excl_scope => true }
|
330
|
+
end
|
331
|
+
|
332
|
+
scope_params = {}
|
333
|
+
|
334
|
+
API_SCOPES.each do |s|
|
335
|
+
selected = ask_yes_no(s.to_s, false)
|
336
|
+
scope_params[s] = true if selected
|
337
|
+
end
|
321
338
|
end
|
322
339
|
say "\n"
|
323
340
|
end
|
@@ -329,11 +346,11 @@ module Gem::GemcutterUtilities
|
|
329
346
|
host == Gem::DEFAULT_HOST
|
330
347
|
end
|
331
348
|
|
332
|
-
def get_user_profile(
|
349
|
+
def get_user_profile(identifier, password)
|
333
350
|
return {} unless default_host?
|
334
351
|
|
335
352
|
response = rubygems_api_request(:get, "api/v1/profile/me.yaml") do |request|
|
336
|
-
request.basic_auth
|
353
|
+
request.basic_auth identifier, password
|
337
354
|
end
|
338
355
|
|
339
356
|
with_response response do |resp|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# See LICENSE.txt for permissions.
|
7
7
|
#++
|
8
8
|
|
9
|
-
|
9
|
+
require_relative "vendor/uri/lib/uri"
|
10
10
|
require_relative "../rubygems"
|
11
11
|
|
12
12
|
##
|
@@ -17,10 +17,10 @@ module Gem::LocalRemoteOptions
|
|
17
17
|
# Allows Gem::OptionParser to handle HTTP URIs.
|
18
18
|
|
19
19
|
def accept_uri_http
|
20
|
-
Gem::OptionParser.accept URI::HTTP do |value|
|
20
|
+
Gem::OptionParser.accept Gem::URI::HTTP do |value|
|
21
21
|
begin
|
22
|
-
uri = URI.parse value
|
23
|
-
rescue URI::InvalidURIError
|
22
|
+
uri = Gem::URI.parse value
|
23
|
+
rescue Gem::URI::InvalidURIError
|
24
24
|
raise Gem::OptionParser::InvalidArgument, value
|
25
25
|
end
|
26
26
|
|
@@ -88,7 +88,7 @@ module Gem::LocalRemoteOptions
|
|
88
88
|
def add_proxy_option
|
89
89
|
accept_uri_http
|
90
90
|
|
91
|
-
add_option(:"Local/Remote", "-p", "--[no-]http-proxy [URL]", URI::HTTP,
|
91
|
+
add_option(:"Local/Remote", "-p", "--[no-]http-proxy [URL]", Gem::URI::HTTP,
|
92
92
|
"Use HTTP proxy for remote operations") do |value, options|
|
93
93
|
options[:http_proxy] = value == false ? :no_proxy : value
|
94
94
|
Gem.configuration[:http_proxy] = options[:http_proxy]
|
@@ -101,7 +101,7 @@ module Gem::LocalRemoteOptions
|
|
101
101
|
def add_source_option
|
102
102
|
accept_uri_http
|
103
103
|
|
104
|
-
add_option(:"Local/Remote", "-s", "--source URL", URI::HTTP,
|
104
|
+
add_option(:"Local/Remote", "-s", "--source URL", Gem::URI::HTTP,
|
105
105
|
"Append URL to list of remote gem sources") do |source, options|
|
106
106
|
source << "/" unless source.end_with?("/")
|
107
107
|
|
data/lib/rubygems/net/http.rb
CHANGED
data/lib/rubygems/optparse.rb
CHANGED
@@ -76,7 +76,7 @@ class Gem::RemoteFetcher
|
|
76
76
|
require_relative "core_ext/tcpsocket_init" if Gem.configuration.ipv4_fallback_enabled
|
77
77
|
require_relative "net/http"
|
78
78
|
require "stringio"
|
79
|
-
|
79
|
+
require_relative "vendor/uri/lib/uri"
|
80
80
|
|
81
81
|
Socket.do_not_reverse_lookup = true
|
82
82
|
|
@@ -135,7 +135,7 @@ class Gem::RemoteFetcher
|
|
135
135
|
|
136
136
|
scheme = source_uri.scheme
|
137
137
|
|
138
|
-
# URI.parse gets confused by MS Windows paths with forward slashes.
|
138
|
+
# Gem::URI.parse gets confused by MS Windows paths with forward slashes.
|
139
139
|
scheme = nil if /^[a-z]$/i.match?(scheme)
|
140
140
|
|
141
141
|
# REFACTOR: split this up and dispatch on scheme (eg download_http)
|