def remove(spec)
    unless path_ok?(@gem_home, spec) or
           (@user_install and path_ok?(Gem.user_dir, spec)) then
      e = Gem::GemNotInHomeException.new \
            "Gem 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)

    FileUtils.rm_rf spec.full_gem_path

    # TODO: should this be moved to spec?... I vote eww (also exists in docmgr)
    old_platform_name = [spec.name,
                         spec.version,
                         spec.original_platform].join '-'

    gemspec = spec.spec_file

    unless File.exist? gemspec then
      gemspec = File.join(File.dirname(gemspec), "#{old_platform_name}.gemspec")
    end

    FileUtils.rm_rf gemspec

    gem = spec.cache_file
    gem = File.join(spec.cache_dir, "#{old_platform_name}.gem") unless
      File.exist? gem

    FileUtils.rm_rf gem

    Gem::DocManager.new(spec).uninstall_doc

    say "Successfully uninstalled #{spec.full_name}"

    Gem::Specification.remove_spec spec
  end
#
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.