Apply suggestions from code review
This commit is contained in:
parent
1ae21d2731
commit
ad1500ad60
@ -62,7 +62,7 @@ module Homebrew
|
|||||||
# @api private
|
# @api private
|
||||||
sig { returns(Pathname) }
|
sig { returns(Pathname) }
|
||||||
def self.gh_executable
|
def self.gh_executable
|
||||||
# NOTE: We disable HOMEBREW_NO_VERIFY_ATTESTATIONS when installing `gh` itself,
|
# NOTE: We set HOMEBREW_NO_VERIFY_ATTESTATIONS when installing `gh` itself,
|
||||||
# to prevent a cycle during bootstrapping. This can eventually be resolved
|
# to prevent a cycle during bootstrapping. This can eventually be resolved
|
||||||
# by vendoring a pure-Ruby Sigstore verifier client.
|
# by vendoring a pure-Ruby Sigstore verifier client.
|
||||||
@gh_executable ||= T.let(with_env(HOMEBREW_NO_VERIFY_ATTESTATIONS: "1") do
|
@gh_executable ||= T.let(with_env(HOMEBREW_NO_VERIFY_ATTESTATIONS: "1") do
|
||||||
@ -111,7 +111,7 @@ module Homebrew
|
|||||||
.stdout.match(/\d+(?:\.\d+)+/i).to_s)
|
.stdout.match(/\d+(?:\.\d+)+/i).to_s)
|
||||||
if gh_version < GH_ATTESTATION_MIN_VERSION
|
if gh_version < GH_ATTESTATION_MIN_VERSION
|
||||||
raise e,
|
raise e,
|
||||||
"#{gh_executable} is too old, you must upgrade it to continue."
|
"#{gh_executable} is too old, you must upgrade it to continue"
|
||||||
end
|
end
|
||||||
|
|
||||||
raise InvalidAttestationError, "attestation verification failed: #{e}"
|
raise InvalidAttestationError, "attestation verification failed: #{e}"
|
||||||
|
|||||||
@ -77,7 +77,7 @@ RSpec.describe Homebrew::Attestation do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "::check_attestation (with old gh)" do
|
describe "::check_attestation fails with old gh" do
|
||||||
before do
|
before do
|
||||||
allow(described_class).to receive(:gh_executable)
|
allow(described_class).to receive(:gh_executable)
|
||||||
.and_return(fake_old_gh)
|
.and_return(fake_old_gh)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user