    # File lib/rubygems/indexer.rb, line 203
      def collect_specs
        index = Gem::SourceIndex.new

        progress = ui.progress_reporter gem_file_list.size,
                                        "Loading #{gem_file_list.size} gems from #{@dest_directory}",
                                        "Loaded all gems"

        gem_file_list.each do |gemfile|
          if File.size(gemfile.to_s) == 0 then
            alert_warning "Skipping zero-length gem: #{gemfile}"
            next
          end

          begin
            spec = Gem::Format.from_file_by_path(gemfile).spec

            unless gemfile =~ /\/#{Regexp.escape spec.original_name}.*\.gem\z/i then
              alert_warning "Skipping misnamed gem: #{gemfile} => #{spec.full_name} (#{spec.original_name})"
              next
            end

            abbreviate spec
            sanitize spec

            index.gems[spec.original_name] = spec

            progress.updated spec.original_name

          rescue SignalException => e
            alert_error "Received signal, exiting"
            raise
          rescue Exception => e
            alert_error "Unable to process #{gemfile}\n#{e.message} (#{e.class})\n\t#{e.backtrace.join "\n\t"}"
          end
        end

        progress.done

        index
      end