123456789_123456789_123456789_123456789_123456789_

Module: Gem::Commands::GenerateIndexCommand::RubygemsTrampoline

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/rubygems/commands/generate_index_command.rb

Instance Method Summary

Instance Method Details

#description

This method is for internal use only.
[ GitHub ]

  
# File 'lib/rubygems/commands/generate_index_command.rb', line 8

def description # :nodoc:
  <<~EOF
    The generate_index command has been moved to the rubygems-generate_index gem.
  EOF
end

#execute

[ GitHub ]

  
# 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)

[ GitHub ]

  
# 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