Merge pull request #15334 from samford/livecheck/sorbet-runtime-fixes
Livecheck: Fixes for Sorbet runtime
This commit is contained in:
commit
0c478b36df
@ -733,13 +733,22 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
puts "Homebrew curl?: Yes" if debug && homebrew_curl.present?
|
puts "Homebrew curl?: Yes" if debug && homebrew_curl.present?
|
||||||
|
|
||||||
strategy_data = strategy.find_versions(
|
strategy_args = {
|
||||||
url: url,
|
|
||||||
regex: livecheck_regex,
|
regex: livecheck_regex,
|
||||||
homebrew_curl: homebrew_curl,
|
homebrew_curl: homebrew_curl,
|
||||||
cask: cask,
|
}
|
||||||
&livecheck_strategy_block
|
# TODO: Set `cask`/`url` args based on the presence of the keyword arg
|
||||||
)
|
# in the strategy's `#find_versions` method once we figure out why
|
||||||
|
# `strategy.method(:find_versions).parameters` isn't working as
|
||||||
|
# expected.
|
||||||
|
if strategy_name == "ExtractPlist"
|
||||||
|
strategy_args[:cask] = cask if cask.present?
|
||||||
|
else
|
||||||
|
strategy_args[:url] = url
|
||||||
|
end
|
||||||
|
strategy_args.compact!
|
||||||
|
|
||||||
|
strategy_data = strategy.find_versions(**strategy_args, &livecheck_strategy_block)
|
||||||
match_version_map = strategy_data[:matches]
|
match_version_map = strategy_data[:matches]
|
||||||
regex = strategy_data[:regex]
|
regex = strategy_data[:regex]
|
||||||
messages = strategy_data[:messages]
|
messages = strategy_data[:messages]
|
||||||
@ -912,12 +921,13 @@ module Homebrew
|
|||||||
puts if debug && strategy.blank?
|
puts if debug && strategy.blank?
|
||||||
next if strategy.blank?
|
next if strategy.blank?
|
||||||
|
|
||||||
strategy_data = strategy.find_versions(
|
strategy_args = {
|
||||||
url: url,
|
url: url,
|
||||||
regex: livecheck_regex,
|
regex: livecheck_regex,
|
||||||
homebrew_curl: false,
|
homebrew_curl: false,
|
||||||
&livecheck_strategy_block
|
}.compact
|
||||||
)
|
|
||||||
|
strategy_data = strategy.find_versions(**strategy_args, &livecheck_strategy_block)
|
||||||
match_version_map = strategy_data[:matches]
|
match_version_map = strategy_data[:matches]
|
||||||
regex = strategy_data[:regex]
|
regex = strategy_data[:regex]
|
||||||
messages = strategy_data[:messages]
|
messages = strategy_data[:messages]
|
||||||
|
|||||||
@ -71,15 +71,15 @@ module Homebrew
|
|||||||
sig {
|
sig {
|
||||||
params(
|
params(
|
||||||
url: String,
|
url: String,
|
||||||
regex: T.nilable(Regexp),
|
regex: Regexp,
|
||||||
unused: T.nilable(T::Hash[Symbol, T.untyped]),
|
unused: T.nilable(T::Hash[Symbol, T.untyped]),
|
||||||
block: T.nilable(Proc),
|
block: T.nilable(Proc),
|
||||||
).returns(T::Hash[Symbol, T.untyped])
|
).returns(T::Hash[Symbol, T.untyped])
|
||||||
}
|
}
|
||||||
def self.find_versions(url:, regex: nil, **unused, &block)
|
def self.find_versions(url:, regex: DEFAULT_REGEX, **unused, &block)
|
||||||
generated = generate_input_values(url)
|
generated = generate_input_values(url)
|
||||||
|
|
||||||
PageMatch.find_versions(url: generated[:url], regex: regex || DEFAULT_REGEX, **unused, &block)
|
PageMatch.find_versions(url: generated[:url], regex: regex, **unused, &block)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -190,6 +190,7 @@ module Homebrew
|
|||||||
|
|
||||||
match_data.merge!(Strategy.page_content(url))
|
match_data.merge!(Strategy.page_content(url))
|
||||||
content = match_data.delete(:content)
|
content = match_data.delete(:content)
|
||||||
|
return match_data if content.blank?
|
||||||
|
|
||||||
versions_from_content(content, regex, &block).each do |version_text|
|
versions_from_content(content, regex, &block).each do |version_text|
|
||||||
match_data[:matches][version_text] = Version.new(version_text)
|
match_data[:matches][version_text] = Version.new(version_text)
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
# typed: true
|
# typed: true
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "rexml/document"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module Livecheck
|
module Livecheck
|
||||||
module Strategy
|
module Strategy
|
||||||
@ -53,8 +55,6 @@ module Homebrew
|
|||||||
# @return [REXML::Document, nil]
|
# @return [REXML::Document, nil]
|
||||||
sig { params(content: String).returns(T.nilable(REXML::Document)) }
|
sig { params(content: String).returns(T.nilable(REXML::Document)) }
|
||||||
def self.parse_xml(content)
|
def self.parse_xml(content)
|
||||||
require "rexml/document"
|
|
||||||
|
|
||||||
parsing_tries = 0
|
parsing_tries = 0
|
||||||
begin
|
begin
|
||||||
REXML::Document.new(content)
|
REXML::Document.new(content)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user