Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions Casks/m/macgamestore.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
cask "macgamestore" do
version "4.3.4,6084"
sha256 "9f4b86ba8726de7c00fa129392b5b3cfdb0af7b682dfedfa1e0b00e08ea0cf11"
version "5.3.0,6127"
sha256 "3cc7c56c08a78c998ed86ad6b698df2be75045be54bfd3d7db61959ae4291622"

url "https://www.macgamestore.com/api_clientapp/clientupdates/public/core6/MacGameStore_#{version.csv.first}_#{version.csv.second}.tgz"
url "https://www.macgamestore.com/api_clientapp/clientupdates/public/core#{version.csv.second[0]}/MacGameStore_#{version.csv.first}_#{version.csv.second}.zip"
name "MacGameStore"
desc "Buy, download, and play your games"
homepage "https://www.macgamestore.com/app/"

# This is a Sparkle feed but upstream uses a non-standard approach to
# identify unstable versions that the `Sparkle` strategy doesn't handle, so
# we have to use the `Xml` strategy instead.
livecheck do
url "https://www.macgamestore.com/api_clientapp/clientupdates/public/update.xml"
regex(%r{/MacGameStore_(\d+(?:\.\d+)+)_(\d+)\.t}i)
strategy :sparkle do |item, regex|
item.url.scan(regex).map { |match| "#{match[0]},#{match[1]}" }
url "https://www.macgamestore.com/api_clientapp/clientupdates/public/update-2021.xml"
regex(/MacGameStore[._-]v?(\d+(?:\.\d+)+)[._-](\d+)\.zip/i)
strategy :xml do |xml, regex|
xml.get_elements("//item").map do |item|
next if item.elements["sparkle:isBetaBuild"]&.text&.include?("1")

url = item.elements["enclosure"]&.attributes&.[]("url")
match = url.match(regex) if url
next if match.blank?

"#{match[1]},#{match[2]}"
end
end
end

auto_updates true
depends_on macos: ">= :sierra"

app "MacGameStore.app"
Expand All @@ -23,8 +35,4 @@
"/Applications/MacGameStore",
"~/Library/Application Support/MacGameStore.com",
]

caveats do
requires_rosetta
end
end