diff options
| author | Jack Nagel | 2013-12-22 13:43:50 -0600 | 
|---|---|---|
| committer | Jack Nagel | 2013-12-22 13:43:50 -0600 | 
| commit | 095d83d10b6763ecc57f3967898113c98b920063 (patch) | |
| tree | f2686a5fe7ddd3cb76ac831bf06785d53eb410ad /Library/Homebrew/cleaner.rb | |
| parent | 676f29d7578c7abf1493ee5c3edc4692f9315006 (diff) | |
| download | brew-095d83d10b6763ecc57f3967898113c98b920063.tar.bz2 | |
cleaner: reorganize clean_dir to avoid repeated conditional
Diffstat (limited to 'Library/Homebrew/cleaner.rb')
| -rw-r--r-- | Library/Homebrew/cleaner.rb | 18 | 
1 files changed, 7 insertions, 11 deletions
diff --git a/Library/Homebrew/cleaner.rb b/Library/Homebrew/cleaner.rb index bf0639835..5a54f88b0 100644 --- a/Library/Homebrew/cleaner.rb +++ b/Library/Homebrew/cleaner.rb @@ -74,21 +74,17 @@ class Cleaner      d.find do |path|        path.extend(NoisyPathname) if ARGV.verbose? -      if path.directory? -        # Stop cleaning this subtree if protected -        Find.prune if @f.skip_clean? path -      elsif not path.file? -        # Sanity? +      Find.prune if @f.skip_clean? path + +      if path.symlink? or path.directory?          next        elsif path.extname == '.la' -        # *.la files are stupid -        path.unlink unless @f.skip_clean? path +        path.unlink        elsif path == @f.lib+'charset.alias'          # Many formulae symlink this file, but it is not strictly needed -        path.unlink unless @f.skip_clean? path -      elsif not path.symlink? -        # Fix permissions -        clean_file_permissions(path) unless @f.skip_clean? path +        path.unlink +      else +        clean_file_permissions(path)        end      end    end  | 
