Class
Cleans up after a partially-failed uninstall or for an invalid Gem::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.
Constants
Maps a gem subdirectory to the files that are expected to exist in the subdirectory.
Class Methods
lib/rubygems/doctor.rb
View on GitHub
# File tmp/rubies/ruby-2.5.9/lib/rubygems/doctor.rb, line 44
def initialize gem_repository, dry_run = false
@gem_repository = gem_repository
@dry_run = dry_run
@installed_specs = nil
end
Creates a new Gem::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.
Instance Methods
#
lib/rubygems/doctor.rb
View on GitHub
# File tmp/rubies/ruby-2.5.9/lib/rubygems/doctor.rb, line 68
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
Cleans up uninstalled files and invalid gem specifications
lib/rubygems/doctor.rb
View on GitHub
# File tmp/rubies/ruby-2.5.9/lib/rubygems/doctor.rb, line 61
def gem_repository?
not installed_specs.empty?
end
Are we doctoring a gem repository?