method
uninstall_dep
v2_1_10 -
Show latest stable
- Class:
Gem::Commands::CleanupCommand
uninstall_dep(spec)public
No documentation available.
# File lib/rubygems/commands/cleanup_command.rb, line 134
def uninstall_dep spec
return unless @full.ok_to_remove?(spec.full_name)
if options[:dryrun] then
say "Dry Run Mode: Would uninstall #{spec.full_name}"
return
end
say "Attempting to uninstall #{spec.full_name}"
uninstall_options = {
:executables => false,
:version => "= #{spec.version}",
}
uninstall_options[:user_install] = Gem.user_dir == spec.base_dir
uninstaller = Gem::Uninstaller.new spec.name, uninstall_options
begin
uninstaller.uninstall
rescue Gem::DependencyRemovalException, Gem::InstallError,
Gem::GemNotInHomeException, Gem::FilePermissionError => e
say "Unable to uninstall #{spec.full_name}:"
say "\t#{e.class}: #{e.message}"
end
ensure
# Restore path Gem::Uninstaller may have changed
Gem.use_paths @original_home, *@original_path
end