lib/rbs/collection/cleaner.rb in rbs-3.0.0.dev.2 vs lib/rbs/collection/cleaner.rb in rbs-3.0.0.dev.3
- old
+ new
@@ -14,10 +14,17 @@
*_, gem_name, version = dir.to_s.split('/')
gem_name or raise
version or raise
next if needed? gem_name, version
- FileUtils.remove_entry_secure(dir.to_s)
+ case
+ when dir.symlink?
+ dir.unlink
+ when dir.directory?
+ FileUtils.remove_entry_secure(dir.to_s)
+ else
+ raise
+ end
end
end
def needed?(gem_name, version)
gem = lock.gem(gem_name)