Always take latest item in Sparkle
strategy.
This commit is contained in:
parent
842a2ea890
commit
9bb1ba324f
@ -36,6 +36,8 @@ module Homebrew
|
|||||||
Item = Struct.new(
|
Item = Struct.new(
|
||||||
# @api public
|
# @api public
|
||||||
:title,
|
:title,
|
||||||
|
# @api private
|
||||||
|
:pub_date,
|
||||||
# @api public
|
# @api public
|
||||||
:url,
|
:url,
|
||||||
# @api private
|
# @api private
|
||||||
@ -72,6 +74,7 @@ module Homebrew
|
|||||||
version ||= (item > "version").first&.text&.strip
|
version ||= (item > "version").first&.text&.strip
|
||||||
|
|
||||||
title = (item > "title").first&.text&.strip
|
title = (item > "title").first&.text&.strip
|
||||||
|
pub_date = (item > "pubDate").first&.text&.strip&.yield_self { |d| Time.parse(d) }
|
||||||
|
|
||||||
if (match = title&.match(/(\d+(?:\.\d+)*)\s*(\([^)]+\))?\Z/))
|
if (match = title&.match(/(\d+(?:\.\d+)*)\s*(\([^)]+\))?\Z/))
|
||||||
short_version ||= match[1]
|
short_version ||= match[1]
|
||||||
@ -84,6 +87,7 @@ module Homebrew
|
|||||||
|
|
||||||
data = {
|
data = {
|
||||||
title: title,
|
title: title,
|
||||||
|
pub_date: pub_date,
|
||||||
url: url,
|
url: url,
|
||||||
bundle_version: bundle_version,
|
bundle_version: bundle_version,
|
||||||
}.compact
|
}.compact
|
||||||
@ -91,7 +95,7 @@ module Homebrew
|
|||||||
Item.new(**data) unless data.empty?
|
Item.new(**data) unless data.empty?
|
||||||
end.compact
|
end.compact
|
||||||
|
|
||||||
items.first
|
items.max_by { |item| [item.pub_date, item.bundle_version] }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Checks the content at the URL for new versions.
|
# Checks the content at the URL for new versions.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user