Merge rubygems/rubygems from upstream.

The current master branch is
  97b264f0fa

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2019-04-02 11:48:18 +00:00
parent 5370244337
commit f28be7e02d
34 changed files with 264 additions and 184 deletions

View file

@ -319,5 +319,4 @@ For further reading on signing gems see `ri Gem::Security`.
email =~ /\A.+@.+\z/
end
end if defined?(OpenSSL::SSL)

View file

@ -104,7 +104,7 @@ extensions will be restored.
end.flatten
end
specs = specs.select{|spec| spec.platform == RUBY_ENGINE }
specs = specs.select{|spec| RUBY_ENGINE == spec.platform || Gem::Platform.local === spec.platform }
if specs.to_a.empty?
raise Gem::Exception,

View file

@ -165,7 +165,7 @@ By default, this RubyGems will install gem as:
remove_old_lib_files lib_dir
install_default_bundler_gem
install_default_bundler_gem bin_dir
if mode = options[:dir_mode]
@mkdirs.uniq!
@ -234,21 +234,19 @@ By default, this RubyGems will install gem as:
end
end
def install_executables(bin_dir)
@bin_file_names = []
prog_mode = options[:prog_mode] || 0755
executables = { 'gem' => 'bin' }
executables['bundler'] = 'bundler/exe' if Gem::USE_BUNDLER_FOR_GEMDEPS
executables.each do |tool, path|
say "Installing #{tool} executable" if @verbose
Dir.chdir path do
bin_files = Dir['*']
bin_files -= %w[update_rubygems bundler bundle_ruby]
bin_files -= %w[update_rubygems]
bin_files.each do |bin_file|
bin_file_formatted = if options[:format_executable]
@ -383,7 +381,7 @@ By default, this RubyGems will install gem as:
return false
end
def install_default_bundler_gem
def install_default_bundler_gem(bin_dir)
return unless Gem::USE_BUNDLER_FOR_GEMDEPS
specs_dir = Gem::Specification.default_specifications_dir
@ -428,13 +426,12 @@ By default, this RubyGems will install gem as:
cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_bin_dir, e)
end
if Gem.win_platform?
require 'rubygems/installer'
require 'rubygems/installer'
installer = Gem::Installer.for_spec bundler_spec
bundler_spec.executables.each do |e|
installer.generate_windows_script e, bundler_spec.bin_dir
end
Dir.chdir("bundler") do
built_gem = Gem::Package.build(bundler_spec)
installer = Gem::Installer.at(built_gem, env_shebang: options[:env_shebang], install_as_default: true, bin_dir: bin_dir, wrappers: true)
installer.install
end
say "Bundler #{bundler_spec.version} installed"

View file

@ -148,10 +148,13 @@ that is a dependency of an existing gem. You can use the
def uninstall_specific
deplist = Gem::DependencyList.new
original_gem_version = {}
get_all_gem_names_and_versions.each do |name, version|
requirement = Array(version || options[:version])
gem_specs = Gem::Specification.find_all_by_name(name, *requirement)
original_gem_version[name] = version || options[:version]
gem_specs = Gem::Specification.find_all_by_name(name, original_gem_version[name])
say("Gem '#{name}' is not installed") if gem_specs.empty?
gem_specs.each do |spec|
deplist.add spec
@ -160,16 +163,23 @@ that is a dependency of an existing gem. You can use the
deps = deplist.strongly_connected_components.flatten.reverse
gems_to_uninstall = {}
deps.each do |dep|
options[:version] = dep.version
uninstall_gem(dep.name)
unless gems_to_uninstall[dep.name]
gems_to_uninstall[dep.name] = true
unless original_gem_version[dep.name] == Gem::Requirement.default
options[:version] = dep.version
end
uninstall_gem(dep.name)
end
end
end
def uninstall_gem(gem_name)
uninstall(gem_name)
rescue Gem::InstallError
nil
rescue Gem::GemNotInHomeException => e
spec = e.spec
alert("In order to remove #{spec.name}, please execute:\n" +