cleaner: reorganize clean_dir to avoid repeated conditional
This commit is contained in:
parent
676f29d757
commit
095d83d10b
@ -74,21 +74,17 @@ class Cleaner
|
|||||||
d.find do |path|
|
d.find do |path|
|
||||||
path.extend(NoisyPathname) if ARGV.verbose?
|
path.extend(NoisyPathname) if ARGV.verbose?
|
||||||
|
|
||||||
if path.directory?
|
|
||||||
# Stop cleaning this subtree if protected
|
|
||||||
Find.prune if @f.skip_clean? path
|
Find.prune if @f.skip_clean? path
|
||||||
elsif not path.file?
|
|
||||||
# Sanity?
|
if path.symlink? or path.directory?
|
||||||
next
|
next
|
||||||
elsif path.extname == '.la'
|
elsif path.extname == '.la'
|
||||||
# *.la files are stupid
|
path.unlink
|
||||||
path.unlink unless @f.skip_clean? path
|
|
||||||
elsif path == @f.lib+'charset.alias'
|
elsif path == @f.lib+'charset.alias'
|
||||||
# Many formulae symlink this file, but it is not strictly needed
|
# Many formulae symlink this file, but it is not strictly needed
|
||||||
path.unlink unless @f.skip_clean? path
|
path.unlink
|
||||||
elsif not path.symlink?
|
else
|
||||||
# Fix permissions
|
clean_file_permissions(path)
|
||||||
clean_file_permissions(path) unless @f.skip_clean? path
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user