Remove detection for Sparkle strategy.

This commit is contained in:
Markus Reiter 2020-12-18 17:58:21 +01:00 committed by Sam Ford
parent 4aaa2de6c4
commit 3723cd7dec
No known key found for this signature in database
GPG Key ID: 95209E46C7FFDEFE

View File

@ -1,4 +1,4 @@
# typed: false
# typed: true
# frozen_string_literal: true
require "bundle_version"
@ -11,36 +11,11 @@ module Homebrew
# its contents as a Sparkle appcast in XML format.
#
# @api private
class Sparkle
class Sparkle < PageMatch
extend T::Sig
NICE_NAME = "Sparkle"
PRIORITY = 1
# Whether the strategy can be applied to the provided URL.
sig { params(url: String).returns(T::Boolean) }
def self.match?(url)
return false unless url.match?(%r{^https?://})
xml = url.end_with?(".xml")
xml ||= begin
headers = Strategy.page_headers(url)
content_type = headers["content-type"]
content_type.blank? || content_type.include?("xml")
end
return false unless xml
contents = Strategy.page_contents(url)
return true if contents.match?(%r{https?://www.andymatuschak.org/xml-namespaces/sparkle})
contents.include?("rss") &&
contents.include?("channel") &&
contents.include?("item") &&
contents.include?("enclosure")
end
# Checks the content at the URL for new versions.
sig { params(url: String, regex: T.nilable(Regexp)).returns(T::Hash[Symbol, T.untyped]) }
def self.find_versions(url, regex, &block)