Fixed typecheck errors
This commit is contained in:
parent
53b0d60f75
commit
0c9ff722ae
@ -269,7 +269,6 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
current_str = current.to_s
|
current_str = current.to_s
|
||||||
current = T.let(LivecheckVersion.create(formula_or_cask, current), T.untyped)
|
|
||||||
|
|
||||||
latest = if formula&.head_only?
|
latest = if formula&.head_only?
|
||||||
formula.head.downloader.fetch_last_commit
|
formula.head.downloader.fetch_last_commit
|
||||||
@ -314,7 +313,6 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
latest_str = latest.to_s
|
latest_str = latest.to_s
|
||||||
latest = T.let(LivecheckVersion.create(formula_or_cask, latest), T.untyped)
|
|
||||||
|
|
||||||
is_outdated = if formula&.head_only?
|
is_outdated = if formula&.head_only?
|
||||||
# A HEAD-only formula is considered outdated if the latest upstream
|
# A HEAD-only formula is considered outdated if the latest upstream
|
||||||
@ -453,9 +451,9 @@ resource: false)
|
|||||||
if formula
|
if formula
|
||||||
status_hash[:formula] = formula_name(formula, full_name: full_name)
|
status_hash[:formula] = formula_name(formula, full_name: full_name)
|
||||||
elsif cask
|
elsif cask
|
||||||
status_hash[:cask] = cask_name(package_or_resource, full_name: full_name)
|
status_hash[:cask] = cask_name(cask, full_name: full_name)
|
||||||
elsif resource
|
elsif resource
|
||||||
status_hash[:resource] = resource_name(package_or_resource, full_name: full_name)
|
status_hash[:resource] = resource_name(resource, full_name: full_name)
|
||||||
end
|
end
|
||||||
status_hash[:status] = status_str
|
status_hash[:status] = status_str
|
||||||
status_hash[:messages] = messages if messages.is_a?(Array)
|
status_hash[:messages] = messages if messages.is_a?(Array)
|
||||||
@ -509,7 +507,7 @@ resource: false)
|
|||||||
package_or_resource.send(:url)&.to_s if package_or_resource.is_a?(Resource)
|
package_or_resource.send(:url)&.to_s if package_or_resource.is_a?(Resource)
|
||||||
package_or_resource.send(livecheck_url)&.url if package_or_resource.is_a?(Formula)
|
package_or_resource.send(livecheck_url)&.url if package_or_resource.is_a?(Formula)
|
||||||
when :homepage
|
when :homepage
|
||||||
package_or_resource.homepage
|
package_or_resource.homepage unless package_or_resource.is_a?(Resource)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -582,29 +580,34 @@ resource: false)
|
|||||||
url
|
url
|
||||||
end
|
end
|
||||||
|
|
||||||
# livecheck should fetch a URL using brewed curl if the formula/cask
|
# livecheck should fetch a URL using brewed curl if the formula/resource/cask
|
||||||
# contains a `stable`/`url` or `head` URL `using: :homebrew_curl` that
|
# contains a `stable`/`url` or `head` URL `using: :homebrew_curl` that
|
||||||
# shares the same root domain.
|
# shares the same root domain.
|
||||||
sig { params(formula_or_cask: T.any(Formula, Cask::Cask), url: String).returns(T::Boolean) }
|
sig { params(package_or_resource: T.any(Formula, Cask::Cask, Resource), url: String).returns(T::Boolean) }
|
||||||
def use_homebrew_curl?(formula_or_cask, url)
|
def use_homebrew_curl?(package_or_resource, url)
|
||||||
url_root_domain = Addressable::URI.parse(url)&.domain
|
url_root_domain = Addressable::URI.parse(url)&.domain
|
||||||
return false if url_root_domain.blank?
|
return false if url_root_domain.blank?
|
||||||
|
|
||||||
# Collect root domains of URLs with `using: :homebrew_curl`
|
# Collect root domains of URLs with `using: :homebrew_curl`
|
||||||
homebrew_curl_root_domains = []
|
homebrew_curl_root_domains = []
|
||||||
case formula_or_cask
|
case package_or_resource
|
||||||
when Formula
|
when Formula
|
||||||
[:stable, :head].each do |spec_name|
|
[:stable, :head].each do |spec_name|
|
||||||
next unless (spec = formula_or_cask.send(spec_name))
|
next unless (spec = package_or_resource.send(spec_name))
|
||||||
next unless spec.using == :homebrew_curl
|
next unless spec.using == :homebrew_curl
|
||||||
|
|
||||||
domain = Addressable::URI.parse(spec.url)&.domain
|
domain = Addressable::URI.parse(spec.url)&.domain
|
||||||
homebrew_curl_root_domains << domain if domain.present?
|
homebrew_curl_root_domains << domain if domain.present?
|
||||||
end
|
end
|
||||||
when Cask::Cask
|
when Cask::Cask
|
||||||
return false unless formula_or_cask.url.using == :homebrew_curl
|
return false unless package_or_resource.url.using == :homebrew_curl
|
||||||
|
|
||||||
domain = Addressable::URI.parse(formula_or_cask.url.to_s)&.domain
|
domain = Addressable::URI.parse(package_or_resource.url.to_s)&.domain
|
||||||
|
homebrew_curl_root_domains << domain if domain.present?
|
||||||
|
when Resource
|
||||||
|
return false unless package_or_resource.url == :homebrew_curl
|
||||||
|
|
||||||
|
domain = Addressable::URI.parse(package_or_resource.url.to_s)&.domain
|
||||||
homebrew_curl_root_domains << domain if domain.present?
|
homebrew_curl_root_domains << domain if domain.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user