mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 05:25:34 +02:00
* lib/rubygems: Update to RubyGems 2.1.3
Fixed installing platform gems Restored concurrent requires Fixed installing gems with extensions with --install-dir Fixed `gem fetch -v` to install the latest version Fixed installing gems with "./" in their files entries * test/rubygems/test_gem_package.rb: Tests for the above. * NEWS: Updated for RubyGems 2.1.3 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
85995e88d4
commit
1daa0b113d
110 changed files with 3493 additions and 4942 deletions
|
@ -1,7 +1,6 @@
|
|||
require 'rubygems/command'
|
||||
require 'rubygems/version_option'
|
||||
require 'rubygems/uninstaller'
|
||||
require 'fileutils'
|
||||
|
||||
##
|
||||
# Gem uninstaller command line tool
|
||||
|
@ -15,7 +14,7 @@ class Gem::Commands::UninstallCommand < Gem::Command
|
|||
def initialize
|
||||
super 'uninstall', 'Uninstall gems from the local repository',
|
||||
:version => Gem::Requirement.default, :user_install => true,
|
||||
:install_dir => Gem.dir, :check_dev => false
|
||||
:check_dev => false
|
||||
|
||||
add_option('-a', '--[no-]all',
|
||||
'Uninstall all matching versions'
|
||||
|
@ -68,12 +67,6 @@ 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
|
||||
|
@ -88,49 +81,13 @@ 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
|
||||
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
|
||||
# REFACTOR: stolen from cleanup_command
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue