method

update_gem

Importance_0
Ruby latest stable (v2_5_5) - 0 notes - Class: UpdateCommand
update_gem(name, version = Gem::Requirement.default) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File lib/rubygems/commands/update_command.rb, line 203
  def update_gem name, version = Gem::Requirement.default
    return if @updated.any? { |spec| spec.name == name }

    update_options = options.dup
    update_options[:prerelease] = version.prerelease?

    @installer = Gem::DependencyInstaller.new update_options

    say "Updating #{name}"
    begin
      @installer.install name, Gem::Requirement.new(version)
    rescue Gem::InstallError, Gem::DependencyError => e
      alert_error "Error installing #{name}:\n\t#{e.message}"
    end

    @installer.installed_gems.each do |spec|
      @updated << spec
    end
  end
Register or log in to add new notes.