Fix Cask::Cask.all bug

We were only loading casks from files with this command which,
of course, didn't work for casks that can only be loaded from
the API (when the core cask tap is not tapped). This changes
things to align more with what we do for formulae.
This commit is contained in:
apainintheneck 2023-12-21 21:39:58 -08:00
parent d1625b6e3d
commit 5a674c232f

View File

@ -30,8 +30,11 @@ module Cask
raise ArgumentError, "Cask::Cask#all cannot be used without --eval-all or HOMEBREW_EVAL_ALL"
end
Tap.flat_map(&:cask_files).map do |f|
CaskLoader::FromTapPathLoader.new(f).load(config: nil)
# Load core casks from tokens so they load from the API when the core cask is not tapped.
tokens_and_files = CoreCaskTap.instance.cask_tokens
tokens_and_files += Tap.reject(&:core_cask_tap?).flat_map(&:cask_files)
tokens_and_files.map do |token_or_file|
CaskLoader.load(token_or_file)
rescue CaskUnreadableError => e
opoo e.message