remove(spec)
public
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.
# File lib/rubygems/uninstaller.rb, line 240
def remove(spec)
unless path_ok?(@gem_home, spec) or
(@user_install and path_ok?(Gem.user_dir, spec))
e = Gem::GemNotInHomeException.new "Gem '#{spec.full_name}' is not installed in directory #{@gem_home}"
e.spec = spec
raise e
end
raise Gem::FilePermissionError, spec.base_dir unless
File.writable?(spec.base_dir)
safe_delete { FileUtils.rm_r spec.full_gem_path }
safe_delete { FileUtils.rm_r spec.extension_dir }
old_platform_name = spec.original_name
gem = spec.cache_file
gem = File.join(spec.cache_dir, "#{old_platform_name}.gem") unless
File.exist? gem
safe_delete { FileUtils.rm_r gem }
Gem::RDoc.new(spec).remove
gemspec = spec.spec_file
unless File.exist? gemspec
gemspec = File.join(File.dirname(gemspec), "#{old_platform_name}.gemspec")
end
safe_delete { FileUtils.rm_r gemspec }
say "Successfully uninstalled #{spec.full_name}"
Gem::Specification.reset
end