类 Gem::Doctor
清理部分卸载失败或无效的 Gem::Specification
后的残留。
如果手动删除了规范,此操作将删除任何剩余的文件。
如果安装了损坏的规范,此操作将通过删除错误的规范来清除警告。
公共类方法
源代码
# File lib/rubygems/doctor.rb, line 45 def initialize(gem_repository, dry_run = false) @gem_repository = gem_repository @dry_run = dry_run @installed_specs = nil end
创建一个新的 Gem::Doctor
,它将清理 gem_repository
。一次只能清理一个 gem 仓库。
如果 dry_run
为 true,则不会删除任何文件或目录。
公共实例方法
源代码
# File lib/rubygems/doctor.rb, line 69 def doctor @orig_home = Gem.dir @orig_path = Gem.path say "Checking #{@gem_repository}" Gem.use_paths @gem_repository.to_s unless gem_repository? 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
清理未卸载的文件和无效的 gem 规范
源代码
# File lib/rubygems/doctor.rb, line 62 def gem_repository? !installed_specs.empty? end
我们是否正在对 gem 仓库进行修复?