mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
no_autobump!
: suggestions from contributors and docs
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com> Signed-off-by: botantony <antonsm21@gmail.com>
This commit is contained in:
parent
79cf39fc1d
commit
a10b635fe9
@ -105,7 +105,6 @@ module Cask
|
|||||||
:livecheckable?, # TODO: remove once `#livecheckable?` is removed
|
:livecheckable?, # TODO: remove once `#livecheckable?` is removed
|
||||||
:no_autobump!,
|
:no_autobump!,
|
||||||
:autobump?,
|
:autobump?,
|
||||||
:no_autobump_defined?,
|
|
||||||
:no_autobump_message,
|
:no_autobump_message,
|
||||||
:on_system_blocks_exist?,
|
:on_system_blocks_exist?,
|
||||||
:on_system_block_min_os,
|
:on_system_block_min_os,
|
||||||
@ -547,8 +546,15 @@ module Cask
|
|||||||
@livecheck_defined == true
|
@livecheck_defined == true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Excludes the cask from autobump list.
|
||||||
|
#
|
||||||
|
# TODO: limit this method to the official taps only (f.e. raise
|
||||||
|
# an error if `!tap.official?`)
|
||||||
|
#
|
||||||
|
# @api public
|
||||||
|
sig { params(because: T.any(String, Symbol)).void }
|
||||||
def no_autobump!(because:)
|
def no_autobump!(because:)
|
||||||
if !because.is_a?(String) && (!because.is_a?(Symbol) || !NO_AUTOBUMP_REASONS_LIST.key?(because))
|
if because.is_a?(Symbol) && !NO_AUTOBUMP_REASONS_LIST.key?(because)
|
||||||
raise ArgumentError, "'because' argument should use valid symbol or a string!"
|
raise ArgumentError, "'because' argument should use valid symbol or a string!"
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -557,16 +563,16 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
@no_autobump_defined = true
|
@no_autobump_defined = true
|
||||||
# TODO: add symbol support when a list of common reasons is ready.
|
@no_autobump_message = because
|
||||||
# At this moment just convert symbols to a string
|
|
||||||
@no_autobump_message = because.to_s
|
|
||||||
@autobump = false
|
@autobump = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Is the cask in autobump list?
|
||||||
def autobump?
|
def autobump?
|
||||||
@autobump == true
|
@autobump == true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Is no_autobump! method defined?
|
||||||
def no_autobump_defined?
|
def no_autobump_defined?
|
||||||
@no_autobump_defined == true
|
@no_autobump_defined == true
|
||||||
end
|
end
|
||||||
|
@ -214,7 +214,11 @@ class Formula
|
|||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
attr_accessor :follow_installed_alias
|
attr_accessor :follow_installed_alias
|
||||||
|
|
||||||
sig { returns(T.nilable(String)) }
|
# Message that explains why the formula was excluded from autobump list.
|
||||||
|
# Returns `nil` if no message is specified.
|
||||||
|
#
|
||||||
|
# @see .no_autobump!
|
||||||
|
sig { returns(T.nilable(T.any(String, Symbol))) }
|
||||||
attr_reader :no_autobump_message
|
attr_reader :no_autobump_message
|
||||||
|
|
||||||
alias follow_installed_alias? follow_installed_alias
|
alias follow_installed_alias? follow_installed_alias
|
||||||
@ -247,7 +251,7 @@ class Formula
|
|||||||
@stable = T.let(nil, T.nilable(SoftwareSpec))
|
@stable = T.let(nil, T.nilable(SoftwareSpec))
|
||||||
|
|
||||||
@autobump = T.let(true, T::Boolean)
|
@autobump = T.let(true, T::Boolean)
|
||||||
@no_autobump_message = T.let(nil, T.nilable(String))
|
@no_autobump_message = T.let(nil, T.nilable(T.any(String, Symbol)))
|
||||||
|
|
||||||
@force_bottle = T.let(force_bottle, T::Boolean)
|
@force_bottle = T.let(force_bottle, T::Boolean)
|
||||||
|
|
||||||
@ -481,10 +485,19 @@ class Formula
|
|||||||
# @see .livecheckable?
|
# @see .livecheckable?
|
||||||
delegate livecheckable?: :"self.class"
|
delegate livecheckable?: :"self.class"
|
||||||
|
|
||||||
|
# Exclude the formula from autobump list.
|
||||||
|
# @!method no_autobump!
|
||||||
|
# @see .no_autobump!
|
||||||
delegate no_autobump!: :"self.class"
|
delegate no_autobump!: :"self.class"
|
||||||
|
|
||||||
|
# Is the formula in autobump list?
|
||||||
|
# @!method autobump?
|
||||||
|
# @see .autobump?
|
||||||
delegate autobump?: :"self.class"
|
delegate autobump?: :"self.class"
|
||||||
|
|
||||||
|
# Is no_autobump! method defined?
|
||||||
|
# @!method no_autobump_defined?
|
||||||
|
# @see .no_autobump_defined?
|
||||||
delegate no_autobump_defined?: :"self.class"
|
delegate no_autobump_defined?: :"self.class"
|
||||||
|
|
||||||
delegate no_autobump_message: :"self.class"
|
delegate no_autobump_message: :"self.class"
|
||||||
@ -4202,27 +4215,36 @@ class Formula
|
|||||||
|
|
||||||
# Method that excludes the formula from the autobump list.
|
# Method that excludes the formula from the autobump list.
|
||||||
#
|
#
|
||||||
|
# TODO: limit this method to the official taps only (f.e. raise
|
||||||
|
# an error if `!tap.official?`)
|
||||||
|
#
|
||||||
# @api public
|
# @api public
|
||||||
sig { params(because: T.any(String, Symbol)).returns(T.untyped) }
|
sig { params(because: T.any(String, Symbol)).void }
|
||||||
def no_autobump!(because:)
|
def no_autobump!(because:)
|
||||||
if because.is_a?(Symbol) && !NO_AUTOBUMP_REASONS_LIST.key?(because)
|
if because.is_a?(Symbol) && !NO_AUTOBUMP_REASONS_LIST.key?(because)
|
||||||
raise ArgumentError, "'because' argument should use valid symbol or a string!"
|
raise ArgumentError, "'because' argument should use valid symbol or a string!"
|
||||||
end
|
end
|
||||||
|
|
||||||
@no_autobump_defined = T.let(true, T.nilable(T::Boolean))
|
@no_autobump_defined = T.let(true, T.nilable(T::Boolean))
|
||||||
@no_autobump_message = T.let(because.to_s, T.nilable(String))
|
@no_autobump_message = T.let(because, T.nilable(T.any(String, Symbol)))
|
||||||
@autobump = T.let(false, T.nilable(T::Boolean))
|
@autobump = T.let(false, T.nilable(T::Boolean))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Is the formula in autobump list?
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def autobump?
|
def autobump?
|
||||||
@autobump != false # @autobump may be `nil`
|
@autobump != false # @autobump may be `nil`
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Is no_autobump! method defined?
|
||||||
sig { returns(T::Boolean) }
|
sig { returns(T::Boolean) }
|
||||||
def no_autobump_defined? = @no_autobump_defined == true
|
def no_autobump_defined? = @no_autobump_defined == true
|
||||||
|
|
||||||
sig { returns(T.nilable(String)) }
|
# Message that explains why the formula was excluded from autobump list.
|
||||||
|
# Returns `nil` if no message is specified.
|
||||||
|
#
|
||||||
|
# @see .no_autobump!
|
||||||
|
sig { returns(T.nilable(T.any(String, Symbol))) }
|
||||||
attr_reader :no_autobump_message
|
attr_reader :no_autobump_message
|
||||||
|
|
||||||
# Service can be used to define services.
|
# Service can be used to define services.
|
||||||
|
@ -291,8 +291,8 @@ module Formulary
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if (no_autobump_msg = json_formula["no_autobump_msg"])
|
if (because = json_formula["no_autobump_msg"])
|
||||||
no_autobump! because: no_autobump_msg
|
no_autobump!(because:)
|
||||||
end
|
end
|
||||||
|
|
||||||
bottles_stable = json_formula["bottle"]["stable"].presence
|
bottles_stable = json_formula["bottle"]["stable"].presence
|
||||||
|
@ -20,6 +20,8 @@ class Tap
|
|||||||
private_constant :HOMEBREW_TAP_FORMULA_RENAMES_FILE
|
private_constant :HOMEBREW_TAP_FORMULA_RENAMES_FILE
|
||||||
HOMEBREW_TAP_MIGRATIONS_FILE = "tap_migrations.json"
|
HOMEBREW_TAP_MIGRATIONS_FILE = "tap_migrations.json"
|
||||||
private_constant :HOMEBREW_TAP_MIGRATIONS_FILE
|
private_constant :HOMEBREW_TAP_MIGRATIONS_FILE
|
||||||
|
HOMEBREW_TAP_AUTOBUMP_FILE = ".github/autobump.txt"
|
||||||
|
private_constant :HOMEBREW_TAP_AUTOBUMP_FILE
|
||||||
HOMEBREW_TAP_PYPI_FORMULA_MAPPINGS_FILE = "pypi_formula_mappings.json"
|
HOMEBREW_TAP_PYPI_FORMULA_MAPPINGS_FILE = "pypi_formula_mappings.json"
|
||||||
private_constant :HOMEBREW_TAP_PYPI_FORMULA_MAPPINGS_FILE
|
private_constant :HOMEBREW_TAP_PYPI_FORMULA_MAPPINGS_FILE
|
||||||
HOMEBREW_TAP_SYNCED_VERSIONS_FORMULAE_FILE = "synced_versions_formulae.json"
|
HOMEBREW_TAP_SYNCED_VERSIONS_FORMULAE_FILE = "synced_versions_formulae.json"
|
||||||
@ -983,11 +985,6 @@ class Tap
|
|||||||
# Array with autobump names
|
# Array with autobump names
|
||||||
sig { returns(T::Array[String]) }
|
sig { returns(T::Array[String]) }
|
||||||
def autobump
|
def autobump
|
||||||
unless official?
|
|
||||||
@autobump ||= []
|
|
||||||
return @autobump
|
|
||||||
end
|
|
||||||
|
|
||||||
@autobump ||= if core_cask_tap?
|
@autobump ||= if core_cask_tap?
|
||||||
Homebrew::API::Cask.all_casks.select do |_, cask|
|
Homebrew::API::Cask.all_casks.select do |_, cask|
|
||||||
cask["autobump"] == true && !cask["skip_livecheck"]
|
cask["autobump"] == true && !cask["skip_livecheck"]
|
||||||
@ -997,6 +994,16 @@ class Tap
|
|||||||
formula["autobump"] == true && !formula["skip_livecheck"]
|
formula["autobump"] == true && !formula["skip_livecheck"]
|
||||||
end.keys
|
end.keys
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if @autobump.empty?
|
||||||
|
@autobump = if (autobump_file = path/HOMEBREW_TAP_AUTOBUMP_FILE).file?
|
||||||
|
autobump_file.readlines(chomp: true)
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@autobump
|
||||||
end
|
end
|
||||||
|
|
||||||
# Whether this {Tap} allows running bump commands on the given {Formula} or {Cask}.
|
# Whether this {Tap} allows running bump commands on the given {Formula} or {Cask}.
|
||||||
|
@ -54,6 +54,7 @@ module Homebrew
|
|||||||
check_formula_list_directory "audit_exceptions", @tap_audit_exceptions
|
check_formula_list_directory "audit_exceptions", @tap_audit_exceptions
|
||||||
check_formula_list_directory "style_exceptions", @tap_style_exceptions
|
check_formula_list_directory "style_exceptions", @tap_style_exceptions
|
||||||
check_formula_list "pypi_formula_mappings", @tap_pypi_formula_mappings
|
check_formula_list "pypi_formula_mappings", @tap_pypi_formula_mappings
|
||||||
|
check_formula_list ".github/autobump.txt", @tap_autobump
|
||||||
check_formula_list "formula_renames", @formula_renames.values
|
check_formula_list "formula_renames", @formula_renames.values
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user