Class: Gem::Doctor
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
|
|
Inherits: | Object |
Defined in: | lib/rubygems/doctor.rb |
Overview
Cleans up after a partially-failed uninstall or for an invalid Specification.
If a specification was removed by hand this will remove any remaining files.
If a corrupt specification was installed this will clean up warnings by removing the bogus specification.
Class Method Summary
-
.new(gem_repository, dry_run = false) ⇒ Doctor
constructor
Creates a new
Doctor
that will clean upgem_repository
.
Instance Attribute Summary
-
#gem_repository? ⇒ Boolean
readonly
Are we doctoring a gem repository?
DefaultUserInteraction - Included
Instance Method Summary
-
#doctor
Cleans up uninstalled files and invalid gem specifications.
UserInteraction - Included
#alert | Displays an alert |
#alert_error | Displays an error |
#alert_warning | Displays a warning |
#ask | Asks a |
#ask_for_password | Asks for a password with a |
#ask_yes_no | Asks a yes or no |
#choose_from_list | Asks the user to answer |
#say | Displays the given |
#terminate_interaction | Terminates the RubyGems process with the given |
#verbose | Calls |
DefaultUserInteraction - Included
Constructor Details
.new(gem_repository, dry_run = false) ⇒ Doctor
Creates a new Doctor
that will clean up gem_repository
. Only one gem repository may be cleaned at a time.
If dry_run
is true no files or directories will be removed.
# File 'lib/rubygems/doctor.rb', line 43
def initialize gem_repository, dry_run = false @gem_repository = gem_repository @dry_run = dry_run @installed_specs = nil end
Instance Attribute Details
#gem_repository? ⇒ Boolean
(readonly)
Are we doctoring a gem repository?
# File 'lib/rubygems/doctor.rb', line 60
def gem_repository? not installed_specs.empty? end
Instance Method Details
#doctor
Cleans up uninstalled files and invalid gem specifications
# File 'lib/rubygems/doctor.rb', line 67
def doctor @orig_home = Gem.dir @orig_path = Gem.path say "Checking #{@gem_repository}" Gem.use_paths @gem_repository.to_s unless gem_repository? then say 'This directory does not appear to be a RubyGems repository, ' + 'skipping' say return end doctor_children say ensure Gem.use_paths @orig_home, *@orig_path end