You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: generate_index_command.rb
    path of file: ./repos/rubygems/lib/rubygems/commands
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require_relative "../command"

unless defined? Gem::Commands::GenerateIndexCommand
    
      def invoke_with_build_args(args, build_args)
        name = "rubygems-generate_index"
        spec = begin
          Gem::Specification.find_by_name(name)
        rescue Gem::LoadError
          require "rubygems/dependency_installer"
          Gem.install(name, Gem::Requirement.default, Gem::DependencyInstaller::DEFAULT_OPTIONS).find {|s| s.name == name }
        end