rubygems-update 3.2.33 → 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 +45 -4
- data/CONTRIBUTING.md +40 -10
- data/Manifest.txt +6 -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 +27 -0
- data/bundler/exe/bundle +7 -8
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/gem.rb +1 -1
- data/bundler/lib/bundler/cli/install.rb +2 -0
- data/bundler/lib/bundler/cli.rb +5 -0
- data/bundler/lib/bundler/definition.rb +14 -2
- data/bundler/lib/bundler/dependency.rb +5 -7
- data/bundler/lib/bundler/dsl.rb +0 -27
- data/bundler/lib/bundler/endpoint_specification.rb +0 -8
- data/bundler/lib/bundler/fetcher/compact_index.rb +9 -4
- data/bundler/lib/bundler/fetcher.rb +2 -5
- 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/lockfile_parser.rb +10 -13
- data/bundler/lib/bundler/man/bundle-add.1 +9 -1
- data/bundler/lib/bundler/man/bundle-add.1.ronn +7 -1
- data/bundler/lib/bundler/man/bundle-config.1 +2 -2
- data/bundler/lib/bundler/man/bundle-config.1.ronn +3 -3
- data/bundler/lib/bundler/man/bundle-install.1 +1 -1
- data/bundler/lib/bundler/man/bundle-install.1.ronn +2 -2
- data/bundler/lib/bundler/man/bundle-update.1 +1 -1
- data/bundler/lib/bundler/man/bundle-update.1.ronn +2 -1
- data/bundler/lib/bundler/man/gemfile.5 +1 -1
- data/bundler/lib/bundler/man/gemfile.5.ronn +1 -1
- 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 -29
- data/bundler/lib/bundler/rubygems_ext.rb +2 -0
- data/bundler/lib/bundler/rubygems_integration.rb +11 -48
- data/bundler/lib/bundler/self_manager.rb +73 -0
- data/bundler/lib/bundler/shared_helpers.rb +2 -9
- data/bundler/lib/bundler/source/metadata.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/Rakefile.tt +10 -1
- data/bundler/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- 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/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/version.rb +1 -1
- data/bundler/lib/bundler.rb +9 -3
- data/hide_lib_for_update/note.txt +0 -4
- data/lib/rubygems/command_manager.rb +1 -1
- data/lib/rubygems/commands/install_command.rb +5 -2
- data/lib/rubygems/commands/server_command.rb +14 -77
- data/lib/rubygems/commands/setup_command.rb +4 -16
- data/lib/rubygems/commands/update_command.rb +9 -4
- data/lib/rubygems/defaults.rb +2 -20
- data/lib/rubygems/deprecate.rb +53 -6
- data/lib/rubygems/exceptions.rb +26 -1
- data/lib/rubygems/ext/builder.rb +5 -3
- data/lib/rubygems/install_update_options.rb +11 -2
- data/lib/rubygems/installer.rb +11 -1
- data/lib/rubygems/name_tuple.rb +2 -3
- 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/requirement.rb +1 -1
- data/lib/rubygems/resolver/installer_set.rb +1 -1
- data/lib/rubygems/security.rb +4 -3
- data/lib/rubygems/source.rb +3 -1
- data/lib/rubygems/spec_fetcher.rb +1 -1
- data/lib/rubygems/specification.rb +11 -13
- data/lib/rubygems/text.rb +21 -20
- data/lib/rubygems/uninstaller.rb +4 -1
- data/lib/rubygems/unknown_command_spell_checker.rb +21 -0
- data/lib/rubygems/version.rb +2 -0
- data/lib/rubygems.rb +26 -23
- data/rubygems-update.gemspec +1 -1
- data/setup.rb +1 -6
- data/test/rubygems/helper.rb +20 -6
- 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_manager.rb +16 -2
- 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_update_command.rb +2 -2
- 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_requirement.rb +0 -1
- data/test/rubygems/test_gem_security.rb +1 -1
- data/test/rubygems/test_gem_specification.rb +16 -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 +0 -7
- data/test/rubygems/test_rubygems.rb +23 -0
- metadata +9 -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
@@ -27,6 +27,8 @@ class Gem::Commands::InstallCommand < Gem::Command
|
|
27
27
|
:without_groups => [],
|
28
28
|
})
|
29
29
|
|
30
|
+
defaults.merge!(install_update_options)
|
31
|
+
|
30
32
|
super 'install', 'Install a gem into the local repository', defaults
|
31
33
|
|
32
34
|
add_install_update_options
|
@@ -43,8 +45,9 @@ class Gem::Commands::InstallCommand < Gem::Command
|
|
43
45
|
end
|
44
46
|
|
45
47
|
def defaults_str # :nodoc:
|
46
|
-
"--both --version '#{Gem::Requirement.default}' --
|
47
|
-
"--install-dir #{Gem.dir} --lock"
|
48
|
+
"--both --version '#{Gem::Requirement.default}' --no-force\n" +
|
49
|
+
"--install-dir #{Gem.dir} --lock\n" +
|
50
|
+
install_update_defaults_str
|
48
51
|
end
|
49
52
|
|
50
53
|
def description # :nodoc:
|
@@ -1,88 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
require_relative '../command'
|
3
|
-
require_relative '../server'
|
4
|
-
require_relative '../deprecate'
|
5
3
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
Gem::OptionParser.accept :Port do |port|
|
15
|
-
if port =~ /\A\d+\z/
|
16
|
-
port = Integer port
|
17
|
-
raise Gem::OptionParser::InvalidArgument, "#{port}: not a port number" if
|
18
|
-
port > 65535
|
19
|
-
|
20
|
-
port
|
21
|
-
else
|
22
|
-
begin
|
23
|
-
Socket.getservbyname port
|
24
|
-
rescue SocketError
|
25
|
-
raise Gem::OptionParser::InvalidArgument, "#{port}: no such named service"
|
26
|
-
end
|
4
|
+
unless defined? Gem::Commands::ServerCommand
|
5
|
+
class Gem::Commands::ServerCommand < Gem::Command
|
6
|
+
def initialize
|
7
|
+
super('server', 'Starts up a web server that hosts the RDoc (requires rubygems-server)')
|
8
|
+
begin
|
9
|
+
Gem::Specification.find_by_name('rubygems-server').activate
|
10
|
+
rescue Gem::LoadError
|
11
|
+
# no-op
|
27
12
|
end
|
28
13
|
end
|
29
14
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
add_option '-d', '--dir=GEMDIR',
|
36
|
-
'directories from which to serve gems',
|
37
|
-
'multiple directories may be provided' do |gemdir, options|
|
38
|
-
options[:gemdir] << File.expand_path(gemdir)
|
15
|
+
def description # :nodoc:
|
16
|
+
<<-EOF
|
17
|
+
The server command has been moved to the rubygems-server gem.
|
18
|
+
EOF
|
39
19
|
end
|
40
20
|
|
41
|
-
|
42
|
-
|
21
|
+
def execute
|
22
|
+
alert_error "Install the rubygems-server gem for the server command"
|
43
23
|
end
|
44
|
-
|
45
|
-
add_option '-b', '--bind=HOST,HOST',
|
46
|
-
'addresses to bind', Array do |address, options|
|
47
|
-
options[:addresses] ||= []
|
48
|
-
options[:addresses].push(*address)
|
49
|
-
end
|
50
|
-
|
51
|
-
add_option '-l', '--launch[=COMMAND]',
|
52
|
-
'launches a browser window',
|
53
|
-
"COMMAND defaults to 'start' on Windows",
|
54
|
-
"and 'open' on all other platforms" do |launch, options|
|
55
|
-
launch ||= Gem.win_platform? ? 'start' : 'open'
|
56
|
-
options[:launch] = launch
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def defaults_str # :nodoc:
|
61
|
-
"--port 8808 --dir #{Gem.dir} --no-daemon"
|
62
|
-
end
|
63
|
-
|
64
|
-
def description # :nodoc:
|
65
|
-
<<-EOF
|
66
|
-
The server command starts up a web server that hosts the RDoc for your
|
67
|
-
installed gems and can operate as a server for installation of gems on other
|
68
|
-
machines.
|
69
|
-
|
70
|
-
The cache files for installed gems must exist to use the server as a source
|
71
|
-
for gem installation.
|
72
|
-
|
73
|
-
To install gems from a running server, use `gem install GEMNAME --source
|
74
|
-
http://gem_server_host:8808`
|
75
|
-
|
76
|
-
You can set up a shortcut to gem server documentation using the URL:
|
77
|
-
|
78
|
-
http://localhost:8808/rdoc?q=%s - Firefox
|
79
|
-
http://localhost:8808/rdoc?q=* - LaunchBar
|
80
|
-
|
81
|
-
EOF
|
82
|
-
end
|
83
|
-
|
84
|
-
def execute
|
85
|
-
options[:gemdir] = Gem.path if options[:gemdir].empty?
|
86
|
-
Gem::Server.run options
|
87
24
|
end
|
88
25
|
end
|
@@ -12,8 +12,6 @@ class Gem::Commands::SetupCommand < Gem::Command
|
|
12
12
|
ENV_PATHS = %w[/usr/bin/env /bin/env].freeze
|
13
13
|
|
14
14
|
def initialize
|
15
|
-
require 'tmpdir'
|
16
|
-
|
17
15
|
super 'setup', 'Install RubyGems',
|
18
16
|
:format_executable => false, :document => %w[ri],
|
19
17
|
:force => true,
|
@@ -253,6 +251,8 @@ By default, this RubyGems will install gem as:
|
|
253
251
|
Dir.chdir path do
|
254
252
|
bin_file = "gem"
|
255
253
|
|
254
|
+
require 'tmpdir'
|
255
|
+
|
256
256
|
dest_file = target_bin_path(bin_dir, bin_file)
|
257
257
|
bin_tmp_file = File.join Dir.tmpdir, "#{bin_file}.#{$$}"
|
258
258
|
|
@@ -465,20 +465,8 @@ By default, this RubyGems will install gem as:
|
|
465
465
|
lib_dir = RbConfig::CONFIG[site_or_vendor]
|
466
466
|
bin_dir = RbConfig::CONFIG['bindir']
|
467
467
|
else
|
468
|
-
|
469
|
-
|
470
|
-
# sitelibdir/vendorlibdir.
|
471
|
-
if defined?(APPLE_GEM_HOME) and
|
472
|
-
# just in case Apple and RubyGems don't get this patched up proper.
|
473
|
-
(prefix == RbConfig::CONFIG['libdir'] or
|
474
|
-
# this one is important
|
475
|
-
prefix == File.join(RbConfig::CONFIG['libdir'], 'ruby'))
|
476
|
-
lib_dir = RbConfig::CONFIG[site_or_vendor]
|
477
|
-
bin_dir = RbConfig::CONFIG['bindir']
|
478
|
-
else
|
479
|
-
lib_dir = File.join prefix, 'lib'
|
480
|
-
bin_dir = File.join prefix, 'bin'
|
481
|
-
end
|
468
|
+
lib_dir = File.join prefix, 'lib'
|
469
|
+
bin_dir = File.join prefix, 'bin'
|
482
470
|
end
|
483
471
|
|
484
472
|
[prepend_destdir_if_present(lib_dir), prepend_destdir_if_present(bin_dir)]
|
@@ -19,9 +19,13 @@ class Gem::Commands::UpdateCommand < Gem::Command
|
|
19
19
|
attr_reader :updated # :nodoc:
|
20
20
|
|
21
21
|
def initialize
|
22
|
-
|
23
|
-
:
|
24
|
-
|
22
|
+
options = {
|
23
|
+
:force => false,
|
24
|
+
}
|
25
|
+
|
26
|
+
options.merge!(install_update_options)
|
27
|
+
|
28
|
+
super 'update', 'Update installed gems to the latest version', options
|
25
29
|
|
26
30
|
add_install_update_options
|
27
31
|
|
@@ -51,7 +55,8 @@ class Gem::Commands::UpdateCommand < Gem::Command
|
|
51
55
|
end
|
52
56
|
|
53
57
|
def defaults_str # :nodoc:
|
54
|
-
"--
|
58
|
+
"--no-force --install-dir #{Gem.dir}\n" +
|
59
|
+
install_update_defaults_str
|
55
60
|
end
|
56
61
|
|
57
62
|
def description # :nodoc:
|
data/lib/rubygems/defaults.rb
CHANGED
@@ -34,21 +34,7 @@ module Gem
|
|
34
34
|
# specified in the environment
|
35
35
|
|
36
36
|
def self.default_dir
|
37
|
-
|
38
|
-
[
|
39
|
-
File.dirname(RbConfig::CONFIG['sitedir']),
|
40
|
-
'Gems',
|
41
|
-
RbConfig::CONFIG['ruby_version'],
|
42
|
-
]
|
43
|
-
else
|
44
|
-
[
|
45
|
-
RbConfig::CONFIG['rubylibprefix'],
|
46
|
-
'gems',
|
47
|
-
RbConfig::CONFIG['ruby_version'],
|
48
|
-
]
|
49
|
-
end
|
50
|
-
|
51
|
-
@default_dir ||= File.join(*path)
|
37
|
+
@default_dir ||= File.join(RbConfig::CONFIG['rubylibprefix'], 'gems', RbConfig::CONFIG['ruby_version'])
|
52
38
|
end
|
53
39
|
|
54
40
|
##
|
@@ -197,11 +183,7 @@ module Gem
|
|
197
183
|
# The default directory for binaries
|
198
184
|
|
199
185
|
def self.default_bindir
|
200
|
-
|
201
|
-
'/usr/local/bin'
|
202
|
-
else # generic install
|
203
|
-
RbConfig::CONFIG['bindir']
|
204
|
-
end
|
186
|
+
RbConfig::CONFIG['bindir']
|
205
187
|
end
|
206
188
|
|
207
189
|
def self.ruby_engine
|
data/lib/rubygems/deprecate.rb
CHANGED
@@ -1,23 +1,70 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
##
|
3
|
-
# Provides
|
4
|
-
#
|
3
|
+
# Provides 3 methods for declaring when something is going away.
|
4
|
+
#
|
5
|
+
# +deprecate(name, repl, year, month)+:
|
6
|
+
# Indicate something may be removed on/after a certain date.
|
7
|
+
#
|
8
|
+
# +rubygems_deprecate(name, replacement=:none)+:
|
9
|
+
# Indicate something will be removed in the next major RubyGems version,
|
10
|
+
# and (optionally) a replacement for it.
|
11
|
+
#
|
12
|
+
# +rubygems_deprecate_command+:
|
13
|
+
# Indicate a RubyGems command (in +lib/rubygems/commands/*.rb+) will be
|
14
|
+
# removed in the next RubyGems version.
|
15
|
+
#
|
16
|
+
# Also provides +skip_during+ for temporarily turning off deprecation warnings.
|
17
|
+
# This is intended to be used in the test suite, so deprecation warnings
|
18
|
+
# don't cause test failures if you need to make sure stderr is otherwise empty.
|
19
|
+
#
|
20
|
+
#
|
21
|
+
# Example usage of +deprecate+ and +rubygems_deprecate+:
|
5
22
|
#
|
6
23
|
# class Legacy
|
7
|
-
# def self.
|
24
|
+
# def self.some_class_method
|
8
25
|
# # ...
|
9
26
|
# end
|
10
27
|
#
|
11
|
-
# def
|
28
|
+
# def some_instance_method
|
29
|
+
# # ...
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
# def some_old_method
|
12
33
|
# # ...
|
13
34
|
# end
|
14
35
|
#
|
15
36
|
# extend Gem::Deprecate
|
16
|
-
# deprecate :
|
37
|
+
# deprecate :some_instance_method, "X.z", 2011, 4
|
38
|
+
# rubygems_deprecate :some_old_method, "Modern#some_new_method"
|
17
39
|
#
|
18
40
|
# class << self
|
19
41
|
# extend Gem::Deprecate
|
20
|
-
# deprecate :
|
42
|
+
# deprecate :some_class_method, :none, 2011, 4
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
#
|
47
|
+
# Example usage of +rubygems_deprecate_command+:
|
48
|
+
#
|
49
|
+
# class Gem::Commands::QueryCommand < Gem::Command
|
50
|
+
# extend Gem::Deprecate
|
51
|
+
# rubygems_deprecate_command
|
52
|
+
#
|
53
|
+
# # ...
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
#
|
57
|
+
# Example usage of +skip_during+:
|
58
|
+
#
|
59
|
+
# class TestSomething < Gem::Testcase
|
60
|
+
# def test_some_thing_with_deprecations
|
61
|
+
# Gem::Deprecate.skip_during do
|
62
|
+
# actual_stdout, actual_stderr = capture_output do
|
63
|
+
# Gem.something_deprecated
|
64
|
+
# end
|
65
|
+
# assert_empty actual_stdout
|
66
|
+
# assert_equal(expected, actual_stderr)
|
67
|
+
# end
|
21
68
|
# end
|
22
69
|
# end
|
23
70
|
|
data/lib/rubygems/exceptions.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative 'deprecate'
|
4
|
+
require_relative 'unknown_command_spell_checker'
|
4
5
|
|
5
6
|
##
|
6
7
|
# Base exception class for RubyGems. All exception raised by RubyGems are a
|
@@ -9,6 +10,30 @@ class Gem::Exception < RuntimeError; end
|
|
9
10
|
|
10
11
|
class Gem::CommandLineError < Gem::Exception; end
|
11
12
|
|
13
|
+
class Gem::UnknownCommandError < Gem::Exception
|
14
|
+
attr_reader :unknown_command
|
15
|
+
|
16
|
+
def initialize(unknown_command)
|
17
|
+
self.class.attach_correctable
|
18
|
+
|
19
|
+
@unknown_command = unknown_command
|
20
|
+
super("Unknown command #{unknown_command}")
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.attach_correctable
|
24
|
+
return if defined?(@attached)
|
25
|
+
|
26
|
+
if defined?(DidYouMean::SPELL_CHECKERS) && defined?(DidYouMean::Correctable)
|
27
|
+
DidYouMean::SPELL_CHECKERS['Gem::UnknownCommandError'] =
|
28
|
+
Gem::UnknownCommandSpellChecker
|
29
|
+
|
30
|
+
prepend DidYouMean::Correctable
|
31
|
+
end
|
32
|
+
|
33
|
+
@attached = true
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
12
37
|
class Gem::DependencyError < Gem::Exception; end
|
13
38
|
|
14
39
|
class Gem::DependencyRemovalException < Gem::Exception; end
|
@@ -200,7 +225,7 @@ class Gem::SystemExitException < SystemExit
|
|
200
225
|
def initialize(exit_code)
|
201
226
|
@exit_code = exit_code
|
202
227
|
|
203
|
-
super "Exiting RubyGems with exit_code #{exit_code}"
|
228
|
+
super exit_code, "Exiting RubyGems with exit_code #{exit_code}"
|
204
229
|
end
|
205
230
|
end
|
206
231
|
|
data/lib/rubygems/ext/builder.rb
CHANGED
@@ -64,14 +64,16 @@ class Gem::Ext::Builder
|
|
64
64
|
require "open3"
|
65
65
|
# Set $SOURCE_DATE_EPOCH for the subprocess.
|
66
66
|
env = {'SOURCE_DATE_EPOCH' => Gem.source_date_epoch_string}
|
67
|
-
output, status =
|
67
|
+
output, status = begin
|
68
|
+
Open3.capture2e(env, *command, :chdir => dir)
|
69
|
+
rescue => error
|
70
|
+
raise Gem::InstallError, "#{command_name || class_name} failed#{error.message}"
|
71
|
+
end
|
68
72
|
if verbose
|
69
73
|
puts output
|
70
74
|
else
|
71
75
|
results << output
|
72
76
|
end
|
73
|
-
rescue => error
|
74
|
-
raise Gem::InstallError, "#{command_name || class_name} failed#{error.message}"
|
75
77
|
ensure
|
76
78
|
ENV['RUBYGEMS_GEMDEPS'] = rubygems_gemdeps
|
77
79
|
end
|
@@ -181,10 +181,19 @@ module Gem::InstallUpdateOptions
|
|
181
181
|
end
|
182
182
|
|
183
183
|
##
|
184
|
-
# Default options for the gem install
|
184
|
+
# Default options for the gem install and update commands.
|
185
|
+
|
186
|
+
def install_update_options
|
187
|
+
{
|
188
|
+
:document => %w[ri],
|
189
|
+
}
|
190
|
+
end
|
191
|
+
|
192
|
+
##
|
193
|
+
# Default description for the gem install and update commands.
|
185
194
|
|
186
195
|
def install_update_defaults_str
|
187
|
-
'--document=
|
196
|
+
'--document=ri'
|
188
197
|
end
|
189
198
|
|
190
199
|
end
|
data/lib/rubygems/installer.rb
CHANGED
@@ -768,7 +768,7 @@ str = ARGV.first
|
|
768
768
|
if str
|
769
769
|
str = str.b[/\\A_(.*)_\\z/, 1]
|
770
770
|
if str and Gem::Version.correct?(str)
|
771
|
-
|
771
|
+
#{explicit_version_requirement(spec.name)}
|
772
772
|
ARGV.shift
|
773
773
|
end
|
774
774
|
end
|
@@ -791,6 +791,16 @@ Gem.use_gemdeps
|
|
791
791
|
TEXT
|
792
792
|
end
|
793
793
|
|
794
|
+
def explicit_version_requirement(name)
|
795
|
+
code = "version = str"
|
796
|
+
return code unless name == "bundler"
|
797
|
+
|
798
|
+
code += <<-TEXT
|
799
|
+
|
800
|
+
ENV['BUNDLER_VERSION'] = str
|
801
|
+
TEXT
|
802
|
+
end
|
803
|
+
|
794
804
|
##
|
795
805
|
# return the stub script text used to launch the true Ruby script
|
796
806
|
|
data/lib/rubygems/name_tuple.rb
CHANGED
@@ -89,9 +89,8 @@ class Gem::NameTuple
|
|
89
89
|
alias to_s inspect # :nodoc:
|
90
90
|
|
91
91
|
def <=>(other)
|
92
|
-
[@name, @version,
|
93
|
-
[other.name, other.version,
|
94
|
-
other.platform == Gem::Platform::RUBY ? -1 : 1]
|
92
|
+
[@name, @version, Gem::Platform.sort_priority(@platform)] <=>
|
93
|
+
[other.name, other.version, Gem::Platform.sort_priority(other.platform)]
|
95
94
|
end
|
96
95
|
|
97
96
|
include Comparable
|
@@ -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/requirement.rb
CHANGED
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
|
##
|
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
|
|
@@ -179,18 +181,14 @@ class Gem::Specification < Gem::BasicSpecification
|
|
179
181
|
end
|
180
182
|
|
181
183
|
def self.clear_specs # :nodoc:
|
182
|
-
@@
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
@@active_stub_with_requirable_file = {}
|
188
|
-
end
|
184
|
+
@@all = nil
|
185
|
+
@@stubs = nil
|
186
|
+
@@stubs_by_name = {}
|
187
|
+
@@spec_with_requirable_file = {}
|
188
|
+
@@active_stub_with_requirable_file = {}
|
189
189
|
end
|
190
190
|
private_class_method :clear_specs
|
191
191
|
|
192
|
-
@@all_specs_mutex = Thread::Mutex.new
|
193
|
-
|
194
192
|
clear_specs
|
195
193
|
|
196
194
|
# Sentinel object to represent "not found" stubs
|
@@ -758,7 +756,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
758
756
|
attr_accessor :specification_version
|
759
757
|
|
760
758
|
def self._all # :nodoc:
|
761
|
-
@@
|
759
|
+
@@all ||= Gem.loaded_specs.values | stubs.map(&:to_spec)
|
762
760
|
end
|
763
761
|
|
764
762
|
def self.clear_load_cache # :nodoc:
|
@@ -861,7 +859,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
861
859
|
next names if names.nonzero?
|
862
860
|
versions = b.version <=> a.version
|
863
861
|
next versions if versions.nonzero?
|
864
|
-
b.platform
|
862
|
+
Gem::Platform.sort_priority(b.platform)
|
865
863
|
end
|
866
864
|
end
|
867
865
|
|
@@ -1086,7 +1084,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
1086
1084
|
# +prerelease+ is true.
|
1087
1085
|
|
1088
1086
|
def self.latest_specs(prerelease = false)
|
1089
|
-
_latest_specs Gem::Specification.
|
1087
|
+
_latest_specs Gem::Specification.stubs, prerelease
|
1090
1088
|
end
|
1091
1089
|
|
1092
1090
|
##
|
@@ -2335,7 +2333,7 @@ class Gem::Specification < Gem::BasicSpecification
|
|
2335
2333
|
# Returns an object you can use to sort specifications in #sort_by.
|
2336
2334
|
|
2337
2335
|
def sort_obj
|
2338
|
-
[@name, @version,
|
2336
|
+
[@name, @version, Gem::Platform.sort_priority(@new_platform)]
|
2339
2337
|
end
|
2340
2338
|
|
2341
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
|
data/lib/rubygems/uninstaller.rb
CHANGED