Merge rubygems-2.7.3.

http://blog.rubygems.org/2017/11/28/2.7.3-released.html

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60927 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2017-11-28 22:30:28 +00:00
parent 89bfee6fd4
commit e82802070a
9 changed files with 212 additions and 23 deletions

View file

@ -8,13 +8,20 @@ class Gem::Commands::CleanupCommand < Gem::Command
def initialize
super 'cleanup',
'Clean up old versions of installed gems',
:force => false, :install_dir => Gem.dir
:force => false, :install_dir => Gem.dir,
:check_dev => true
add_option('-n', '-d', '--dryrun',
'Do not uninstall gems') do |value, options|
options[:dryrun] = true
end
add_option('-D', '--[no-]check-development',
'Check development dependencies while uninstalling',
'(default: true)') do |value, options|
options[:check_dev] = value
end
@candidate_gems = nil
@default_gems = []
@full = nil
@ -138,7 +145,7 @@ If no gems are named all gems in GEM_HOME are cleaned.
end
def uninstall_dep spec
return unless @full.ok_to_remove?(spec.full_name)
return unless @full.ok_to_remove?(spec.full_name, options[:check_dev])
if options[:dryrun] then
say "Dry Run Mode: Would uninstall #{spec.full_name}"

View file

@ -82,11 +82,7 @@ class Gem::Commands::SetupCommand < Gem::Command
add_option '--[no-]regenerate-binstubs',
'Regenerate gem binstubs' do |value, options|
if value then
options[:regenerate_binstubs] = true
else
options.delete(:regenerate_binstubs)
end
options[:regenerate_binstubs] = value
end
@verbose = nil
@ -156,7 +152,7 @@ By default, this RubyGems will install gem as:
say "RubyGems #{Gem::VERSION} installed"
regenerate_binstubs
regenerate_binstubs if options[:regenerate_binstubs]
uninstall_old_gemcutter
@ -357,7 +353,7 @@ By default, this RubyGems will install gem as:
mkdir_p Gem::Specification.default_specifications_dir
# Workaround for non-git environment.
gemspec = File.read('bundler/bundler.gemspec').gsub(/`git ls-files -z`/, "''")
gemspec = File.open('bundler/bundler.gemspec', 'rb'){|f| f.read.gsub(/`git ls-files -z`/, "''") }
File.open('bundler/bundler.gemspec', 'w'){|f| f.write gemspec }
bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
@ -372,13 +368,24 @@ By default, this RubyGems will install gem as:
bundler_spec = Gem::Specification.load(default_spec_path)
Dir.entries(bundler_spec.gems_dir).
select {|default_gem| default_gem.start_with?("bundler-") }.
each {|default_gem| rm_r File.join(bundler_spec.gems_dir, default_gem) }
if File.directory? bundler_spec.gems_dir
Dir.entries(bundler_spec.gems_dir).
select {|default_gem| File.basename(default_gem).match(/^bundler-#{Gem::Version::VERSION_PATTERN}$/) }.
each {|default_gem| rm_r File.join(bundler_spec.gems_dir, default_gem) }
end
mkdir_p bundler_spec.bin_dir
bundler_spec.executables.each {|e| cp File.join("bundler", bundler_spec.bindir, e), File.join(bundler_spec.bin_dir, e) }
if Gem.win_platform?
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
end
say "Bundler #{bundler_spec.version} installed"
end
@ -442,7 +449,7 @@ By default, this RubyGems will install gem as:
# for installation of bundler as default gems
def template_files
Dir.chdir "bundler/lib" do
(Dir[File.join('bundler', 'templates', '**', '*')] + Dir[File.join('bundler', 'templates', '**', '.*')]).
(Dir[File.join('bundler', 'templates', '**', '{*,.*}')]).
select{|f| !File.directory?(f)}
end
end
@ -450,7 +457,7 @@ By default, this RubyGems will install gem as:
# for cleanup old bundler files
def template_files_in dir
Dir.chdir dir do
(Dir[File.join('templates', '**', '*')] + Dir[File.join('templates', '**', '.*')]).
(Dir[File.join('templates', '**', '{*,.*}')]).
select{|f| !File.directory?(f)}
end
end