From 75ce7240fc7a0e815906795ed91dc3426b151fc2 Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Thu, 16 Nov 2023 11:25:18 -0500 Subject: [PATCH] Sparkle: Refactor macOS os strings into constant --- Library/Homebrew/livecheck/strategy/sparkle.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/livecheck/strategy/sparkle.rb b/Library/Homebrew/livecheck/strategy/sparkle.rb index 1d6b32cf40..b7dc1b7cf8 100644 --- a/Library/Homebrew/livecheck/strategy/sparkle.rb +++ b/Library/Homebrew/livecheck/strategy/sparkle.rb @@ -21,6 +21,9 @@ module Homebrew # The `Regexp` used to determine if the strategy applies to the URL. URL_MATCH_REGEX = %r{^https?://}i.freeze + # Common `os` values used in appcasts to refer to macOS. + APPCAST_MACOS_STRINGS = ["macos", "osx"].freeze + # Whether the strategy can be applied to the provided URL. # # @param url [String] the URL to match against @@ -152,7 +155,7 @@ module Homebrew def self.filter_items(items) items.select do |item| # Omit items with an explicit `os` value that isn't macOS - next false if item.os && !((item.os == "osx") || (item.os == "macos")) + next false if item.os && APPCAST_MACOS_STRINGS.none?(item.os) # Omit items for prerelease macOS versions next false if item.minimum_system_version&.strip_patch&.prerelease?