dev-cmd/bump-cask-pr: use FromContentLoader when relevant.

When loading from `tmp_contents` in `bump-cask-pr` we're always loading
from the contents and not from a e.g. filename etc. As a result, skip
the detection of the correct loader (as the regex can be a bit flaky)
and instead use `FromContentLoader` directly.
This commit is contained in:
Mike McQuaid 2024-04-08 13:25:59 +01:00
parent 138b7b2e4b
commit 27f47bafbc
No known key found for this signature in database

View File

@ -215,7 +215,8 @@ module Homebrew
read_only_run: true, read_only_run: true,
silent: true) silent: true)
tmp_cask = Cask::CaskLoader.load(tmp_contents) tmp_cask = Cask::CaskLoader::FromContentLoader.new(tmp_contents)
.load(config: nil)
old_hash = tmp_cask.sha256 old_hash = tmp_cask.sha256
if tmp_cask.version.latest? || new_hash == :no_check if tmp_cask.version.latest? || new_hash == :no_check
opoo "Ignoring specified `--sha256=` argument." if new_hash.is_a?(String) opoo "Ignoring specified `--sha256=` argument." if new_hash.is_a?(String)