Method: Gem::Uninstaller#uninstall_gem

Defined in:
lib/rubygems/uninstaller.rb

#uninstall_gem(stub) ⇒ Object

Uninstalls gem spec



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/rubygems/uninstaller.rb', line 145

def uninstall_gem(stub)
  spec = stub.to_spec

  @spec = spec

  unless dependencies_ok? spec
    if abort_on_dependent? || !ask_if_ok(spec)
      raise Gem::DependencyRemovalException,
        "Uninstallation aborted due to dependent gem(s)"
    end
  end

  Gem.pre_uninstall_hooks.each do |hook|
    hook.call self
  end

  remove_executables @spec
  remove_plugins @spec
  remove @spec

  specification_record.remove_spec(stub)

  regenerate_plugins

  Gem.post_uninstall_hooks.each do |hook|
    hook.call self
  end

  @spec = nil
end