Library/Homebrew/cleaner.rb
# Removes any empty directories in the formula's prefix subtree
# Keeps any empty directions projected by skip_clean
# Removes any unresolved symlinks
Removes any empty directories in the formula's prefix subtree
Keeps any empty directions projected by skip_clean
Removes any unresolved symlinks
Removes any empty directories in the formula ' s prefix subtree Keeps any empty directions projected by skip_clean Removes any unresolved symlinks
def prune
    dirs = []
    symlinks = []
    @f.prefix.find do |path|
      if path == @f.libexec || @f.skip_clean?(path)
        Find.prune
      elsif path.symlink?
        symlinks << path
      elsif path.directory?
        dirs << path
      end
    end
    dirs.reverse_each do |d|
      if d.children.empty?
        puts "rmdir: #{d} (empty)" if ARGV.verbose?
        d.rmdir
      end
    end
    symlinks.reverse_each do |s|
      s.unlink unless s.resolved_path_exists?
    end
  end
def prune dirs = [ ] symlinks = [ ] @f . prefix . find do | path | if path == @f . libexec || @f . skip_clean? ( path ) Find . prune elsif path . symlink? symlinks << path elsif path . directory? dirs << path end end dirs . reverse_each do | d | if d . children . empty? puts "rmdir: #{d} (empty)" if ARGV . verbose? d . rmdir end end symlinks . reverse_each do | s | s . unlink unless s . resolved_path_exists? end end
Removes any empty directories in the formula's prefix subtree
Keeps any empty directions projected by skip_clean
Removes any unresolved symlinks
Removes any empty directories in the formula ' s prefix subtree Keeps any empty directions projected by skip_clean Removes any unresolved symlinks
# Remove directories opposite from traversal, so that a subtree with no # actual files gets removed correctly. # Remove unresolved symlinks