diff options
Diffstat (limited to 'lib/rubygems/uninstaller.rb')
-rw-r--r-- | lib/rubygems/uninstaller.rb | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb index 20b437d472..1766423429 100644 --- a/lib/rubygems/uninstaller.rb +++ b/lib/rubygems/uninstaller.rb @@ -7,6 +7,7 @@ require 'fileutils' require 'rubygems' +require 'rubygems/installer_uninstaller_utils' require 'rubygems/dependency_list' require 'rubygems/rdoc' require 'rubygems/user_interaction' @@ -23,6 +24,8 @@ class Gem::Uninstaller include Gem::UserInteraction + include Gem::InstallerUninstallerUtils + ## # The directory a gem's executables will be installed into @@ -158,8 +161,11 @@ class Gem::Uninstaller end remove_executables @spec + remove_plugins @spec remove @spec + regenerate_plugins + Gem.post_uninstall_hooks.each do |hook| hook.call self end @@ -168,11 +174,10 @@ class Gem::Uninstaller end ## - # Removes installed executables and batch files (windows only) for - # +gemspec+. + # Removes installed executables and batch files (windows only) for +spec+. def remove_executables(spec) - return if spec.nil? or spec.executables.empty? + return if spec.executables.empty? executables = spec.executables.clone @@ -231,10 +236,6 @@ class Gem::Uninstaller ## # spec:: the spec of the gem to be uninstalled - # list:: the list of all such gems - # - # Warning: this method modifies the +list+ parameter. Once it has - # uninstalled a gem, it is removed from that list. def remove(spec) unless path_ok?(@gem_home, spec) or @@ -275,6 +276,25 @@ class Gem::Uninstaller end ## + # Remove any plugin wrappers for +spec+. + + def remove_plugins(spec) # :nodoc: + return if spec.plugins.empty? + + remove_plugins_for(spec) + end + + ## + # Regenerates plugin wrappers after removal. + + def regenerate_plugins + latest = Gem::Specification.latest_spec_for(@spec.name) + return if latest.nil? + + regenerate_plugins_for(latest) + end + + ## # Is +spec+ in +gem_dir+? def path_ok?(gem_dir, spec) @@ -317,7 +337,7 @@ class Gem::Uninstaller s.name == spec.name && s.full_name != spec.full_name end - spec.dependent_gems.each do |dep_spec, dep, satlist| + spec.dependent_gems(@check_dev).each do |dep_spec, dep, satlist| unless siblings.any? { |s| s.satisfies_requirement? dep } msg << "#{dep_spec.name}-#{dep_spec.version} depends on #{dep}" end |