2025-08-12 02:38:16 -04:00
|
|
|
# typed: strict
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require "pkg_version"
|
|
|
|
|
|
|
|
module Homebrew
|
|
|
|
# A stub for a formula, with only the information needed to fetch the bottle manifest.
|
|
|
|
class FormulaStub < T::Struct
|
|
|
|
const :name, String
|
|
|
|
const :pkg_version, PkgVersion
|
|
|
|
const :rebuild, Integer, default: 0
|
|
|
|
const :sha256, T.nilable(String)
|
2025-08-26 17:02:57 -04:00
|
|
|
const :aliases, T::Array[String], default: []
|
|
|
|
const :oldnames, T::Array[String], default: []
|
2025-08-12 02:38:16 -04:00
|
|
|
|
|
|
|
sig { returns(Version) }
|
|
|
|
def version
|
|
|
|
pkg_version.version
|
|
|
|
end
|
|
|
|
|
|
|
|
sig { returns(Integer) }
|
|
|
|
def revision
|
|
|
|
pkg_version.revision
|
|
|
|
end
|
|
|
|
|
|
|
|
sig { params(other: T.anything).returns(T::Boolean) }
|
|
|
|
def ==(other)
|
|
|
|
case other
|
|
|
|
when FormulaStub
|
2025-08-26 17:02:57 -04:00
|
|
|
name == other.name &&
|
|
|
|
pkg_version == other.pkg_version &&
|
|
|
|
rebuild == other.rebuild &&
|
|
|
|
sha256 == other.sha256 &&
|
|
|
|
aliases == other.aliases &&
|
|
|
|
oldnames == other.oldnames
|
2025-08-12 02:38:16 -04:00
|
|
|
else
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|