class Gem::Uninstaller

def remove_executables(spec)

def remove_executables(spec)
  return if spec.nil? or spec.executables.empty?
  executables = spec.executables.clone
  # Leave any executables created by other installed versions
  # of this gem installed.
  list = Gem::Specification.find_all { |s|
    s.name == spec.name && s.version != spec.version
  }
  list.each do |s|
    s.executables.each do |exe_name|
      executables.delete exe_name
    end
  end
  return if executables.empty?
  executables = executables.map { |exec| formatted_program_filename exec }
  remove = if @force_executables.nil? then
             ask_yes_no("Remove executables:\n" +
                        "\t#{executables.join ', '}\n\n" +
                        "in addition to the gem?",
                        true)
           else
             @force_executables
           end
  if remove then
    bin_dir = @bin_dir || Gem.bindir(spec.base_dir)
    raise Gem::FilePermissionError, bin_dir unless File.writable? bin_dir
    executables.each do |exe_name|
      say "Removing #{exe_name}"
      exe_file = File.join bin_dir, exe_name
      FileUtils.rm_f exe_file
      FileUtils.rm_f "#{exe_file}.bat"
    end
  else
    say "Executables and scripts will remain installed."
  end
end