Ensure that the gh
formula is sufficiently new
This commit is contained in:
parent
8839ccfe72
commit
6db608f43f
@ -74,6 +74,10 @@ module Homebrew
|
|||||||
gh_version = Version.new(system_command!(@gh_executable, args: ["--version"], print_stderr: false)
|
gh_version = Version.new(system_command!(@gh_executable, args: ["--version"], print_stderr: false)
|
||||||
.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
|
||||||
|
if Formula["gh"].version < GH_ATTESTATION_MIN_VERSION
|
||||||
|
raise "#{@gh_executable} is too old, you must upgrade it to >=#{GH_ATTESTATION_MIN_VERSION} to continue"
|
||||||
|
end
|
||||||
|
|
||||||
@gh_executable = ensure_formula_installed!("gh", latest: true,
|
@gh_executable = ensure_formula_installed!("gh", latest: true,
|
||||||
reason: "verifying attestations").opt_bin/"gh"
|
reason: "verifying attestations").opt_bin/"gh"
|
||||||
end
|
end
|
||||||
|
@ -70,6 +70,10 @@ RSpec.describe Homebrew::Attestation do
|
|||||||
|
|
||||||
describe "::gh_executable" do
|
describe "::gh_executable" do
|
||||||
before do
|
before do
|
||||||
|
allow(Formulary).to receive(:factory)
|
||||||
|
.with("gh")
|
||||||
|
.and_return(instance_double(Formula, version: Version.new("2.49.0")))
|
||||||
|
|
||||||
allow(described_class).to receive(:system_command!)
|
allow(described_class).to receive(:system_command!)
|
||||||
.with(fake_old_gh, args: ["--version"], print_stderr: false)
|
.with(fake_old_gh, args: ["--version"], print_stderr: false)
|
||||||
.and_return(fake_old_gh_version)
|
.and_return(fake_old_gh_version)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user