rubygems-update 3.5.5 → 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 +26 -0
- data/Manifest.txt +77 -60
- data/bundler/CHANGELOG.md +15 -0
- 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/definition.rb +54 -28
- 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/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/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 +5 -5
- 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 +1 -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
@@ -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?
|
@@ -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)
|
data/lib/rubygems/request.rb
CHANGED
@@ -18,11 +18,11 @@ class Gem::Request
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def self.proxy_uri(proxy) # :nodoc:
|
21
|
-
|
21
|
+
require_relative "vendor/uri/lib/uri"
|
22
22
|
case proxy
|
23
23
|
when :no_proxy then nil
|
24
|
-
when URI::HTTP then proxy
|
25
|
-
else URI.parse(proxy)
|
24
|
+
when Gem::URI::HTTP then proxy
|
25
|
+
else Gem::URI.parse(proxy)
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
@@ -176,7 +176,7 @@ class Gem::Request
|
|
176
176
|
end
|
177
177
|
|
178
178
|
require "uri"
|
179
|
-
uri = URI(Gem::UriFormatter.new(env_proxy).normalize)
|
179
|
+
uri = Gem::URI(Gem::UriFormatter.new(env_proxy).normalize)
|
180
180
|
|
181
181
|
if uri && uri.user.nil? && uri.password.nil?
|
182
182
|
user = ENV["#{downcase_scheme}_proxy_user"] || ENV["#{upcase_scheme}_PROXY_USER"]
|
data/lib/rubygems/requirement.rb
CHANGED
@@ -284,6 +284,11 @@ class Gem::Requirement
|
|
284
284
|
def _tilde_requirements
|
285
285
|
@_tilde_requirements ||= _sorted_requirements.select {|r| r.first == "~>" }
|
286
286
|
end
|
287
|
+
|
288
|
+
def initialize_copy(other) # :nodoc:
|
289
|
+
@requirements = other.requirements.dup
|
290
|
+
super
|
291
|
+
end
|
287
292
|
end
|
288
293
|
|
289
294
|
class Gem::Version
|
@@ -30,7 +30,7 @@ class Gem::Resolver::APISet < Gem::Resolver::Set
|
|
30
30
|
def initialize(dep_uri = "https://index.rubygems.org/info/")
|
31
31
|
super()
|
32
32
|
|
33
|
-
dep_uri = URI dep_uri unless URI === dep_uri
|
33
|
+
dep_uri = Gem::URI dep_uri unless Gem::URI === dep_uri
|
34
34
|
|
35
35
|
@dep_uri = dep_uri
|
36
36
|
@uri = dep_uri + ".."
|
@@ -60,7 +60,7 @@ class Gem::Resolver::BestSet < Gem::Resolver::ComposedSet
|
|
60
60
|
|
61
61
|
def replace_failed_api_set(error) # :nodoc:
|
62
62
|
uri = error.original_uri
|
63
|
-
uri = URI uri unless URI === uri
|
63
|
+
uri = Gem::URI uri unless Gem::URI === uri
|
64
64
|
uri += "."
|
65
65
|
|
66
66
|
raise error unless api_set = @sets.find do |set|
|
data/lib/rubygems/resolver.rb
CHANGED
@@ -11,7 +11,7 @@ require_relative "util/list"
|
|
11
11
|
# all the requirements.
|
12
12
|
|
13
13
|
class Gem::Resolver
|
14
|
-
require_relative "
|
14
|
+
require_relative "vendored_molinillo"
|
15
15
|
|
16
16
|
##
|
17
17
|
# If the DEBUG_RESOLVER environment variable is set then debugging mode is
|
@@ -167,7 +167,7 @@ class Gem::Resolver
|
|
167
167
|
reqs
|
168
168
|
end
|
169
169
|
|
170
|
-
include Molinillo::UI
|
170
|
+
include Gem::Molinillo::UI
|
171
171
|
|
172
172
|
def output
|
173
173
|
@output ||= debug? ? $stdout : File.open(IO::NULL, "w")
|
@@ -177,14 +177,14 @@ class Gem::Resolver
|
|
177
177
|
DEBUG_RESOLVER
|
178
178
|
end
|
179
179
|
|
180
|
-
include Molinillo::SpecificationProvider
|
180
|
+
include Gem::Molinillo::SpecificationProvider
|
181
181
|
|
182
182
|
##
|
183
183
|
# Proceed with resolution! Returns an array of ActivationRequest objects.
|
184
184
|
|
185
185
|
def resolve
|
186
|
-
Molinillo::Resolver.new(self, self).resolve(@needed.map {|d| DependencyRequest.new d, nil }).tsort.map(&:payload).compact
|
187
|
-
rescue Molinillo::VersionConflict => e
|
186
|
+
Gem::Molinillo::Resolver.new(self, self).resolve(@needed.map {|d| DependencyRequest.new d, nil }).tsort.map(&:payload).compact
|
187
|
+
rescue Gem::Molinillo::VersionConflict => e
|
188
188
|
conflict = e.conflicts.values.first
|
189
189
|
raise Gem::DependencyResolutionError, Conflict.new(conflict.requirement_trees.first.first, conflict.existing, conflict.requirement)
|
190
190
|
ensure
|
@@ -49,7 +49,7 @@ class Gem::S3URISigner
|
|
49
49
|
string_to_sign = generate_string_to_sign(date_time, credential_info, canonical_request)
|
50
50
|
signature = generate_signature(s3_config, date, string_to_sign)
|
51
51
|
|
52
|
-
URI.parse("https://#{canonical_host}#{uri.path}?#{query_params}&X-Amz-Signature=#{signature}")
|
52
|
+
Gem::URI.parse("https://#{canonical_host}#{uri.path}?#{query_params}&X-Amz-Signature=#{signature}")
|
53
53
|
end
|
54
54
|
|
55
55
|
private
|
@@ -152,7 +152,7 @@ class Gem::S3URISigner
|
|
152
152
|
end
|
153
153
|
|
154
154
|
def ec2_metadata_request(url)
|
155
|
-
uri = URI(url)
|
155
|
+
uri = Gem::URI(url)
|
156
156
|
@request_pool ||= create_request_pool(uri)
|
157
157
|
request = Gem::Request.new(uri, Gem::Net::HTTP::Get, nil, @request_pool)
|
158
158
|
response = request.fetch
|
data/lib/rubygems/source/git.rb
CHANGED
@@ -221,14 +221,14 @@ class Gem::Source::Git < Gem::Source
|
|
221
221
|
end
|
222
222
|
|
223
223
|
##
|
224
|
-
# A hash for the git gem based on the git repository URI.
|
224
|
+
# A hash for the git gem based on the git repository Gem::URI.
|
225
225
|
|
226
226
|
def uri_hash # :nodoc:
|
227
227
|
require_relative "../openssl"
|
228
228
|
|
229
229
|
normalized =
|
230
230
|
if @repository.match?(%r{^\w+://(\w+@)?})
|
231
|
-
uri = URI(@repository).normalize.to_s.sub %r{/$},""
|
231
|
+
uri = Gem::URI(@repository).normalize.to_s.sub %r{/$},""
|
232
232
|
uri.sub(/\A(\w+)/) { $1.downcase }
|
233
233
|
else
|
234
234
|
@repository
|
data/lib/rubygems/source_list.rb
CHANGED
@@ -1003,8 +1003,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1003
1003
|
def self.find_all_by_name(name, *requirements)
|
1004
1004
|
requirements = Gem::Requirement.default if requirements.empty?
|
1005
1005
|
|
1006
|
-
# TODO: maybe try: find_all { |s| spec === dep }
|
1007
|
-
|
1008
1006
|
Gem::Dependency.new(name, *requirements).matching_specs
|
1009
1007
|
end
|
1010
1008
|
|
@@ -1022,8 +1020,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1022
1020
|
def self.find_by_name(name, *requirements)
|
1023
1021
|
requirements = Gem::Requirement.default if requirements.empty?
|
1024
1022
|
|
1025
|
-
# TODO: maybe try: find { |s| spec === dep }
|
1026
|
-
|
1027
1023
|
Gem::Dependency.new(name, *requirements).to_spec
|
1028
1024
|
end
|
1029
1025
|
|
@@ -2079,7 +2075,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2079
2075
|
end
|
2080
2076
|
|
2081
2077
|
##
|
2082
|
-
# Duplicates
|
2078
|
+
# Duplicates Array and Gem::Requirement attributes from +other_spec+ so state isn't shared.
|
2079
|
+
#
|
2083
2080
|
|
2084
2081
|
def initialize_copy(other_spec)
|
2085
2082
|
self.class.array_attributes.each do |name|
|
@@ -2101,6 +2098,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2101
2098
|
raise e
|
2102
2099
|
end
|
2103
2100
|
end
|
2101
|
+
|
2102
|
+
@required_ruby_version = other_spec.required_ruby_version.dup
|
2103
|
+
@required_rubygems_version = other_spec.required_rubygems_version.dup
|
2104
2104
|
end
|
2105
2105
|
|
2106
2106
|
def base_dir
|