| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  | # typed: strict | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | module Homebrew | 
					
						
							|  |  |  |   module Livecheck | 
					
						
							|  |  |  |     # The `Livecheck::SkipConditions` module primarily contains methods that | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |     # check for various formula/cask/resource conditions where a check should be skipped. | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |     module SkipConditions | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       sig { | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         params( | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |           package_or_resource: T.any(Formula, Cask::Cask, Resource), | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |           livecheck_defined:   T::Boolean, | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |           full_name:           T::Boolean, | 
					
						
							|  |  |  |           verbose:             T::Boolean, | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |         ).returns(T::Hash[Symbol, T.untyped]) | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2024-08-23 03:15:57 +01:00
										 |  |  |       private_class_method def self.package_or_resource_skip( | 
					
						
							|  |  |  |         package_or_resource, | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |         livecheck_defined, | 
					
						
							| 
									
										
										
										
											2024-08-23 03:15:57 +01:00
										 |  |  |         full_name: false, | 
					
						
							|  |  |  |         verbose: false | 
					
						
							|  |  |  |       ) | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |         formula = package_or_resource if package_or_resource.is_a?(Formula) | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-12 18:33:37 +05:30
										 |  |  |         if (stable_url = formula&.stable&.url) | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |           stable_is_gist = stable_url.match?(%r{https?://gist\.github(?:usercontent)?\.com/}i) | 
					
						
							|  |  |  |           stable_from_google_code_archive = stable_url.match?( | 
					
						
							|  |  |  |             %r{https?://storage\.googleapis\.com/google-code-archive-downloads/}i, | 
					
						
							|  |  |  |           ) | 
					
						
							|  |  |  |           stable_from_internet_archive = stable_url.match?(%r{https?://web\.archive\.org/}i) | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-25 02:06:23 +02:00
										 |  |  |         skip_message = if package_or_resource.livecheck.skip_msg.present? | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |           package_or_resource.livecheck.skip_msg | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |         elsif !livecheck_defined | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |           if stable_from_google_code_archive | 
					
						
							|  |  |  |             "Stable URL is from Google Code Archive" | 
					
						
							|  |  |  |           elsif stable_from_internet_archive | 
					
						
							|  |  |  |             "Stable URL is from Internet Archive" | 
					
						
							|  |  |  |           elsif stable_is_gist | 
					
						
							|  |  |  |             "Stable URL is a GitHub Gist" | 
					
						
							|  |  |  |           end | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-25 02:06:23 +02:00
										 |  |  |         return {} if !package_or_resource.livecheck.skip? && skip_message.blank? | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |         skip_messages = skip_message ? [skip_message] : nil | 
					
						
							| 
									
										
										
										
											2024-03-07 16:20:20 +00:00
										 |  |  |         Livecheck.status_hash(package_or_resource, "skipped", skip_messages, full_name:, verbose:) | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       sig { | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         params( | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |           formula:            Formula, | 
					
						
							|  |  |  |           _livecheck_defined: T::Boolean, | 
					
						
							|  |  |  |           full_name:          T::Boolean, | 
					
						
							|  |  |  |           verbose:            T::Boolean, | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |         ).returns(T::Hash[Symbol, T.untyped]) | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       } | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |       private_class_method def self.formula_head_only(formula, _livecheck_defined, full_name: false, verbose: false) | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         return {} if !formula.head_only? || formula.any_version_installed? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         Livecheck.status_hash( | 
					
						
							|  |  |  |           formula, | 
					
						
							|  |  |  |           "error", | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |           ["HEAD only formula must be installed to be checkable"], | 
					
						
							| 
									
										
										
										
											2024-03-07 16:20:20 +00:00
										 |  |  |           full_name:, | 
					
						
							|  |  |  |           verbose:, | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         ) | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       sig { | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         params( | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |           formula:           Formula, | 
					
						
							|  |  |  |           livecheck_defined: T::Boolean, | 
					
						
							|  |  |  |           full_name:         T::Boolean, | 
					
						
							|  |  |  |           verbose:           T::Boolean, | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |         ).returns(T::Hash[Symbol, T.untyped]) | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       } | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |       private_class_method def self.formula_deprecated(formula, livecheck_defined, full_name: false, verbose: false) | 
					
						
							|  |  |  |         return {} if !formula.deprecated? || livecheck_defined | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-07 16:20:20 +00:00
										 |  |  |         Livecheck.status_hash(formula, "deprecated", full_name:, verbose:) | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       sig { | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         params( | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |           formula:           Formula, | 
					
						
							|  |  |  |           livecheck_defined: T::Boolean, | 
					
						
							|  |  |  |           full_name:         T::Boolean, | 
					
						
							|  |  |  |           verbose:           T::Boolean, | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |         ).returns(T::Hash[Symbol, T.untyped]) | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       } | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |       private_class_method def self.formula_disabled(formula, livecheck_defined, full_name: false, verbose: false) | 
					
						
							|  |  |  |         return {} if !formula.disabled? || livecheck_defined | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-07 16:20:20 +00:00
										 |  |  |         Livecheck.status_hash(formula, "disabled", full_name:, verbose:) | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       sig { | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         params( | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |           formula:           Formula, | 
					
						
							|  |  |  |           livecheck_defined: T::Boolean, | 
					
						
							|  |  |  |           full_name:         T::Boolean, | 
					
						
							|  |  |  |           verbose:           T::Boolean, | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |         ).returns(T::Hash[Symbol, T.untyped]) | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       } | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |       private_class_method def self.formula_versioned(formula, livecheck_defined, full_name: false, verbose: false) | 
					
						
							|  |  |  |         return {} if !formula.versioned_formula? || livecheck_defined | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-07 16:20:20 +00:00
										 |  |  |         Livecheck.status_hash(formula, "versioned", full_name:, verbose:) | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       sig { | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         params( | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |           cask:              Cask::Cask, | 
					
						
							|  |  |  |           livecheck_defined: T::Boolean, | 
					
						
							|  |  |  |           full_name:         T::Boolean, | 
					
						
							|  |  |  |           verbose:           T::Boolean, | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |         ).returns(T::Hash[Symbol, T.untyped]) | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       } | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |       private_class_method def self.cask_deprecated(cask, livecheck_defined, full_name: false, verbose: false) | 
					
						
							|  |  |  |         return {} if !cask.deprecated? || livecheck_defined | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-07 16:20:20 +00:00
										 |  |  |         Livecheck.status_hash(cask, "deprecated", full_name:, verbose:) | 
					
						
							| 
									
										
										
										
											2023-12-04 13:43:33 -05:00
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       sig { | 
					
						
							|  |  |  |         params( | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |           cask:              Cask::Cask, | 
					
						
							|  |  |  |           livecheck_defined: T::Boolean, | 
					
						
							|  |  |  |           full_name:         T::Boolean, | 
					
						
							|  |  |  |           verbose:           T::Boolean, | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |         ).returns(T::Hash[Symbol, T.untyped]) | 
					
						
							| 
									
										
										
										
											2023-12-04 13:43:33 -05:00
										 |  |  |       } | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |       private_class_method def self.cask_disabled(cask, livecheck_defined, full_name: false, verbose: false) | 
					
						
							|  |  |  |         return {} if !cask.disabled? || livecheck_defined | 
					
						
							| 
									
										
										
										
											2023-12-04 13:43:33 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-07 16:20:20 +00:00
										 |  |  |         Livecheck.status_hash(cask, "disabled", full_name:, verbose:) | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-29 09:22:08 -04:00
										 |  |  |       sig { | 
					
						
							|  |  |  |         params( | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |           cask:               Cask::Cask, | 
					
						
							|  |  |  |           _livecheck_defined: T::Boolean, | 
					
						
							|  |  |  |           full_name:          T::Boolean, | 
					
						
							|  |  |  |           verbose:            T::Boolean, | 
					
						
							|  |  |  |           extract_plist:      T::Boolean, | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |         ).returns(T::Hash[Symbol, T.untyped]) | 
					
						
							| 
									
										
										
										
											2024-03-29 09:22:08 -04:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2024-08-23 03:15:57 +01:00
										 |  |  |       private_class_method def self.cask_extract_plist( | 
					
						
							|  |  |  |         cask, | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |         _livecheck_defined, | 
					
						
							| 
									
										
										
										
											2024-08-23 03:15:57 +01:00
										 |  |  |         full_name: false, | 
					
						
							|  |  |  |         verbose: false, | 
					
						
							|  |  |  |         extract_plist: false | 
					
						
							|  |  |  |       ) | 
					
						
							| 
									
										
										
										
											2024-03-29 09:22:08 -04:00
										 |  |  |         return {} if extract_plist || cask.livecheck.strategy != :extract_plist | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         Livecheck.status_hash( | 
					
						
							|  |  |  |           cask, | 
					
						
							|  |  |  |           "skipped", | 
					
						
							|  |  |  |           ["Use `--extract-plist` to enable checking multiple casks with ExtractPlist strategy"], | 
					
						
							|  |  |  |           full_name:, | 
					
						
							|  |  |  |           verbose:, | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       sig { | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         params( | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |           cask:              Cask::Cask, | 
					
						
							|  |  |  |           livecheck_defined: T::Boolean, | 
					
						
							|  |  |  |           full_name:         T::Boolean, | 
					
						
							|  |  |  |           verbose:           T::Boolean, | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |         ).returns(T::Hash[Symbol, T.untyped]) | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       } | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |       private_class_method def self.cask_version_latest(cask, livecheck_defined, full_name: false, verbose: false) | 
					
						
							|  |  |  |         return {} if !(cask.present? && cask.version&.latest?) || livecheck_defined | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-07 16:20:20 +00:00
										 |  |  |         Livecheck.status_hash(cask, "latest", full_name:, verbose:) | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       sig { | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         params( | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |           cask:              Cask::Cask, | 
					
						
							|  |  |  |           livecheck_defined: T::Boolean, | 
					
						
							|  |  |  |           full_name:         T::Boolean, | 
					
						
							|  |  |  |           verbose:           T::Boolean, | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |         ).returns(T::Hash[Symbol, T.untyped]) | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       } | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |       private_class_method def self.cask_url_unversioned(cask, livecheck_defined, full_name: false, verbose: false) | 
					
						
							|  |  |  |         return {} if !(cask.present? && cask.url&.unversioned?) || livecheck_defined | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-07 16:20:20 +00:00
										 |  |  |         Livecheck.status_hash(cask, "unversioned", full_name:, verbose:) | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       # Skip conditions for formulae. | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |       FORMULA_CHECKS = T.let([ | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |         :package_or_resource_skip, | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         :formula_head_only, | 
					
						
							|  |  |  |         :formula_deprecated, | 
					
						
							|  |  |  |         :formula_disabled, | 
					
						
							|  |  |  |         :formula_versioned, | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |       ].freeze, T::Array[Symbol]) | 
					
						
							| 
									
										
										
										
											2024-08-23 03:15:57 +01:00
										 |  |  |       private_constant :FORMULA_CHECKS | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |       # Skip conditions for casks. | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |       CASK_CHECKS = T.let([ | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |         :package_or_resource_skip, | 
					
						
							| 
									
										
										
										
											2023-12-04 13:43:33 -05:00
										 |  |  |         :cask_deprecated, | 
					
						
							|  |  |  |         :cask_disabled, | 
					
						
							| 
									
										
										
										
											2024-03-29 09:22:08 -04:00
										 |  |  |         :cask_extract_plist, | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         :cask_version_latest, | 
					
						
							|  |  |  |         :cask_url_unversioned, | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |       ].freeze, T::Array[Symbol]) | 
					
						
							| 
									
										
										
										
											2024-08-23 03:15:57 +01:00
										 |  |  |       private_constant :CASK_CHECKS | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-27 00:18:20 -04:00
										 |  |  |       # Skip conditions for resources. | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |       RESOURCE_CHECKS = T.let([ | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |         :package_or_resource_skip, | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |       ].freeze, T::Array[Symbol]) | 
					
						
							| 
									
										
										
										
											2024-08-23 03:15:57 +01:00
										 |  |  |       private_constant :RESOURCE_CHECKS | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |       # If a formula/cask/resource should be skipped, we return a hash from | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |       # `Livecheck#status_hash`, which contains a `status` type and sometimes | 
					
						
							|  |  |  |       # error `messages`. | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       sig { | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         params( | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |           package_or_resource: T.any(Formula, Cask::Cask, Resource), | 
					
						
							|  |  |  |           full_name:           T::Boolean, | 
					
						
							|  |  |  |           verbose:             T::Boolean, | 
					
						
							| 
									
										
										
										
											2024-03-29 09:22:08 -04:00
										 |  |  |           extract_plist:       T::Boolean, | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |         ).returns(T::Hash[Symbol, T.untyped]) | 
					
						
							| 
									
										
										
										
											2021-01-17 22:45:55 -08:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2024-08-23 03:15:57 +01:00
										 |  |  |       def self.skip_information(package_or_resource, full_name: false, verbose: false, extract_plist: true) | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |         livecheck_defined = package_or_resource.livecheck_defined? | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |         checks = case package_or_resource | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         when Formula | 
					
						
							|  |  |  |           FORMULA_CHECKS | 
					
						
							|  |  |  |         when Cask::Cask | 
					
						
							|  |  |  |           CASK_CHECKS | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |         when Resource | 
					
						
							|  |  |  |           RESOURCE_CHECKS | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         checks.each do |method_name| | 
					
						
							| 
									
										
										
										
											2024-03-29 09:22:08 -04:00
										 |  |  |           skip_hash = case method_name | 
					
						
							|  |  |  |           when :cask_extract_plist | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |             send(method_name, package_or_resource, livecheck_defined, full_name:, verbose:, extract_plist:) | 
					
						
							| 
									
										
										
										
											2024-03-29 09:22:08 -04:00
										 |  |  |           else | 
					
						
							| 
									
										
											  
											
												livecheck: clarify livecheckable language
Formulae, casks, and resources have a `#livecheckable?` method that
indicates whether they contain a `livecheck` block. This is intended
to be read as "has a livecheckable?", not "is livecheckable?" (as
livecheck can find versions for some packages/resources without a
`livecheck` block). Unfortunately, correct understanding of this
method's behavior [outside of documentation] relies on historical
knowledge that few people possess, so this is often confusing to
anyone who hasn't been working on livecheck since 2020.
In the olden days, a "livecheckable" was a Ruby file containing a
`livecheck` block (originally a hash) with a filename that
corresponded to a related formula. The `livecheck` blocks in
livecheckable files were integrated into their respective formulae in
August 2020, so [first-party] livecheckables ceased to exist at that
time. From that point forward, we simply referred to these as
`livecheck` blocks.
With that in mind, this clarifies the situation by replacing
"livecheckable" language. This includes renaming `#livecheckable?` to
`#livecheck_defined?`, replacing usage of "livecheckable" as a noun
with "`livecheck` block", replacing "livecheckable" as a boolean with
"livecheck_defined", and replacing incorrect usage of "livecheckable"
as an adjective with "checkable".
											
										 
											2024-11-27 18:20:56 -05:00
										 |  |  |             send(method_name, package_or_resource, livecheck_defined, full_name:, verbose:) | 
					
						
							| 
									
										
										
										
											2024-03-29 09:22:08 -04:00
										 |  |  |           end | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |           return skip_hash if skip_hash.present? | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         {} | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |       # Skip conditions for formulae/casks/resources referenced in a `livecheck` block | 
					
						
							| 
									
										
										
										
											2021-07-19 11:21:29 -04:00
										 |  |  |       # are treated differently than normal. We only respect certain skip | 
					
						
							|  |  |  |       # conditions (returning the related hash) and others are treated as | 
					
						
							|  |  |  |       # errors. | 
					
						
							|  |  |  |       sig { | 
					
						
							|  |  |  |         params( | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |           livecheck_package_or_resource:     T.any(Formula, Cask::Cask, Resource), | 
					
						
							|  |  |  |           original_package_or_resource_name: String, | 
					
						
							|  |  |  |           full_name:                         T::Boolean, | 
					
						
							|  |  |  |           verbose:                           T::Boolean, | 
					
						
							| 
									
										
										
										
											2024-03-29 09:22:08 -04:00
										 |  |  |           extract_plist:                     T::Boolean, | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |         ).returns(T.nilable(T::Hash[Symbol, T.untyped])) | 
					
						
							| 
									
										
										
										
											2021-07-19 11:21:29 -04:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2024-08-23 03:15:57 +01:00
										 |  |  |       def self.referenced_skip_information( | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |         livecheck_package_or_resource, | 
					
						
							|  |  |  |         original_package_or_resource_name, | 
					
						
							| 
									
										
										
										
											2021-07-19 11:21:29 -04:00
										 |  |  |         full_name: false, | 
					
						
							| 
									
										
										
										
											2024-03-29 09:22:08 -04:00
										 |  |  |         verbose: false, | 
					
						
							|  |  |  |         extract_plist: true | 
					
						
							| 
									
										
										
										
											2021-07-19 11:21:29 -04:00
										 |  |  |       ) | 
					
						
							|  |  |  |         skip_info = SkipConditions.skip_information( | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |           livecheck_package_or_resource, | 
					
						
							| 
									
										
										
										
											2024-03-07 16:20:20 +00:00
										 |  |  |           full_name:, | 
					
						
							|  |  |  |           verbose:, | 
					
						
							| 
									
										
										
										
											2024-03-29 09:22:08 -04:00
										 |  |  |           extract_plist:, | 
					
						
							| 
									
										
										
										
											2021-07-19 11:21:29 -04:00
										 |  |  |         ) | 
					
						
							|  |  |  |         return if skip_info.blank? | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-03-07 16:20:20 +00:00
										 |  |  |         referenced_name = Livecheck.package_or_resource_name(livecheck_package_or_resource, full_name:) | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |         referenced_type = case livecheck_package_or_resource | 
					
						
							| 
									
										
										
										
											2021-07-19 11:21:29 -04:00
										 |  |  |         when Formula | 
					
						
							|  |  |  |           :formula | 
					
						
							|  |  |  |         when Cask::Cask | 
					
						
							|  |  |  |           :cask | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |         when Resource | 
					
						
							|  |  |  |           :resource | 
					
						
							| 
									
										
										
										
											2021-07-19 11:21:29 -04:00
										 |  |  |         end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if skip_info[:status] != "error" && | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |            !(skip_info[:status] == "skipped" && livecheck_package_or_resource.livecheck.skip?) | 
					
						
							| 
									
										
										
										
											2021-07-19 11:21:29 -04:00
										 |  |  |           error_msg_end = if skip_info[:status] == "skipped" | 
					
						
							|  |  |  |             "automatically skipped" | 
					
						
							|  |  |  |           else | 
					
						
							|  |  |  |             "skipped as #{skip_info[:status]}" | 
					
						
							|  |  |  |           end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           raise "Referenced #{referenced_type} (#{referenced_name}) is #{error_msg_end}" | 
					
						
							|  |  |  |         end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |         skip_info[referenced_type] = original_package_or_resource_name | 
					
						
							| 
									
										
										
										
											2021-07-19 11:21:29 -04:00
										 |  |  |         skip_info | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |       # Prints default livecheck output in relation to skip conditions. | 
					
						
							| 
									
										
										
										
											2024-07-04 20:09:36 -04:00
										 |  |  |       sig { params(skip_hash: T::Hash[Symbol, T.untyped]).void } | 
					
						
							| 
									
										
										
										
											2024-08-23 03:15:57 +01:00
										 |  |  |       def self.print_skip_information(skip_hash) | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         return unless skip_hash.is_a?(Hash) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         name = if skip_hash[:formula].is_a?(String) | 
					
						
							|  |  |  |           skip_hash[:formula] | 
					
						
							|  |  |  |         elsif skip_hash[:cask].is_a?(String) | 
					
						
							|  |  |  |           skip_hash[:cask] | 
					
						
							| 
									
										
										
										
											2022-09-14 03:42:12 +02:00
										 |  |  |         elsif skip_hash[:resource].is_a?(String) | 
					
						
							| 
									
										
										
										
											2022-09-14 04:54:52 +02:00
										 |  |  |           "  #{skip_hash[:resource]}" | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         end | 
					
						
							|  |  |  |         return unless name | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if skip_hash[:messages].is_a?(Array) && skip_hash[:messages].count.positive? | 
					
						
							|  |  |  |           # TODO: Handle multiple messages, only if needed in the future | 
					
						
							|  |  |  |           if skip_hash[:status] == "skipped" | 
					
						
							| 
									
										
										
										
											2022-04-26 20:44:43 +03:00
										 |  |  |             puts "#{Tty.red}#{name}#{Tty.reset}: skipped - #{skip_hash[:messages][0]}" | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |           else | 
					
						
							| 
									
										
										
										
											2022-04-26 20:44:43 +03:00
										 |  |  |             puts "#{Tty.red}#{name}#{Tty.reset}: #{skip_hash[:messages][0]}" | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |           end | 
					
						
							|  |  |  |         elsif skip_hash[:status].present? | 
					
						
							| 
									
										
										
										
											2022-04-26 20:44:43 +03:00
										 |  |  |           puts "#{Tty.red}#{name}#{Tty.reset}: #{skip_hash[:status]}" | 
					
						
							| 
									
										
										
										
											2021-01-07 15:30:22 -05:00
										 |  |  |         end | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | end |