module Gem::Commands::GenerateIndexCommand::RubygemsTrampoline - Documentation for Ruby 3.4
Description: Documentation for the Gem::Commands::GenerateIndexCommand::RubygemsTrampoline module
Keywords: ruby,module,Gem::Commands::GenerateIndexCommand::RubygemsTrampoline

# module Gem::Commands::GenerateIndexCommand::RubygemsTrampoline

### Public Instance Methods

execute ()
Source

    # File lib/rubygems/commands/generate_index_command.rb, line 14
    def execute
      alert_error "Install the rubygems-generate_index gem for the generate_index command"
    end

invoke_with_build_args (args, build_args)
Source

    # File lib/rubygems/commands/generate_index_command.rb, line 18
    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

      # remove the methods defined in this file so that the methods defined in the gem are used instead,
      # and without a method redefinition warning
      %w[description execute invoke_with_build_args].each do |method|
        RubygemsTrampoline.remove_method(method)
      end
      self.class.singleton_class.remove_method(:new)

      spec.activate
      Gem.load_plugin_files spec.matches_for_glob("rubygems_plugin#{Gem.suffix_pattern}")

      self.class.new.invoke_with_build_args(args, build_args)
    end