Skip to content

Commit

Permalink
Remove Formulary::tap_paths again.
Browse files Browse the repository at this point in the history
  • Loading branch information
reitermarkus committed Feb 8, 2024
1 parent 3194c29 commit 2be867c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
19 changes: 12 additions & 7 deletions Library/Homebrew/diagnostic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -835,16 +835,21 @@ def check_deleted_formula
kegs = Keg.all

deleted_formulae = kegs.map do |keg|
next if Formulary.tap_paths(keg.name).any?
tap = Tab.for_keg(keg).tap

loadable = [
Formulary::FromAPILoader,
Formulary::FromNameLoader,
].any? do |loader_class|
if (loader = loader_class.try_new(keg.name, warn: false))
# If we know the tap, ignore all other taps.
next tap && loader.tap != tap
end

unless EnvConfig.no_install_from_api?
# Formulae installed from the API should not count as deleted formulae
# but may not have a tap listed in their tab
tap = Tab.for_keg(keg).tap
next if (tap.blank? || tap.core_tap?) && Homebrew::API::Formula.all_formulae.key?(keg.name)
false
end

keg.name
keg.name unless loadable
end.compact.uniq

return if deleted_formulae.blank?
Expand Down
12 changes: 0 additions & 12 deletions Library/Homebrew/formulary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1167,18 +1167,6 @@ def self.core_path(name)
find_formula_in_tap(name.to_s.downcase, CoreTap.instance)
end

def self.tap_paths(name)
name = name.to_s.downcase
Tap.map do |tap|
formula_path = find_formula_in_tap(name, tap)

alias_path = tap.alias_dir/name
next alias_path if !formula_path.exist? && alias_path.exist?

formula_path
end.select(&:file?)
end

sig { params(name: String, tap: Tap).returns(Pathname) }
def self.find_formula_in_tap(name, tap)
filename = if name.end_with?(".rb")
Expand Down

0 comments on commit 2be867c

Please sign in to comment.