mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Pass debug?
and verbose?
to Cleaner
.
This commit is contained in:
parent
26688145f0
commit
add10377b8
@ -10,9 +10,15 @@
|
||||
# * sets permissions on executables
|
||||
# * removes unresolved symlinks
|
||||
class Cleaner
|
||||
extend Predicable
|
||||
|
||||
attr_predicate :verbose?, :debug?
|
||||
|
||||
# Create a cleaner for the given formula
|
||||
def initialize(f)
|
||||
def initialize(f, verbose: false, debug: false)
|
||||
@f = f
|
||||
@verbose = verbose
|
||||
@debug = debug
|
||||
end
|
||||
|
||||
# Clean the keg of formula @f
|
||||
@ -58,7 +64,7 @@ class Cleaner
|
||||
# actual files gets removed correctly.
|
||||
dirs.reverse_each do |d|
|
||||
if d.children.empty?
|
||||
puts "rmdir: #{d} (empty)" if Homebrew.args.verbose?
|
||||
puts "rmdir: #{d} (empty)" if verbose?
|
||||
d.rmdir
|
||||
end
|
||||
end
|
||||
@ -109,7 +115,7 @@ class Cleaner
|
||||
else
|
||||
0444
|
||||
end
|
||||
if Homebrew.args.debug?
|
||||
if debug?
|
||||
old_perms = path.stat.mode & 0777
|
||||
odebug "Fixing #{path} permissions from #{old_perms.to_s(8)} to #{perms.to_s(8)}" if perms != old_perms
|
||||
end
|
||||
|
@ -956,7 +956,7 @@ class FormulaInstaller
|
||||
|
||||
def clean
|
||||
ohai "Cleaning" if verbose?
|
||||
Cleaner.new(formula).clean
|
||||
Cleaner.new(formula, verbose: verbose?, debug: debug?).clean
|
||||
rescue Exception => e # rubocop:disable Lint/RescueException
|
||||
opoo "The cleaning step did not complete successfully"
|
||||
puts "Still, the installation was successful, so we will link it into your prefix"
|
||||
|
Loading…
x
Reference in New Issue
Block a user