Add sigs to Formula boolean methods
This commit is contained in:
parent
cec3daf6be
commit
6d53c52d2c
@ -353,18 +353,21 @@ class Formula
|
|||||||
|
|
||||||
# Is the currently active {SoftwareSpec} a {#stable} build?
|
# Is the currently active {SoftwareSpec} a {#stable} build?
|
||||||
# @private
|
# @private
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def stable?
|
def stable?
|
||||||
active_spec == stable
|
active_spec == stable
|
||||||
end
|
end
|
||||||
|
|
||||||
# Is the currently active {SoftwareSpec} a {#head} build?
|
# Is the currently active {SoftwareSpec} a {#head} build?
|
||||||
# @private
|
# @private
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def head?
|
def head?
|
||||||
active_spec == head
|
active_spec == head
|
||||||
end
|
end
|
||||||
|
|
||||||
# Is this formula HEAD-only?
|
# Is this formula HEAD-only?
|
||||||
# @private
|
# @private
|
||||||
|
sig { returns(T.nilable(T::Boolean)) }
|
||||||
def head_only?
|
def head_only?
|
||||||
head && !stable
|
head && !stable
|
||||||
end
|
end
|
||||||
@ -573,12 +576,14 @@ class Formula
|
|||||||
# This is actually just a check for if the {#latest_installed_prefix} directory
|
# This is actually just a check for if the {#latest_installed_prefix} directory
|
||||||
# exists and is not empty.
|
# exists and is not empty.
|
||||||
# @private
|
# @private
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def latest_version_installed?
|
def latest_version_installed?
|
||||||
(dir = latest_installed_prefix).directory? && !dir.children.empty?
|
(dir = latest_installed_prefix).directory? && !dir.children.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
# If at least one version of {Formula} is installed.
|
# If at least one version of {Formula} is installed.
|
||||||
# @private
|
# @private
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def any_version_installed?
|
def any_version_installed?
|
||||||
installed_prefixes.any? { |keg| (keg/Tab::FILENAME).file? }
|
installed_prefixes.any? { |keg| (keg/Tab::FILENAME).file? }
|
||||||
end
|
end
|
||||||
@ -652,11 +657,13 @@ class Formula
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Is the formula linked?
|
# Is the formula linked?
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def linked?
|
def linked?
|
||||||
linked_keg.symlink?
|
linked_keg.symlink?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Is the formula linked to `opt`?
|
# Is the formula linked to `opt`?
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def optlinked?
|
def optlinked?
|
||||||
opt_prefix.symlink?
|
opt_prefix.symlink?
|
||||||
end
|
end
|
||||||
@ -1251,6 +1258,7 @@ class Formula
|
|||||||
# Rarely, you don't want your library symlinked into the main prefix.
|
# Rarely, you don't want your library symlinked into the main prefix.
|
||||||
# See `gettext.rb` for an example.
|
# See `gettext.rb` for an example.
|
||||||
# @see .keg_only
|
# @see .keg_only
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def keg_only?
|
def keg_only?
|
||||||
return false unless keg_only_reason
|
return false unless keg_only_reason
|
||||||
|
|
||||||
@ -1436,6 +1444,7 @@ class Formula
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { returns(T.nilable(T::Boolean)) }
|
||||||
def migration_needed?
|
def migration_needed?
|
||||||
!oldnames_to_migrate.empty? && !rack.exist?
|
!oldnames_to_migrate.empty? && !rack.exist?
|
||||||
end
|
end
|
||||||
@ -1477,6 +1486,7 @@ class Formula
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def new_formula_available?
|
def new_formula_available?
|
||||||
installed_alias_target_changed? && !latest_formula.latest_version_installed?
|
installed_alias_target_changed? && !latest_formula.latest_version_installed?
|
||||||
end
|
end
|
||||||
@ -1487,6 +1497,7 @@ class Formula
|
|||||||
|
|
||||||
# Has the target of the alias used to install this formula changed?
|
# Has the target of the alias used to install this formula changed?
|
||||||
# Returns false if the formula wasn't installed with an alias.
|
# Returns false if the formula wasn't installed with an alias.
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def installed_alias_target_changed?
|
def installed_alias_target_changed?
|
||||||
target = current_installed_alias_target
|
target = current_installed_alias_target
|
||||||
return false unless target
|
return false unless target
|
||||||
@ -1495,12 +1506,14 @@ class Formula
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Is this formula the target of an alias used to install an old formula?
|
# Is this formula the target of an alias used to install an old formula?
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def supersedes_an_installed_formula?
|
def supersedes_an_installed_formula?
|
||||||
old_installed_formulae.any?
|
old_installed_formulae.any?
|
||||||
end
|
end
|
||||||
|
|
||||||
# Has the alias used to install the formula changed, or are different
|
# Has the alias used to install the formula changed, or are different
|
||||||
# formulae already installed with this alias?
|
# formulae already installed with this alias?
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def alias_changed?
|
def alias_changed?
|
||||||
installed_alias_target_changed? || supersedes_an_installed_formula?
|
installed_alias_target_changed? || supersedes_an_installed_formula?
|
||||||
end
|
end
|
||||||
@ -1521,6 +1534,7 @@ class Formula
|
|||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
|
sig { params(fetch_head: T::Boolean).returns(T::Boolean) }
|
||||||
def outdated?(fetch_head: false)
|
def outdated?(fetch_head: false)
|
||||||
!outdated_kegs(fetch_head: fetch_head).empty?
|
!outdated_kegs(fetch_head: fetch_head).empty?
|
||||||
rescue Migrator::MigrationNeededError
|
rescue Migrator::MigrationNeededError
|
||||||
@ -2000,12 +2014,14 @@ class Formula
|
|||||||
|
|
||||||
# True if this formula is provided by Homebrew itself
|
# True if this formula is provided by Homebrew itself
|
||||||
# @private
|
# @private
|
||||||
|
sig { returns(T.nilable(T::Boolean)) }
|
||||||
def core_formula?
|
def core_formula?
|
||||||
tap&.core_tap?
|
tap&.core_tap?
|
||||||
end
|
end
|
||||||
|
|
||||||
# True if this formula is provided by external Tap
|
# True if this formula is provided by external Tap
|
||||||
# @private
|
# @private
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def tap?
|
def tap?
|
||||||
return false unless tap
|
return false unless tap
|
||||||
|
|
||||||
@ -2015,6 +2031,7 @@ class Formula
|
|||||||
# True if this formula can be installed on this platform
|
# True if this formula can be installed on this platform
|
||||||
# Redefined in extend/os.
|
# Redefined in extend/os.
|
||||||
# @private
|
# @private
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def valid_platform?
|
def valid_platform?
|
||||||
requirements.none?(MacOSRequirement) && requirements.none?(LinuxRequirement)
|
requirements.none?(MacOSRequirement) && requirements.none?(LinuxRequirement)
|
||||||
end
|
end
|
||||||
@ -2967,6 +2984,7 @@ class Formula
|
|||||||
# Whether a livecheck specification is defined or not.
|
# Whether a livecheck specification is defined or not.
|
||||||
# It returns true when a livecheck block is present in the {Formula} and
|
# It returns true when a livecheck block is present in the {Formula} and
|
||||||
# false otherwise, and is used by livecheck.
|
# false otherwise, and is used by livecheck.
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def livecheckable?
|
def livecheckable?
|
||||||
@livecheckable == true
|
@livecheckable == true
|
||||||
end
|
end
|
||||||
@ -2974,6 +2992,7 @@ class Formula
|
|||||||
# Whether a service specification is defined or not.
|
# Whether a service specification is defined or not.
|
||||||
# It returns true when a service block is present in the {Formula} and
|
# It returns true when a service block is present in the {Formula} and
|
||||||
# false otherwise, and is used by service.
|
# false otherwise, and is used by service.
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def service?
|
def service?
|
||||||
@service_block.present?
|
@service_block.present?
|
||||||
end
|
end
|
||||||
@ -3533,8 +3552,8 @@ class Formula
|
|||||||
|
|
||||||
# Whether this {Formula} is deprecated (i.e. warns on installation).
|
# Whether this {Formula} is deprecated (i.e. warns on installation).
|
||||||
# Defaults to false.
|
# Defaults to false.
|
||||||
# @return [Boolean]
|
|
||||||
# @see .deprecate!
|
# @see .deprecate!
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def deprecated?
|
def deprecated?
|
||||||
@deprecated == true
|
@deprecated == true
|
||||||
end
|
end
|
||||||
@ -3573,8 +3592,8 @@ class Formula
|
|||||||
|
|
||||||
# Whether this {Formula} is disabled (i.e. cannot be installed).
|
# Whether this {Formula} is disabled (i.e. cannot be installed).
|
||||||
# Defaults to false.
|
# Defaults to false.
|
||||||
# @return [Boolean]
|
|
||||||
# @see .disable!
|
# @see .disable!
|
||||||
|
sig { returns(T::Boolean) }
|
||||||
def disabled?
|
def disabled?
|
||||||
@disabled == true
|
@disabled == true
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user