Add type signatures.
This commit is contained in:
parent
a37afcb777
commit
76d8d6c840
@ -60,7 +60,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
private :download_and_cache_data!
|
private :download_and_cache_data!
|
||||||
|
|
||||||
sig { returns(Hash) }
|
sig { returns(T::Hash[String, Hash]) }
|
||||||
def all_casks
|
def all_casks
|
||||||
unless cache.key?("casks")
|
unless cache.key?("casks")
|
||||||
json_updated = download_and_cache_data!
|
json_updated = download_and_cache_data!
|
||||||
|
|||||||
@ -281,7 +281,11 @@ module Cask
|
|||||||
class FromAPILoader
|
class FromAPILoader
|
||||||
include ILoader
|
include ILoader
|
||||||
|
|
||||||
attr_reader :token, :path
|
sig { returns(String) }
|
||||||
|
attr_reader :token
|
||||||
|
|
||||||
|
sig { returns(Pathname) }
|
||||||
|
attr_reader :path
|
||||||
|
|
||||||
sig { returns(T.nilable(Hash)) }
|
sig { returns(T.nilable(Hash)) }
|
||||||
attr_reader :from_json
|
attr_reader :from_json
|
||||||
@ -296,7 +300,7 @@ module Cask
|
|||||||
|
|
||||||
return unless (match = ref.match(HOMEBREW_MAIN_TAP_CASK_REGEX))
|
return unless (match = ref.match(HOMEBREW_MAIN_TAP_CASK_REGEX))
|
||||||
|
|
||||||
token = match[:token]
|
token = T.cast(match[:token], String)
|
||||||
return if !Homebrew::API::Cask.all_casks.key?(token) && !Homebrew::API::Cask.all_renames.key?(token)
|
return if !Homebrew::API::Cask.all_casks.key?(token) && !Homebrew::API::Cask.all_renames.key?(token)
|
||||||
|
|
||||||
ref = "#{CoreCaskTap.instance}/#{token}"
|
ref = "#{CoreCaskTap.instance}/#{token}"
|
||||||
@ -313,7 +317,7 @@ module Cask
|
|||||||
end
|
end
|
||||||
|
|
||||||
def load(config:)
|
def load(config:)
|
||||||
json_cask = from_json || Homebrew::API::Cask.all_casks[token]
|
json_cask = from_json || Homebrew::API::Cask.all_casks.fetch(token)
|
||||||
|
|
||||||
cask_options = {
|
cask_options = {
|
||||||
loaded_from_api: true,
|
loaded_from_api: true,
|
||||||
|
|||||||
@ -256,11 +256,11 @@ module Homebrew
|
|||||||
paths = []
|
paths = []
|
||||||
|
|
||||||
if formula_path.exist? ||
|
if formula_path.exist? ||
|
||||||
(!CoreTap.instance.installed? && Homebrew::API::Formula.all_formulae.key?(path.basename))
|
(!CoreTap.instance.installed? && Homebrew::API::Formula.all_formulae.key?(path.basename.to_s))
|
||||||
paths << formula_path
|
paths << formula_path
|
||||||
end
|
end
|
||||||
if cask_path.exist? ||
|
if cask_path.exist? ||
|
||||||
(!CoreCaskTap.instance.installed? && Homebrew::API::Cask.all_casks.key?(path.basename))
|
(!CoreCaskTap.instance.installed? && Homebrew::API::Cask.all_casks.key?(path.basename.to_s))
|
||||||
paths << cask_path
|
paths << cask_path
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user