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
|
||||
puts "Homebrew curl?: Yes" if debug && homebrew_curl.present?
|
||||
|
||||
strategy_data = strategy.find_versions(
|
||||
url: url,
|
||||
strategy_args = {
|
||||
regex: livecheck_regex,
|
||||
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]
|
||||
regex = strategy_data[:regex]
|
||||
messages = strategy_data[:messages]
|
||||
@ -912,12 +921,13 @@ module Homebrew
|
||||
puts if debug && strategy.blank?
|
||||
next if strategy.blank?
|
||||
|
||||
strategy_data = strategy.find_versions(
|
||||
strategy_args = {
|
||||
url: url,
|
||||
regex: livecheck_regex,
|
||||
homebrew_curl: false,
|
||||
&livecheck_strategy_block
|
||||
)
|
||||
}.compact
|
||||
|
||||
strategy_data = strategy.find_versions(**strategy_args, &livecheck_strategy_block)
|
||||
match_version_map = strategy_data[:matches]
|
||||
regex = strategy_data[:regex]
|
||||
messages = strategy_data[:messages]
|
||||
|
||||
@ -71,15 +71,15 @@ module Homebrew
|
||||
sig {
|
||||
params(
|
||||
url: String,
|
||||
regex: T.nilable(Regexp),
|
||||
regex: Regexp,
|
||||
unused: T.nilable(T::Hash[Symbol, T.untyped]),
|
||||
block: T.nilable(Proc),
|
||||
).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)
|
||||
|
||||
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
|
||||
|
||||
@ -190,6 +190,7 @@ module Homebrew
|
||||
|
||||
match_data.merge!(Strategy.page_content(url))
|
||||
content = match_data.delete(:content)
|
||||
return match_data if content.blank?
|
||||
|
||||
versions_from_content(content, regex, &block).each do |version_text|
|
||||
match_data[:matches][version_text] = Version.new(version_text)
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
# typed: true
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "rexml/document"
|
||||
|
||||
module Homebrew
|
||||
module Livecheck
|
||||
module Strategy
|
||||
@ -53,8 +55,6 @@ module Homebrew
|
||||
# @return [REXML::Document, nil]
|
||||
sig { params(content: String).returns(T.nilable(REXML::Document)) }
|
||||
def self.parse_xml(content)
|
||||
require "rexml/document"
|
||||
|
||||
parsing_tries = 0
|
||||
begin
|
||||
REXML::Document.new(content)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user