rubygems-update 3.2.30 → 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +163 -4
- data/CONTRIBUTING.md +40 -10
- data/Manifest.txt +28 -5
- data/POLICIES.md +22 -8
- data/README.md +9 -7
- data/UPGRADING.md +5 -81
- data/bin/gem +1 -6
- data/bundler/CHANGELOG.md +86 -0
- data/bundler/exe/bundle +7 -8
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/doctor.rb +3 -2
- data/bundler/lib/bundler/cli/gem.rb +70 -8
- data/bundler/lib/bundler/cli/info.rb +6 -1
- data/bundler/lib/bundler/cli/install.rb +2 -0
- data/bundler/lib/bundler/cli/update.rb +2 -2
- data/bundler/lib/bundler/cli.rb +9 -1
- data/bundler/lib/bundler/compact_index_client/updater.rb +0 -5
- data/bundler/lib/bundler/definition.rb +66 -120
- data/bundler/lib/bundler/dependency.rb +5 -7
- data/bundler/lib/bundler/dsl.rb +18 -30
- data/bundler/lib/bundler/endpoint_specification.rb +0 -8
- data/bundler/lib/bundler/environment_preserver.rb +4 -1
- data/bundler/lib/bundler/fetcher/compact_index.rb +9 -4
- data/bundler/lib/bundler/fetcher.rb +2 -5
- data/bundler/lib/bundler/gem_helper.rb +2 -2
- data/bundler/lib/bundler/injector.rb +10 -1
- data/bundler/lib/bundler/installer/gem_installer.rb +1 -6
- data/bundler/lib/bundler/installer.rb +1 -4
- data/bundler/lib/bundler/lazy_specification.rb +17 -1
- data/bundler/lib/bundler/lockfile_parser.rb +10 -12
- data/bundler/lib/bundler/man/bundle-add.1 +10 -2
- data/bundler/lib/bundler/man/bundle-add.1.ronn +7 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/bundler/lib/bundler/man/bundle-cache.1 +1 -1
- data/bundler/lib/bundler/man/bundle-check.1 +1 -1
- data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +5 -5
- data/bundler/lib/bundler/man/bundle-config.1.ronn +5 -5
- data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
- data/bundler/lib/bundler/man/bundle-exec.1 +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +14 -1
- data/bundler/lib/bundler/man/bundle-gem.1.ronn +16 -0
- data/bundler/lib/bundler/man/bundle-info.1 +1 -1
- data/bundler/lib/bundler/man/bundle-init.1 +1 -1
- data/bundler/lib/bundler/man/bundle-inject.1 +1 -1
- data/bundler/lib/bundler/man/bundle-install.1 +2 -2
- data/bundler/lib/bundler/man/bundle-install.1.ronn +2 -2
- data/bundler/lib/bundler/man/bundle-list.1 +1 -1
- data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
- data/bundler/lib/bundler/man/bundle-open.1 +1 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/lib/bundler/man/bundle-platform.1 +1 -1
- data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
- data/bundler/lib/bundler/man/bundle-show.1 +1 -1
- data/bundler/lib/bundler/man/bundle-update.1 +2 -2
- data/bundler/lib/bundler/man/bundle-update.1.ronn +2 -1
- data/bundler/lib/bundler/man/bundle-viz.1 +1 -1
- data/bundler/lib/bundler/man/bundle.1 +1 -1
- data/bundler/lib/bundler/man/gemfile.5 +28 -2
- data/bundler/lib/bundler/man/gemfile.5.ronn +9 -1
- data/bundler/lib/bundler/plugin/api/source.rb +1 -0
- data/bundler/lib/bundler/plugin/installer.rb +1 -1
- data/bundler/lib/bundler/process_lock.rb +1 -1
- data/bundler/lib/bundler/psyched_yaml.rb +1 -13
- data/bundler/lib/bundler/resolver.rb +34 -31
- data/bundler/lib/bundler/rubygems_ext.rb +2 -0
- data/bundler/lib/bundler/rubygems_integration.rb +11 -48
- data/bundler/lib/bundler/runtime.rb +1 -1
- data/bundler/lib/bundler/self_manager.rb +73 -0
- data/bundler/lib/bundler/shared_helpers.rb +4 -12
- data/bundler/lib/bundler/source/git/git_proxy.rb +7 -4
- data/bundler/lib/bundler/source/metadata.rb +1 -1
- data/bundler/lib/bundler/source/rubygems.rb +17 -13
- data/bundler/lib/bundler/source/rubygems_aggregate.rb +1 -1
- data/bundler/lib/bundler/source.rb +1 -1
- data/bundler/lib/bundler/source_list.rb +7 -29
- data/bundler/lib/bundler/spec_set.rb +1 -1
- data/bundler/lib/bundler/templates/Executable.bundler +1 -1
- data/bundler/lib/bundler/templates/Gemfile +0 -2
- data/bundler/lib/bundler/templates/gems.rb +0 -3
- data/bundler/lib/bundler/templates/newgem/Gemfile.tt +5 -2
- data/bundler/lib/bundler/templates/newgem/Rakefile.tt +15 -2
- data/bundler/lib/bundler/templates/newgem/github/workflows/main.yml.tt +2 -2
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +13 -13
- data/bundler/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/bundler/lib/bundler/templates/newgem/standard.yml.tt +2 -0
- data/bundler/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
- data/bundler/lib/bundler/ui/shell.rb +1 -1
- data/bundler/lib/bundler/vendor/.document +1 -0
- data/bundler/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +2 -2
- data/bundler/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/bundler/lib/bundler/vendor/tsort/lib/tsort.rb +453 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/common.rb +17 -80
- data/bundler/lib/bundler/vendor/uri/lib/uri/ftp.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/generic.rb +5 -6
- data/bundler/lib/bundler/vendor/uri/lib/uri/http.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/https.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ldap.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/mailto.rb +0 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +1 -14
- data/bundler/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +1 -12
- data/bundler/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/bundler/lib/bundler/vendor/uri/lib/uri/ws.rb +84 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri/wss.rb +22 -0
- data/bundler/lib/bundler/vendor/uri/lib/uri.rb +0 -1
- data/bundler/lib/bundler/vendored_tsort.rb +4 -0
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler.rb +9 -3
- data/hide_lib_for_update/note.txt +0 -4
- data/lib/rubygems/command.rb +4 -4
- data/lib/rubygems/command_manager.rb +4 -2
- data/lib/rubygems/commands/cert_command.rb +6 -6
- data/lib/rubygems/commands/fetch_command.rb +1 -1
- data/lib/rubygems/commands/install_command.rb +5 -2
- data/lib/rubygems/commands/pristine_command.rb +8 -2
- data/lib/rubygems/commands/server_command.rb +14 -77
- data/lib/rubygems/commands/setup_command.rb +84 -76
- data/lib/rubygems/commands/uninstall_command.rb +1 -1
- data/lib/rubygems/commands/update_command.rb +10 -5
- data/lib/rubygems/defaults.rb +2 -20
- data/lib/rubygems/dependency_list.rb +2 -2
- data/lib/rubygems/deprecate.rb +53 -6
- data/lib/rubygems/exceptions.rb +27 -1
- data/lib/rubygems/ext/builder.rb +11 -8
- data/lib/rubygems/ext/cmake_builder.rb +1 -1
- data/lib/rubygems/install_update_options.rb +13 -4
- data/lib/rubygems/installer.rb +46 -27
- data/lib/rubygems/local_remote_options.rb +3 -3
- data/lib/rubygems/name_tuple.rb +2 -3
- data/lib/rubygems/optparse/.document +1 -0
- data/lib/rubygems/optparse/COPYING +56 -0
- data/lib/rubygems/optparse/lib/optionparser.rb +2 -0
- data/lib/rubygems/optparse/lib/optparse/ac.rb +54 -0
- data/lib/rubygems/optparse/lib/optparse/date.rb +18 -0
- data/lib/rubygems/optparse/lib/optparse/kwargs.rb +22 -0
- data/lib/rubygems/optparse/lib/optparse/shellwords.rb +7 -0
- data/lib/rubygems/optparse/lib/optparse/time.rb +11 -0
- data/lib/rubygems/optparse/lib/optparse/uri.rb +7 -0
- data/lib/rubygems/optparse/lib/optparse/version.rb +71 -0
- data/lib/rubygems/optparse/lib/optparse.rb +2230 -0
- data/lib/rubygems/optparse.rb +3 -0
- data/lib/rubygems/path_support.rb +1 -6
- data/lib/rubygems/platform.rb +4 -0
- data/lib/rubygems/remote_fetcher.rb +1 -1
- data/lib/rubygems/request_set.rb +2 -2
- data/lib/rubygems/requirement.rb +1 -1
- data/lib/rubygems/resolver/installer_set.rb +1 -1
- data/lib/rubygems/resolver/molinillo/lib/molinillo/dependency_graph.rb +2 -2
- data/lib/rubygems/security.rb +4 -3
- data/lib/rubygems/security_option.rb +3 -3
- data/lib/rubygems/source.rb +3 -1
- data/lib/rubygems/spec_fetcher.rb +1 -1
- data/lib/rubygems/specification.rb +46 -46
- data/lib/rubygems/text.rb +21 -20
- data/lib/rubygems/tsort/.document +1 -0
- data/lib/rubygems/tsort/LICENSE.txt +22 -0
- data/lib/rubygems/tsort/lib/tsort.rb +454 -0
- data/lib/rubygems/tsort.rb +3 -0
- data/lib/rubygems/uninstaller.rb +4 -1
- data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
- data/lib/rubygems/util/licenses.rb +2 -0
- data/lib/rubygems/version.rb +2 -0
- data/lib/rubygems/version_option.rb +2 -2
- data/lib/rubygems.rb +13 -10
- data/rubygems-update.gemspec +1 -1
- data/setup.rb +1 -6
- data/test/rubygems/encrypted_private_key.pem +26 -26
- data/test/rubygems/helper.rb +48 -38
- data/test/rubygems/test_config.rb +2 -2
- data/test/rubygems/test_exit.rb +11 -0
- data/test/rubygems/test_gem.rb +46 -41
- data/test/rubygems/test_gem_command.rb +1 -1
- data/test/rubygems/test_gem_command_manager.rb +28 -2
- data/test/rubygems/test_gem_commands_cert_command.rb +8 -8
- data/test/rubygems/test_gem_commands_fetch_command.rb +36 -0
- data/test/rubygems/test_gem_commands_open_command.rb +1 -1
- data/test/rubygems/test_gem_commands_server_command.rb +4 -46
- data/test/rubygems/test_gem_commands_setup_command.rb +67 -19
- data/test/rubygems/test_gem_commands_signin_command.rb +1 -1
- data/test/rubygems/test_gem_commands_uninstall_command.rb +1 -1
- data/test/rubygems/test_gem_commands_update_command.rb +2 -2
- data/test/rubygems/test_gem_commands_yank_command.rb +1 -1
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +7 -3
- data/test/rubygems/test_gem_install_update_options.rb +2 -2
- data/test/rubygems/test_gem_installer.rb +37 -5
- data/test/rubygems/test_gem_path_support.rb +2 -6
- data/test/rubygems/test_gem_remote_fetcher.rb +15 -0
- data/test/rubygems/test_gem_request.rb +10 -4
- data/test/rubygems/test_gem_requirement.rb +0 -1
- data/test/rubygems/test_gem_resolver.rb +7 -7
- data/test/rubygems/test_gem_security.rb +1 -1
- data/test/rubygems/test_gem_specification.rb +27 -25
- data/test/rubygems/test_gem_text.rb +6 -0
- data/test/rubygems/test_project_sanity.rb +1 -1
- data/test/rubygems/test_require.rb +8 -35
- data/test/rubygems/test_rubygems.rb +23 -0
- metadata +31 -8
- data/bundler/lib/bundler/gemdeps.rb +0 -29
- data/lib/rubygems/server.rb +0 -882
- data/test/rubygems/bogussources.rb +0 -9
- data/test/rubygems/test_gem_server.rb +0 -608
@@ -72,12 +72,7 @@ class Gem::PathSupport
|
|
72
72
|
|
73
73
|
# Return the default Gem path
|
74
74
|
def default_path
|
75
|
-
|
76
|
-
|
77
|
-
if defined?(APPLE_GEM_HOME)
|
78
|
-
gem_path << APPLE_GEM_HOME
|
79
|
-
end
|
80
|
-
gem_path
|
75
|
+
Gem.default_path + [@home]
|
81
76
|
end
|
82
77
|
|
83
78
|
def expand(path)
|
data/lib/rubygems/platform.rb
CHANGED
@@ -40,6 +40,10 @@ class Gem::Platform
|
|
40
40
|
match_platforms?(platform, Gem.platforms)
|
41
41
|
end
|
42
42
|
|
43
|
+
def self.sort_priority(platform)
|
44
|
+
platform == Gem::Platform::RUBY ? -1 : 1
|
45
|
+
end
|
46
|
+
|
43
47
|
def self.installable?(spec)
|
44
48
|
if spec.respond_to? :installable_platform?
|
45
49
|
spec.installable_platform?
|
data/lib/rubygems/request_set.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
require_relative 'tsort'
|
3
3
|
|
4
4
|
##
|
5
5
|
# A RequestSet groups a request to activate a set of dependencies.
|
@@ -15,7 +15,7 @@ require 'tsort'
|
|
15
15
|
# #=> ["nokogiri-1.6.0", "mini_portile-0.5.1", "pg-0.17.0"]
|
16
16
|
|
17
17
|
class Gem::RequestSet
|
18
|
-
include TSort
|
18
|
+
include Gem::TSort
|
19
19
|
|
20
20
|
##
|
21
21
|
# Array of gems to install even if already installed
|
data/lib/rubygems/requirement.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
require_relative '../../../../tsort'
|
4
4
|
|
5
5
|
require_relative 'dependency_graph/log'
|
6
6
|
require_relative 'dependency_graph/vertex'
|
@@ -17,7 +17,7 @@ module Gem::Resolver::Molinillo
|
|
17
17
|
vertices.values.each { |v| yield v }
|
18
18
|
end
|
19
19
|
|
20
|
-
include TSort
|
20
|
+
include Gem::TSort
|
21
21
|
|
22
22
|
# @!visibility private
|
23
23
|
alias tsort_each_node each
|
data/lib/rubygems/security.rb
CHANGED
@@ -510,9 +510,10 @@ module Gem::Security
|
|
510
510
|
|
511
511
|
dcs = dcs.split '.'
|
512
512
|
|
513
|
-
|
514
|
-
|
515
|
-
|
513
|
+
OpenSSL::X509::Name.new([
|
514
|
+
["CN", cn],
|
515
|
+
*dcs.map {|dc| ["DC", dc] },
|
516
|
+
])
|
516
517
|
end
|
517
518
|
|
518
519
|
##
|
@@ -19,16 +19,16 @@ end
|
|
19
19
|
|
20
20
|
module Gem::SecurityOption
|
21
21
|
def add_security_option
|
22
|
-
OptionParser.accept Gem::Security::Policy do |value|
|
22
|
+
Gem::OptionParser.accept Gem::Security::Policy do |value|
|
23
23
|
require_relative 'security'
|
24
24
|
|
25
|
-
raise OptionParser::InvalidArgument, 'OpenSSL not installed' unless
|
25
|
+
raise Gem::OptionParser::InvalidArgument, 'OpenSSL not installed' unless
|
26
26
|
defined?(Gem::Security::HighSecurity)
|
27
27
|
|
28
28
|
policy = Gem::Security::Policies[value]
|
29
29
|
unless policy
|
30
30
|
valid = Gem::Security::Policies.keys.sort
|
31
|
-
raise OptionParser::InvalidArgument, "#{value} (#{valid.join ', '} are valid)"
|
31
|
+
raise Gem::OptionParser::InvalidArgument, "#{value} (#{valid.join ', '} are valid)"
|
32
32
|
end
|
33
33
|
policy
|
34
34
|
end
|
data/lib/rubygems/source.rb
CHANGED
@@ -35,6 +35,7 @@ class Gem::Source
|
|
35
35
|
end
|
36
36
|
|
37
37
|
@uri = uri
|
38
|
+
@update_cache = nil
|
38
39
|
end
|
39
40
|
|
40
41
|
##
|
@@ -118,7 +119,8 @@ class Gem::Source
|
|
118
119
|
# Returns true when it is possible and safe to update the cache directory.
|
119
120
|
|
120
121
|
def update_cache?
|
121
|
-
@update_cache
|
122
|
+
return @update_cache unless @update_cache.nil?
|
123
|
+
@update_cache =
|
122
124
|
begin
|
123
125
|
File.stat(Gem.user_home).uid == Process.uid
|
124
126
|
rescue Errno::ENOENT
|
@@ -9,6 +9,8 @@
|
|
9
9
|
require_relative 'deprecate'
|
10
10
|
require_relative 'basic_specification'
|
11
11
|
require_relative 'stub_specification'
|
12
|
+
require_relative 'platform'
|
13
|
+
require_relative 'requirement'
|
12
14
|
require_relative 'specification_policy'
|
13
15
|
require_relative 'util/list'
|
14
16
|
|
@@ -102,12 +104,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
102
104
|
today = Time.now.utc
|
103
105
|
TODAY = Time.utc(today.year, today.month, today.day) # :nodoc:
|
104
106
|
|
105
|
-
#
|
106
|
-
|
107
|
-
# rubocop:enable Style/MutableConstant
|
108
|
-
LOAD_CACHE_MUTEX = Thread::Mutex.new
|
109
|
-
|
110
|
-
private_constant :LOAD_CACHE if defined? private_constant
|
107
|
+
@load_cache = {} # :nodoc:
|
108
|
+
@load_cache_mutex = Thread::Mutex.new
|
111
109
|
|
112
110
|
VALID_NAME_PATTERN = /\A[a-zA-Z0-9\.\-\_]+\z/.freeze # :nodoc:
|
113
111
|
|
@@ -182,13 +180,19 @@ class Gem::Specification < Gem::BasicSpecification
|
|
182
180
|
@@default_value[k].nil?
|
183
181
|
end
|
184
182
|
|
185
|
-
|
186
|
-
|
183
|
+
def self.clear_specs # :nodoc:
|
184
|
+
@@all = nil
|
185
|
+
@@stubs = nil
|
186
|
+
@@stubs_by_name = {}
|
187
|
+
@@spec_with_requirable_file = {}
|
188
|
+
@@active_stub_with_requirable_file = {}
|
189
|
+
end
|
190
|
+
private_class_method :clear_specs
|
191
|
+
|
192
|
+
clear_specs
|
187
193
|
|
188
194
|
# Sentinel object to represent "not found" stubs
|
189
195
|
NOT_FOUND = Struct.new(:to_spec, :this).new # :nodoc:
|
190
|
-
@@spec_with_requirable_file = {}
|
191
|
-
@@active_stub_with_requirable_file = {}
|
192
196
|
|
193
197
|
# Tracking removed method calls to warn users during build time.
|
194
198
|
REMOVED_METHODS = [:rubyforge_project=].freeze # :nodoc:
|
@@ -281,6 +285,15 @@ class Gem::Specification < Gem::BasicSpecification
|
|
281
285
|
######################################################################
|
282
286
|
# :section: Recommended gemspec attributes
|
283
287
|
|
288
|
+
##
|
289
|
+
# The version of Ruby required by this gem
|
290
|
+
#
|
291
|
+
# Usage:
|
292
|
+
#
|
293
|
+
# spec.required_ruby_version = '>= 2.7.0'
|
294
|
+
|
295
|
+
attr_reader :required_ruby_version
|
296
|
+
|
284
297
|
##
|
285
298
|
# A long description of this gem
|
286
299
|
#
|
@@ -324,17 +337,21 @@ class Gem::Specification < Gem::BasicSpecification
|
|
324
337
|
# This should just be the name of your license. The full text of the license
|
325
338
|
# should be inside of the gem (at the top level) when you build it.
|
326
339
|
#
|
327
|
-
# The simplest way
|
340
|
+
# The simplest way is to specify the standard SPDX ID
|
328
341
|
# https://spdx.org/licenses/ for the license.
|
329
|
-
# Ideally you should pick one that is OSI (Open Source Initiative)
|
342
|
+
# Ideally, you should pick one that is OSI (Open Source Initiative)
|
330
343
|
# http://opensource.org/licenses/alphabetical approved.
|
331
344
|
#
|
332
|
-
# The most commonly used OSI
|
345
|
+
# The most commonly used OSI-approved licenses are MIT and Apache-2.0.
|
333
346
|
# GitHub also provides a license picker at http://choosealicense.com/.
|
334
347
|
#
|
348
|
+
# You can also use a custom license file along with your gemspec and specify
|
349
|
+
# a LicenseRef-<idstring>, where idstring is the name of the file containing
|
350
|
+
# the license text.
|
351
|
+
#
|
335
352
|
# You should specify a license for your gem so that people know how they are
|
336
|
-
# permitted to use it
|
337
|
-
# specifying a license means all rights are reserved; others have no
|
353
|
+
# permitted to use it and any restrictions you're placing on it. Not
|
354
|
+
# specifying a license means all rights are reserved; others have no right
|
338
355
|
# to use the code for any purpose.
|
339
356
|
#
|
340
357
|
# You can set multiple licenses with #licenses=
|
@@ -512,11 +529,6 @@ class Gem::Specification < Gem::BasicSpecification
|
|
512
529
|
@require_paths = Array(val)
|
513
530
|
end
|
514
531
|
|
515
|
-
##
|
516
|
-
# The version of Ruby required by this gem
|
517
|
-
|
518
|
-
attr_reader :required_ruby_version
|
519
|
-
|
520
532
|
##
|
521
533
|
# The RubyGems version required by this gem
|
522
534
|
|
@@ -744,23 +756,15 @@ class Gem::Specification < Gem::BasicSpecification
|
|
744
756
|
attr_accessor :specification_version
|
745
757
|
|
746
758
|
def self._all # :nodoc:
|
747
|
-
|
748
|
-
@@all = stubs.map(&:to_spec)
|
749
|
-
|
750
|
-
# After a reset, make sure already loaded specs
|
751
|
-
# are still marked as activated.
|
752
|
-
specs = {}
|
753
|
-
Gem.loaded_specs.each_value{|s| specs[s] = true }
|
754
|
-
@@all.each{|s| s.activated = true if specs[s] }
|
755
|
-
end
|
756
|
-
@@all
|
759
|
+
@@all ||= Gem.loaded_specs.values | stubs.map(&:to_spec)
|
757
760
|
end
|
758
761
|
|
759
|
-
def self.
|
760
|
-
|
761
|
-
|
762
|
+
def self.clear_load_cache # :nodoc:
|
763
|
+
@load_cache_mutex.synchronize do
|
764
|
+
@load_cache.clear
|
762
765
|
end
|
763
766
|
end
|
767
|
+
private_class_method :clear_load_cache
|
764
768
|
|
765
769
|
def self.each_gemspec(dirs) # :nodoc:
|
766
770
|
dirs.each do |dir|
|
@@ -855,7 +859,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
855
859
|
next names if names.nonzero?
|
856
860
|
versions = b.version <=> a.version
|
857
861
|
next versions if versions.nonzero?
|
858
|
-
b.platform
|
862
|
+
Gem::Platform.sort_priority(b.platform)
|
859
863
|
end
|
860
864
|
end
|
861
865
|
|
@@ -1080,7 +1084,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1080
1084
|
# +prerelease+ is true.
|
1081
1085
|
|
1082
1086
|
def self.latest_specs(prerelease = false)
|
1083
|
-
_latest_specs Gem::Specification.
|
1087
|
+
_latest_specs Gem::Specification.stubs, prerelease
|
1084
1088
|
end
|
1085
1089
|
|
1086
1090
|
##
|
@@ -1108,7 +1112,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1108
1112
|
def self.load(file)
|
1109
1113
|
return unless file
|
1110
1114
|
|
1111
|
-
_spec =
|
1115
|
+
_spec = @load_cache_mutex.synchronize { @load_cache[file] }
|
1112
1116
|
return _spec if _spec
|
1113
1117
|
|
1114
1118
|
file = file.dup.tap(&Gem::UNTAINT)
|
@@ -1123,12 +1127,12 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1123
1127
|
|
1124
1128
|
if Gem::Specification === _spec
|
1125
1129
|
_spec.loaded_from = File.expand_path file.to_s
|
1126
|
-
|
1127
|
-
prev =
|
1130
|
+
@load_cache_mutex.synchronize do
|
1131
|
+
prev = @load_cache[file]
|
1128
1132
|
if prev
|
1129
1133
|
_spec = prev
|
1130
1134
|
else
|
1131
|
-
|
1135
|
+
@load_cache[file] = _spec
|
1132
1136
|
end
|
1133
1137
|
end
|
1134
1138
|
return _spec
|
@@ -1226,12 +1230,8 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1226
1230
|
def self.reset
|
1227
1231
|
@@dirs = nil
|
1228
1232
|
Gem.pre_reset_hooks.each {|hook| hook.call }
|
1229
|
-
|
1230
|
-
|
1231
|
-
@@stubs_by_name = {}
|
1232
|
-
@@spec_with_requirable_file = {}
|
1233
|
-
@@active_stub_with_requirable_file = {}
|
1234
|
-
_clear_load_cache
|
1233
|
+
clear_specs
|
1234
|
+
clear_load_cache
|
1235
1235
|
unresolved = unresolved_deps
|
1236
1236
|
unless unresolved.empty?
|
1237
1237
|
w = "W" + "ARN"
|
@@ -2333,7 +2333,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2333
2333
|
# Returns an object you can use to sort specifications in #sort_by.
|
2334
2334
|
|
2335
2335
|
def sort_obj
|
2336
|
-
[@name, @version,
|
2336
|
+
[@name, @version, Gem::Platform.sort_priority(@new_platform)]
|
2337
2337
|
end
|
2338
2338
|
|
2339
2339
|
##
|
data/lib/rubygems/text.rb
CHANGED
@@ -49,37 +49,38 @@ module Gem::Text
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
-
# This code is based directly on the Text gem implementation
|
53
52
|
# Returns a value representing the "cost" of transforming str1 into str2
|
53
|
+
# Vendored version of DidYouMean::Levenshtein.distance from the ruby/did_you_mean gem @ 1.4.0
|
54
|
+
# https://git.io/JJgZI
|
54
55
|
def levenshtein_distance(str1, str2)
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
return m if (0 == n)
|
61
|
-
return n if (0 == m)
|
56
|
+
n = str1.length
|
57
|
+
m = str2.length
|
58
|
+
return m if n.zero?
|
59
|
+
return n if m.zero?
|
62
60
|
|
63
61
|
d = (0..m).to_a
|
64
62
|
x = nil
|
65
63
|
|
66
|
-
|
67
|
-
|
64
|
+
# to avoid duplicating an enumerable object, create it outside of the loop
|
65
|
+
str2_codepoints = str2.codepoints
|
68
66
|
|
69
|
-
|
70
|
-
|
67
|
+
str1.each_codepoint.with_index(1) do |char1, i|
|
68
|
+
j = 0
|
69
|
+
while j < m
|
70
|
+
cost = (char1 == str2_codepoints[j]) ? 0 : 1
|
71
71
|
x = min3(
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
d[j] =
|
77
|
-
|
72
|
+
d[j + 1] + 1, # insertion
|
73
|
+
i + 1, # deletion
|
74
|
+
d[j] + cost # substitution
|
75
|
+
)
|
76
|
+
d[j] = i
|
77
|
+
i = x
|
78
|
+
|
79
|
+
j += 1
|
78
80
|
end
|
79
|
-
|
80
81
|
d[m] = x
|
81
82
|
end
|
82
83
|
|
83
|
-
|
84
|
+
x
|
84
85
|
end
|
85
86
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (C) 1993-2013 Yukihiro Matsumoto. All rights reserved.
|
2
|
+
|
3
|
+
Redistribution and use in source and binary forms, with or without
|
4
|
+
modification, are permitted provided that the following conditions
|
5
|
+
are met:
|
6
|
+
1. Redistributions of source code must retain the above copyright
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
|
+
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
13
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
14
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
15
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
16
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
17
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
18
|
+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
19
|
+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
20
|
+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
21
|
+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
22
|
+
SUCH DAMAGE.
|