Pass args in update-report instead of using global args.

This commit is contained in:
Markus Reiter 2020-07-26 09:45:18 +02:00
parent e14506e589
commit 919adcc216

View File

@ -104,7 +104,7 @@ module Homebrew
end end
if reporter.updated? if reporter.updated?
updated_taps << tap.name updated_taps << tap.name
hub.add(reporter) hub.add(reporter, preinstall: args.preinstall?)
end end
end end
@ -186,7 +186,7 @@ class Reporter
raise ReporterRevisionUnsetError, current_revision_var if @current_revision.empty? raise ReporterRevisionUnsetError, current_revision_var if @current_revision.empty?
end end
def report def report(preinstall: false)
return @report if @report return @report if @report
@report = Hash.new { |h, k| h[k] = [] } @report = Hash.new { |h, k| h[k] = [] }
@ -223,7 +223,7 @@ class Reporter
name = tap.formula_file_to_name(src) name = tap.formula_file_to_name(src)
# Skip reporting updated formulae to speed up automatic updates. # Skip reporting updated formulae to speed up automatic updates.
if Homebrew.args.preinstall? if preinstall
@report[:M] << name @report[:M] << name
next next
end end
@ -425,9 +425,9 @@ class ReporterHub
@hash.fetch(key, []) @hash.fetch(key, [])
end end
def add(reporter) def add(reporter, preinstall: false)
@reporters << reporter @reporters << reporter
report = reporter.report.delete_if { |_k, v| v.empty? } report = reporter.report(preinstall: preinstall).delete_if { |_k, v| v.empty? }
@hash.update(report) { |_key, oldval, newval| oldval.concat(newval) } @hash.update(report) { |_key, oldval, newval| oldval.concat(newval) }
end end