Merge pull request #13403 from apainintheneck/update-report-all
Fix bug in brew update when displaying all formulae
This commit is contained in:
commit
7f2220a57f
@ -540,30 +540,30 @@ class ReporterHub
|
|||||||
delegate empty?: :@hash
|
delegate empty?: :@hash
|
||||||
|
|
||||||
def dump(updated_formula_report: true)
|
def dump(updated_formula_report: true)
|
||||||
# Key Legend: Added (A), Copied (C), Deleted (D), Modified (M), Renamed (R)
|
report_all = Homebrew::EnvConfig.update_report_all_formulae?
|
||||||
|
|
||||||
unless Homebrew::EnvConfig.update_report_all_formulae?
|
if report_all
|
||||||
dump_formula_or_cask_report :A, "New Formulae"
|
dump_new_formula_report
|
||||||
dump_formula_or_cask_report :AC, "New Casks"
|
dump_new_cask_report
|
||||||
dump_formula_or_cask_report :R, "Renamed Formulae"
|
dump_renamed_formula_report
|
||||||
end
|
end
|
||||||
|
|
||||||
dump_formula_or_cask_report :D, "Deleted Formulae"
|
dump_deleted_formula_report(report_all)
|
||||||
dump_formula_or_cask_report :DC, "Deleted Casks"
|
dump_deleted_cask_report(report_all)
|
||||||
|
|
||||||
outdated_formulae = nil
|
outdated_formulae = nil
|
||||||
outdated_casks = nil
|
outdated_casks = nil
|
||||||
|
|
||||||
if updated_formula_report && Homebrew::EnvConfig.update_report_all_formulae?
|
if updated_formula_report && report_all
|
||||||
dump_formula_or_cask_report :M, "Modified Formulae"
|
dump_modified_formula_report
|
||||||
dump_formula_or_cask_report :MC, "Modified Casks"
|
dump_modified_cask_report
|
||||||
elsif updated_formula_report
|
elsif updated_formula_report
|
||||||
outdated_formulae = Formula.installed.select(&:outdated?).map(&:name)
|
outdated_formulae = Formula.installed.select(&:outdated?).map(&:name)
|
||||||
output_dump_formula_or_cask_report "Outdated Formulae", outdated_formulae
|
output_dump_formula_or_cask_report "Outdated Formulae", outdated_formulae
|
||||||
|
|
||||||
outdated_casks = Cask::Caskroom.casks.select(&:outdated?).map(&:token)
|
outdated_casks = Cask::Caskroom.casks.select(&:outdated?).map(&:token)
|
||||||
output_dump_formula_or_cask_report "Outdated Casks", outdated_casks
|
output_dump_formula_or_cask_report "Outdated Casks", outdated_casks
|
||||||
elsif Homebrew::EnvConfig.update_report_all_formulae?
|
elsif report_all
|
||||||
if (changed_formulae = select_formula_or_cask(:M).count) && changed_formulae.positive?
|
if (changed_formulae = select_formula_or_cask(:M).count) && changed_formulae.positive?
|
||||||
ohai "Modified Formulae", "Modified #{changed_formulae} #{"formula".pluralize(changed_formulae)}."
|
ohai "Modified Formulae", "Modified #{changed_formulae} #{"formula".pluralize(changed_formulae)}."
|
||||||
end
|
end
|
||||||
@ -610,23 +610,75 @@ class ReporterHub
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def dump_formula_or_cask_report(key, title)
|
def dump_new_formula_report
|
||||||
report_all = Homebrew::EnvConfig.update_report_all_formulae?
|
formulae = select_formula_or_cask(:A).sort.map do |name|
|
||||||
|
name unless installed?(name)
|
||||||
|
end
|
||||||
|
|
||||||
formulae_or_casks = select_formula_or_cask(key).sort.map do |name, new_name|
|
output_dump_formula_or_cask_report "New Formulae", formulae
|
||||||
# Format list items of formulae
|
end
|
||||||
case key
|
|
||||||
when :R
|
def dump_new_cask_report
|
||||||
if report_all
|
casks = select_formula_or_cask(:AC).sort.map do |name|
|
||||||
|
name.split("/").last unless cask_installed?(name)
|
||||||
|
end
|
||||||
|
|
||||||
|
output_dump_formula_or_cask_report "New Casks", casks
|
||||||
|
end
|
||||||
|
|
||||||
|
def dump_renamed_formula_report
|
||||||
|
formulae = select_formula_or_cask(:R).sort.map do |name, new_name|
|
||||||
name = pretty_installed(name) if installed?(name)
|
name = pretty_installed(name) if installed?(name)
|
||||||
new_name = pretty_installed(new_name) if installed?(new_name)
|
new_name = pretty_installed(new_name) if installed?(new_name)
|
||||||
"#{name} -> #{new_name}"
|
"#{name} -> #{new_name}"
|
||||||
end
|
end
|
||||||
when :A
|
|
||||||
name if report_all && !installed?(name)
|
output_dump_formula_or_cask_report "Renamed Formulae", formulae
|
||||||
when :AC
|
end
|
||||||
name.split("/").last if report_all && !cask_installed?(name)
|
|
||||||
when :MC
|
def dump_deleted_formula_report(report_all)
|
||||||
|
formulae = select_formula_or_cask(:D).sort.map do |name|
|
||||||
|
if installed?(name)
|
||||||
|
pretty_uninstalled(name)
|
||||||
|
elsif report_all
|
||||||
|
name
|
||||||
|
end
|
||||||
|
end.compact
|
||||||
|
|
||||||
|
output_dump_formula_or_cask_report "Deleted Formulae", formulae
|
||||||
|
end
|
||||||
|
|
||||||
|
def dump_deleted_cask_report(report_all)
|
||||||
|
casks = select_formula_or_cask(:DC).sort.map do |name|
|
||||||
|
name = name.split("/").last
|
||||||
|
if cask_installed?(name)
|
||||||
|
pretty_uninstalled(name)
|
||||||
|
elsif report_all
|
||||||
|
name
|
||||||
|
end
|
||||||
|
end.compact
|
||||||
|
|
||||||
|
output_dump_formula_or_cask_report "Deleted Casks", casks
|
||||||
|
end
|
||||||
|
|
||||||
|
def dump_modified_formula_report
|
||||||
|
formulae = select_formula_or_cask(:M).sort.map do |name|
|
||||||
|
if installed?(name)
|
||||||
|
if outdated?(name)
|
||||||
|
pretty_outdated(name)
|
||||||
|
else
|
||||||
|
pretty_installed(name)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
name
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
output_dump_formula_or_cask_report "Modified Formulae", formulae
|
||||||
|
end
|
||||||
|
|
||||||
|
def dump_modified_cask_report
|
||||||
|
casks = select_formula_or_cask(:MC).sort.map do |name|
|
||||||
name = name.split("/").last
|
name = name.split("/").last
|
||||||
if cask_installed?(name)
|
if cask_installed?(name)
|
||||||
if cask_outdated?(name)
|
if cask_outdated?(name)
|
||||||
@ -634,38 +686,12 @@ class ReporterHub
|
|||||||
else
|
else
|
||||||
pretty_installed(name)
|
pretty_installed(name)
|
||||||
end
|
end
|
||||||
elsif report_all
|
|
||||||
name
|
|
||||||
end
|
|
||||||
when :DC
|
|
||||||
name = name.split("/").last
|
|
||||||
if cask_installed?(name)
|
|
||||||
pretty_uninstalled(name)
|
|
||||||
elsif report_all
|
|
||||||
name
|
|
||||||
end
|
|
||||||
when :M
|
|
||||||
if installed?(name)
|
|
||||||
if outdated?(name)
|
|
||||||
pretty_outdated(name)
|
|
||||||
else
|
else
|
||||||
pretty_installed(name)
|
|
||||||
end
|
|
||||||
elsif report_all
|
|
||||||
name
|
name
|
||||||
end
|
end
|
||||||
when :D
|
|
||||||
if installed?(name)
|
|
||||||
pretty_uninstalled(name)
|
|
||||||
elsif report_all
|
|
||||||
name
|
|
||||||
end
|
end
|
||||||
else
|
|
||||||
raise ArgumentError, ":#{key} passed to dump_formula_or_cask_report!"
|
|
||||||
end
|
|
||||||
end.compact
|
|
||||||
|
|
||||||
output_dump_formula_or_cask_report title, formulae_or_casks
|
output_dump_formula_or_cask_report "Modified Casks", casks
|
||||||
end
|
end
|
||||||
|
|
||||||
def output_dump_formula_or_cask_report(title, formulae_or_casks)
|
def output_dump_formula_or_cask_report(title, formulae_or_casks)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user