cleaner: simplify verbose pathname extension
This commit is contained in:
parent
43a8e896e8
commit
56fa23e07e
@ -64,7 +64,7 @@ class Cleaner
|
|||||||
# Clean a single folder (non-recursively)
|
# Clean a single folder (non-recursively)
|
||||||
def clean_dir d
|
def clean_dir d
|
||||||
d.find do |path|
|
d.find do |path|
|
||||||
path.extend(NoiseyPathname) if ARGV.verbose?
|
path.extend(NoisyPathname) if ARGV.verbose?
|
||||||
|
|
||||||
if path.directory?
|
if path.directory?
|
||||||
# Stop cleaning this subtree if protected
|
# Stop cleaning this subtree if protected
|
||||||
@ -87,14 +87,9 @@ class Cleaner
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module NoisyPathname
|
||||||
class Pathname
|
|
||||||
alias_method :orig_unlink, :unlink
|
|
||||||
end
|
|
||||||
|
|
||||||
module NoiseyPathname
|
|
||||||
def unlink
|
def unlink
|
||||||
puts "rm: #{self}"
|
puts "rm: #{self}"
|
||||||
orig_unlink
|
super
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user