rubygems-update 3.2.9 → 3.2.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +40 -0
- data/Manifest.txt +1 -0
- data/Rakefile +6 -0
- data/bundler/CHANGELOG.md +49 -0
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/gem.rb +23 -17
- data/bundler/lib/bundler/compact_index_client/updater.rb +1 -1
- data/bundler/lib/bundler/definition.rb +43 -26
- data/bundler/lib/bundler/dsl.rb +36 -25
- data/bundler/lib/bundler/inline.rb +1 -0
- data/bundler/lib/bundler/installer.rb +2 -0
- data/bundler/lib/bundler/installer/parallel_installer.rb +6 -8
- data/bundler/lib/bundler/lockfile_parser.rb +3 -13
- data/bundler/lib/bundler/man/bundle-config.1 +4 -4
- data/bundler/lib/bundler/man/bundle-config.1.ronn +8 -7
- data/bundler/lib/bundler/plugin.rb +1 -0
- data/bundler/lib/bundler/plugin/api/source.rb +7 -0
- data/bundler/lib/bundler/plugin/installer.rb +8 -10
- data/bundler/lib/bundler/plugin/source_list.rb +4 -0
- data/bundler/lib/bundler/resolver.rb +36 -38
- data/bundler/lib/bundler/rubygems_gem_installer.rb +47 -0
- data/bundler/lib/bundler/source.rb +6 -0
- data/bundler/lib/bundler/source/metadata.rb +0 -4
- data/bundler/lib/bundler/source/rubygems.rb +20 -4
- data/bundler/lib/bundler/source_list.rb +27 -20
- data/bundler/lib/bundler/spec_set.rb +2 -0
- data/bundler/lib/bundler/stub_specification.rb +8 -0
- data/bundler/lib/bundler/templates/newgem/README.md.tt +5 -3
- data/bundler/lib/bundler/version.rb +1 -1
- data/lib/rubygems.rb +1 -1
- data/lib/rubygems/command.rb +1 -0
- data/lib/rubygems/config_file.rb +9 -0
- data/lib/rubygems/core_ext/tcpsocket_init.rb +52 -0
- data/lib/rubygems/remote_fetcher.rb +4 -8
- data/lib/rubygems/specification.rb +3 -0
- data/rubygems-update.gemspec +1 -1
- data/test/rubygems/test_gem.rb +2 -8
- data/test/rubygems/test_gem_config_file.rb +10 -0
- data/test/rubygems/test_gem_remote_fetcher.rb +44 -0
- metadata +4 -3
@@ -33,6 +33,12 @@ module Bundler
|
|
33
33
|
spec.source == self
|
34
34
|
end
|
35
35
|
|
36
|
+
def local!; end
|
37
|
+
|
38
|
+
def cached!; end
|
39
|
+
|
40
|
+
def remote!; end
|
41
|
+
|
36
42
|
# it's possible that gems from one source depend on gems from some
|
37
43
|
# other source, so now we download gemspecs and iterate over those
|
38
44
|
# dependencies, looking for gems we don't have info on yet.
|
@@ -20,17 +20,29 @@ module Bundler
|
|
20
20
|
@dependency_names = []
|
21
21
|
@allow_remote = false
|
22
22
|
@allow_cached = false
|
23
|
+
@allow_local = options["allow_local"] || false
|
23
24
|
@caches = [cache_path, *Bundler.rubygems.gem_cache]
|
24
25
|
|
25
|
-
Array(options["remotes"]
|
26
|
+
Array(options["remotes"]).reverse_each {|r| add_remote(r) }
|
27
|
+
end
|
28
|
+
|
29
|
+
def local!
|
30
|
+
return if @allow_local
|
31
|
+
|
32
|
+
@specs = nil
|
33
|
+
@allow_local = true
|
26
34
|
end
|
27
35
|
|
28
36
|
def remote!
|
37
|
+
return if @allow_remote
|
38
|
+
|
29
39
|
@specs = nil
|
30
40
|
@allow_remote = true
|
31
41
|
end
|
32
42
|
|
33
43
|
def cached!
|
44
|
+
return if @allow_cached
|
45
|
+
|
34
46
|
@specs = nil
|
35
47
|
@allow_cached = true
|
36
48
|
end
|
@@ -49,8 +61,12 @@ module Bundler
|
|
49
61
|
o.is_a?(Rubygems) && (o.credless_remotes - credless_remotes).empty?
|
50
62
|
end
|
51
63
|
|
64
|
+
def disable_multisource?
|
65
|
+
@remotes.size <= 1
|
66
|
+
end
|
67
|
+
|
52
68
|
def can_lock?(spec)
|
53
|
-
return super if
|
69
|
+
return super if disable_multisource?
|
54
70
|
spec.source.is_a?(Rubygems)
|
55
71
|
end
|
56
72
|
|
@@ -87,7 +103,7 @@ module Bundler
|
|
87
103
|
# small_idx.use large_idx.
|
88
104
|
idx = @allow_remote ? remote_specs.dup : Index.new
|
89
105
|
idx.use(cached_specs, :override_dupes) if @allow_cached || @allow_remote
|
90
|
-
idx.use(installed_specs, :override_dupes)
|
106
|
+
idx.use(installed_specs, :override_dupes) if @allow_local
|
91
107
|
idx
|
92
108
|
end
|
93
109
|
end
|
@@ -365,7 +381,7 @@ module Bundler
|
|
365
381
|
|
366
382
|
def cached_specs
|
367
383
|
@cached_specs ||= begin
|
368
|
-
idx = installed_specs.dup
|
384
|
+
idx = @allow_local ? installed_specs.dup : Index.new
|
369
385
|
|
370
386
|
Dir["#{cache_path}/*.gem"].each do |gemfile|
|
371
387
|
next if gemfile =~ /^bundler\-[\d\.]+?\.gem/
|
@@ -5,24 +5,40 @@ module Bundler
|
|
5
5
|
attr_reader :path_sources,
|
6
6
|
:git_sources,
|
7
7
|
:plugin_sources,
|
8
|
-
:
|
8
|
+
:global_path_source,
|
9
9
|
:metadata_source
|
10
10
|
|
11
|
+
def global_rubygems_source
|
12
|
+
@global_rubygems_source ||= rubygems_aggregate_class.new("allow_local" => true)
|
13
|
+
end
|
14
|
+
|
11
15
|
def initialize
|
12
16
|
@path_sources = []
|
13
17
|
@git_sources = []
|
14
18
|
@plugin_sources = []
|
15
19
|
@global_rubygems_source = nil
|
16
|
-
@
|
20
|
+
@global_path_source = nil
|
17
21
|
@rubygems_sources = []
|
18
22
|
@metadata_source = Source::Metadata.new
|
23
|
+
|
24
|
+
@disable_multisource = true
|
25
|
+
end
|
26
|
+
|
27
|
+
def disable_multisource?
|
28
|
+
@disable_multisource
|
29
|
+
end
|
30
|
+
|
31
|
+
def merged_gem_lockfile_sections!
|
32
|
+
@disable_multisource = false
|
19
33
|
end
|
20
34
|
|
21
35
|
def add_path_source(options = {})
|
22
36
|
if options["gemspec"]
|
23
37
|
add_source_to_list Source::Gemspec.new(options), path_sources
|
24
38
|
else
|
25
|
-
add_source_to_list Source::Path.new(options), path_sources
|
39
|
+
path_source = add_source_to_list Source::Path.new(options), path_sources
|
40
|
+
@global_path_source ||= path_source if options["global"]
|
41
|
+
path_source
|
26
42
|
end
|
27
43
|
end
|
28
44
|
|
@@ -41,24 +57,20 @@ module Bundler
|
|
41
57
|
end
|
42
58
|
|
43
59
|
def global_rubygems_source=(uri)
|
44
|
-
|
45
|
-
@global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri)
|
46
|
-
end
|
47
|
-
add_rubygems_remote(uri)
|
60
|
+
@global_rubygems_source ||= rubygems_aggregate_class.new("remotes" => uri, "allow_local" => true)
|
48
61
|
end
|
49
62
|
|
50
63
|
def add_rubygems_remote(uri)
|
51
|
-
|
52
|
-
|
53
|
-
@rubygems_aggregate
|
64
|
+
global_rubygems_source.add_remote(uri)
|
65
|
+
global_rubygems_source
|
54
66
|
end
|
55
67
|
|
56
68
|
def default_source
|
57
|
-
|
69
|
+
global_path_source || global_rubygems_source
|
58
70
|
end
|
59
71
|
|
60
72
|
def rubygems_sources
|
61
|
-
@rubygems_sources + [
|
73
|
+
@rubygems_sources + [global_rubygems_source]
|
62
74
|
end
|
63
75
|
|
64
76
|
def rubygems_remotes
|
@@ -75,7 +87,7 @@ module Bundler
|
|
75
87
|
|
76
88
|
def lock_sources
|
77
89
|
lock_sources = (path_sources + git_sources + plugin_sources).sort_by(&:to_s)
|
78
|
-
if
|
90
|
+
if disable_multisource?
|
79
91
|
lock_sources + rubygems_sources.sort_by(&:to_s)
|
80
92
|
else
|
81
93
|
lock_sources << combine_rubygems_sources
|
@@ -92,12 +104,11 @@ module Bundler
|
|
92
104
|
end
|
93
105
|
end
|
94
106
|
|
95
|
-
replacement_rubygems = !
|
107
|
+
replacement_rubygems = !disable_multisource? &&
|
96
108
|
replacement_sources.detect {|s| s.is_a?(Source::Rubygems) }
|
97
|
-
@
|
109
|
+
@global_rubygems_source = replacement_rubygems if replacement_rubygems
|
98
110
|
|
99
111
|
return true if !equal_sources?(lock_sources, replacement_sources) && !equivalent_sources?(lock_sources, replacement_sources)
|
100
|
-
return true if replacement_rubygems && rubygems_remotes.sort_by(&:to_s) != replacement_rubygems.remotes.sort_by(&:to_s)
|
101
112
|
|
102
113
|
false
|
103
114
|
end
|
@@ -110,10 +121,6 @@ module Bundler
|
|
110
121
|
all_sources.each(&:remote!)
|
111
122
|
end
|
112
123
|
|
113
|
-
def rubygems_primary_remotes
|
114
|
-
@rubygems_aggregate.remotes
|
115
|
-
end
|
116
|
-
|
117
124
|
private
|
118
125
|
|
119
126
|
def rubygems_aggregate_class
|
@@ -82,6 +82,7 @@ module Bundler
|
|
82
82
|
materialized.map! do |s|
|
83
83
|
next s unless s.is_a?(LazySpecification)
|
84
84
|
s.source.dependency_names = deps if s.source.respond_to?(:dependency_names=)
|
85
|
+
s.source.local!
|
85
86
|
spec = s.__materialize__
|
86
87
|
unless spec
|
87
88
|
unless missing_specs
|
@@ -102,6 +103,7 @@ module Bundler
|
|
102
103
|
@specs.map do |s|
|
103
104
|
next s unless s.is_a?(LazySpecification)
|
104
105
|
s.source.dependency_names = names if s.source.respond_to?(:dependency_names=)
|
106
|
+
s.source.local!
|
105
107
|
s.source.remote!
|
106
108
|
spec = s.__materialize__
|
107
109
|
raise GemNotFound, "Could not find #{s.full_name} in any of the sources" unless spec
|
@@ -26,11 +26,19 @@ module Bundler
|
|
26
26
|
|
27
27
|
# @!group Stub Delegates
|
28
28
|
|
29
|
+
def manually_installed?
|
30
|
+
# This is for manually installed gems which are gems that were fixed in place after a
|
31
|
+
# failed installation. Once the issue was resolved, the user then manually created
|
32
|
+
# the gem specification using the instructions provided by `gem help install`
|
33
|
+
installed_by_version == Gem::Version.new(0)
|
34
|
+
end
|
35
|
+
|
29
36
|
# This is defined directly to avoid having to loading the full spec
|
30
37
|
def missing_extensions?
|
31
38
|
return false if default_gem?
|
32
39
|
return false if extensions.empty?
|
33
40
|
return false if File.exist? gem_build_complete_path
|
41
|
+
return false if manually_installed?
|
34
42
|
|
35
43
|
true
|
36
44
|
end
|
@@ -29,19 +29,21 @@ TODO: Write usage instructions here
|
|
29
29
|
After checking out the repo, run `bin/setup` to install dependencies.<% if config[:test] %> Then, run `rake <%= config[:test].sub('mini', '').sub('rspec', 'spec') %>` to run the tests.<% end %> You can also run `bin/console` for an interactive prompt that will allow you to experiment.<% if config[:bin] %> Run `bundle exec <%= config[:name] %>` to use the gem in this directory, ignoring other installed copies of this gem.<% end %>
|
30
30
|
|
31
31
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
<% if config[:git] -%>
|
32
33
|
|
33
34
|
## Contributing
|
34
35
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/<%= config[:github_username] %>/<%= config[:name] %>.<% if config[:coc] %> This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/<%= config[:git_default_branch] %>/CODE_OF_CONDUCT.md).<% end %>
|
37
|
+
<% end -%>
|
36
38
|
<% if config[:mit] -%>
|
37
39
|
|
38
40
|
## License
|
39
41
|
|
40
42
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
41
43
|
<% end -%>
|
42
|
-
<% if config[:coc] -%>
|
44
|
+
<% if config[:git] && config[:coc] -%>
|
43
45
|
|
44
46
|
## Code of Conduct
|
45
47
|
|
46
|
-
Everyone interacting in the <%= config[:constant_name] %> project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob
|
48
|
+
Everyone interacting in the <%= config[:constant_name] %> project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/<%= config[:github_username] %>/<%= config[:name] %>/blob/<%= config[:git_default_branch] %>/CODE_OF_CONDUCT.md).
|
47
49
|
<% end -%>
|
data/lib/rubygems.rb
CHANGED
data/lib/rubygems/command.rb
CHANGED
data/lib/rubygems/config_file.rb
CHANGED
@@ -45,6 +45,7 @@ class Gem::ConfigFile
|
|
45
45
|
DEFAULT_UPDATE_SOURCES = true
|
46
46
|
DEFAULT_CONCURRENT_DOWNLOADS = 8
|
47
47
|
DEFAULT_CERT_EXPIRATION_LENGTH_DAYS = 365
|
48
|
+
DEFAULT_IPV4_FALLBACK_ENABLED = false
|
48
49
|
|
49
50
|
##
|
50
51
|
# For Ruby packagers to set configuration defaults. Set in
|
@@ -140,6 +141,12 @@ class Gem::ConfigFile
|
|
140
141
|
|
141
142
|
attr_accessor :cert_expiration_length_days
|
142
143
|
|
144
|
+
##
|
145
|
+
# == Experimental ==
|
146
|
+
# Fallback to IPv4 when IPv6 is not reachable or slow (default: false)
|
147
|
+
|
148
|
+
attr_accessor :ipv4_fallback_enabled
|
149
|
+
|
143
150
|
##
|
144
151
|
# Path name of directory or file of openssl client certificate, used for remote https connection with client authentication
|
145
152
|
|
@@ -175,6 +182,7 @@ class Gem::ConfigFile
|
|
175
182
|
@update_sources = DEFAULT_UPDATE_SOURCES
|
176
183
|
@concurrent_downloads = DEFAULT_CONCURRENT_DOWNLOADS
|
177
184
|
@cert_expiration_length_days = DEFAULT_CERT_EXPIRATION_LENGTH_DAYS
|
185
|
+
@ipv4_fallback_enabled = ENV['IPV4_FALLBACK_ENABLED'] == 'true' || DEFAULT_IPV4_FALLBACK_ENABLED
|
178
186
|
|
179
187
|
operating_system_config = Marshal.load Marshal.dump(OPERATING_SYSTEM_DEFAULTS)
|
180
188
|
platform_config = Marshal.load Marshal.dump(PLATFORM_DEFAULTS)
|
@@ -203,6 +211,7 @@ class Gem::ConfigFile
|
|
203
211
|
@disable_default_gem_server = @hash[:disable_default_gem_server] if @hash.key? :disable_default_gem_server
|
204
212
|
@sources = @hash[:sources] if @hash.key? :sources
|
205
213
|
@cert_expiration_length_days = @hash[:cert_expiration_length_days] if @hash.key? :cert_expiration_length_days
|
214
|
+
@ipv4_fallback_enabled = @hash[:ipv4_fallback_enabled] if @hash.key? :ipv4_fallback_enabled
|
206
215
|
|
207
216
|
@ssl_verify_mode = @hash[:ssl_verify_mode] if @hash.key? :ssl_verify_mode
|
208
217
|
@ssl_ca_cert = @hash[:ssl_ca_cert] if @hash.key? :ssl_ca_cert
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'socket'
|
2
|
+
|
3
|
+
module CoreExtensions
|
4
|
+
module TCPSocketExt
|
5
|
+
def self.prepended(base)
|
6
|
+
base.prepend Initializer
|
7
|
+
end
|
8
|
+
|
9
|
+
module Initializer
|
10
|
+
CONNECTION_TIMEOUT = 5
|
11
|
+
IPV4_DELAY_SECONDS = 0.1
|
12
|
+
|
13
|
+
def initialize(host, serv, *rest)
|
14
|
+
mutex = Mutex.new
|
15
|
+
addrs = []
|
16
|
+
threads = []
|
17
|
+
cond_var = ConditionVariable.new
|
18
|
+
|
19
|
+
Addrinfo.foreach(host, serv, nil, :STREAM) do |addr|
|
20
|
+
Thread.report_on_exception = false if defined? Thread.report_on_exception = ()
|
21
|
+
|
22
|
+
threads << Thread.new(addr) do
|
23
|
+
# give head start to ipv6 addresses
|
24
|
+
sleep IPV4_DELAY_SECONDS if addr.ipv4?
|
25
|
+
|
26
|
+
# raises Errno::ECONNREFUSED when ip:port is unreachable
|
27
|
+
Socket.tcp(addr.ip_address, serv, connect_timeout: CONNECTION_TIMEOUT).close
|
28
|
+
mutex.synchronize do
|
29
|
+
addrs << addr.ip_address
|
30
|
+
cond_var.signal
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
mutex.synchronize do
|
36
|
+
timeout_time = CONNECTION_TIMEOUT + Time.now.to_f
|
37
|
+
while addrs.empty? && (remaining_time = timeout_time - Time.now.to_f) > 0
|
38
|
+
cond_var.wait(mutex, remaining_time)
|
39
|
+
end
|
40
|
+
|
41
|
+
host = addrs.shift unless addrs.empty?
|
42
|
+
end
|
43
|
+
|
44
|
+
threads.each {|t| t.kill.join if t.alive? }
|
45
|
+
|
46
|
+
super(host, serv, *rest)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
TCPSocket.prepend CoreExtensions::TCPSocketExt
|
@@ -51,6 +51,7 @@ class Gem::RemoteFetcher
|
|
51
51
|
|
52
52
|
class UnknownHostError < FetchError
|
53
53
|
end
|
54
|
+
deprecate_constant(:UnknownHostError)
|
54
55
|
|
55
56
|
@fetcher = nil
|
56
57
|
|
@@ -78,6 +79,7 @@ class Gem::RemoteFetcher
|
|
78
79
|
# fetching the gem.
|
79
80
|
|
80
81
|
def initialize(proxy=nil, dns=nil, headers={})
|
82
|
+
require 'rubygems/core_ext/tcpsocket_init' if Gem.configuration.ipv4_fallback_enabled
|
81
83
|
require 'net/http'
|
82
84
|
require 'stringio'
|
83
85
|
require 'uri'
|
@@ -261,15 +263,9 @@ class Gem::RemoteFetcher
|
|
261
263
|
end
|
262
264
|
|
263
265
|
data
|
264
|
-
rescue Timeout::Error
|
265
|
-
raise UnknownHostError.new('timed out', uri)
|
266
|
-
rescue IOError, SocketError, SystemCallError,
|
266
|
+
rescue Timeout::Error, IOError, SocketError, SystemCallError,
|
267
267
|
*(OpenSSL::SSL::SSLError if Gem::HAVE_OPENSSL) => e
|
268
|
-
|
269
|
-
raise UnknownHostError.new('no such name', uri)
|
270
|
-
else
|
271
|
-
raise FetchError.new("#{e.class}: #{e}", uri)
|
272
|
-
end
|
268
|
+
raise FetchError.new("#{e.class}: #{e}", uri)
|
273
269
|
end
|
274
270
|
|
275
271
|
def fetch_s3(uri, mtime = nil, head = false)
|
@@ -666,6 +666,9 @@ class Gem::Specification < Gem::BasicSpecification
|
|
666
666
|
#
|
667
667
|
# # Only prereleases or final releases after 2.6.0.preview2
|
668
668
|
# spec.required_ruby_version = '> 2.6.0.preview2'
|
669
|
+
#
|
670
|
+
# # This gem will work with 2.3.0 or greater, including major version 3, but lesser than 4.0.0
|
671
|
+
# spec.required_ruby_version = '>= 2.3', '< 4'
|
669
672
|
|
670
673
|
def required_ruby_version=(req)
|
671
674
|
@required_ruby_version = Gem::Requirement.create req
|
data/rubygems-update.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "rubygems-update"
|
5
|
-
s.version = "3.2.
|
5
|
+
s.version = "3.2.14"
|
6
6
|
s.authors = ["Jim Weirich", "Chad Fowler", "Eric Hodel", "Luis Lavena", "Aaron Patterson", "Samuel Giddins", "André Arko", "Evan Phoenix", "Hiroshi SHIBATA"]
|
7
7
|
s.email = ["", "", "drbrain@segment7.net", "luislavena@gmail.com", "aaron@tenderlovemaking.com", "segiddins@segiddins.me", "andre@arko.net", "evan@phx.io", "hsbt@ruby-lang.org"]
|
8
8
|
|
data/test/rubygems/test_gem.rb
CHANGED
@@ -1958,15 +1958,9 @@ class TestGem < Gem::TestCase
|
|
1958
1958
|
io.write 'gem "a"'
|
1959
1959
|
end
|
1960
1960
|
|
1961
|
-
platform = Bundler::GemHelpers.generic_local_platform
|
1962
|
-
if platform == Gem::Platform::RUBY
|
1963
|
-
platform = ''
|
1964
|
-
else
|
1965
|
-
platform = " #{platform}"
|
1966
|
-
end
|
1967
|
-
|
1968
1961
|
expected = <<-EXPECTED
|
1969
|
-
Could not find gem 'a
|
1962
|
+
Could not find gem 'a' in locally installed gems.
|
1963
|
+
The source does not contain any versions of 'a'
|
1970
1964
|
You may need to `gem install -g` to install missing gems
|
1971
1965
|
|
1972
1966
|
EXPECTED
|