1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Revert r42938 "* lib/rubygems: Update to RubyGems 2.1.3"

It breaks build.
20130913T200302Z.diff.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2013-09-14 08:59:02 +00:00
parent 2614d9ba2f
commit 269503b544
110 changed files with 4928 additions and 3479 deletions

View file

@ -1,6 +1,7 @@
require 'rubygems/command'
require 'rubygems/version_option'
require 'rubygems/uninstaller'
require 'fileutils'
##
# Gem uninstaller command line tool
@ -14,7 +15,7 @@ class Gem::Commands::UninstallCommand < Gem::Command
def initialize
super 'uninstall', 'Uninstall gems from the local repository',
:version => Gem::Requirement.default, :user_install => true,
:check_dev => false
:install_dir => Gem.dir, :check_dev => false
add_option('-a', '--[no-]all',
'Uninstall all matching versions'
@ -67,6 +68,12 @@ class Gem::Commands::UninstallCommand < Gem::Command
options[:force] = value
end
add_option('--[no-]abort-on-dependent',
'Prevent uninstalling gems that are',
'depended on by other gems.') do |value, options|
options[:abort_on_dependent] = value
end
add_version_option
add_platform_option
end
@ -81,13 +88,49 @@ class Gem::Commands::UninstallCommand < Gem::Command
"--user-install"
end
def description # :nodoc:
<<-EOF
The uninstall command removes a previously installed gem.
RubyGems will ask for confirmation if you are attempting to uninstall a gem
that is a dependency of an existing gem. You can use the
--ignore-dependencies option to skip this check.
EOF
end
def usage # :nodoc:
"#{program_name} GEMNAME [GEMNAME ...]"
end
def execute
# REFACTOR: stolen from cleanup_command
if options[:all] and not options[:args].empty? then
alert_error 'Gem names and --all may not be used together'
terminate_interaction 1
elsif options[:all] then
uninstall_all
else
uninstall_specific
end
end
def uninstall_all
_, specs = Gem::Specification.partition { |spec| spec.default_gem? }
specs.each do |spec|
options[:version] = spec.version
begin
Gem::Uninstaller.new(spec.name, options).uninstall
rescue Gem::InstallError
end
end
alert "Uninstalled all gems in #{options[:install_dir]}"
end
def uninstall_specific
deplist = Gem::DependencyList.new
get_all_gem_names.uniq.each do |name|
Gem::Specification.find_all_by_name(name).each do |spec|
deplist.add spec