Merge pull request #164884 from lbuse/tastytrade_2.8.0

tastytrade 2.8.0
This commit is contained in:
Bevan Kay
2024-01-23 12:51:08 +11:00
committed by GitHub
+25 -4
View File
@@ -1,17 +1,38 @@
cask "tastytrade" do
arch arm: "-aarch64"
version "2.5.4"
sha256 arm: "51f21ecd02cd7b0acf13d80f712e87a2a163d79a8b1721cebc78559deb1615fe",
intel: "da585b646afba35104957cbfb433c4b27cc9f1ee6fd69f3a045397c3a27d5c7f"
version "2.8.0"
sha256 arm: "62532bc7b23a439e501c0eff1c3bab216adcbc5c64c05539d06fcdf5d1705088",
intel: "98ace9292f65022780328fb3a61c98c6542e62046390770d16b8942a9b9e6be8"
url "https://download.tastytrade.com/desktop-#{version.major}.x.x/#{version}/tastytrade-#{version}#{arch}.dmg"
name "tastytrade"
desc "Desktop trading platform"
homepage "https://tastytrade.com/technology/"
# The version information is found in a random JSON file, which is referenced
# from another JSON file. We can't tell which file will contain the version
# information, so we check each until we find a match. As of writing, the
# first JSON file contains the version information but this check could
# involve further requests if the order of the JSON files changes or the
# structure of the target JSON file changes. The latter would cause the check
# to fetch all the JSON files before failing, which isn't ideal.
livecheck do
skip "No version information available"
url "https://tastytrade.com/page-data/technology/page-data.json"
strategy :json do |json|
requests = 0
version = json["staticQueryHashes"]&.each do |static_hash|
requests += 1
break if requests > 4
content = Homebrew::Livecheck::Strategy.page_content("https://tastytrade.com/page-data/sq/d/#{static_hash}.json")
next if content.blank? || content[:content].blank?
hash_json = JSON.parse(content[:content])
version = hash_json.dig("data", "contentstackGlobalSettings", "tastyworksSoftware", "desktopVersion")
break version if version.present?
end
end
end
auto_updates true