From a103f9772f1f92e5ffd8727e73b59facea35a658 Mon Sep 17 00:00:00 2001 From: Lucas Date: Fri, 19 Jan 2024 21:00:35 -0300 Subject: [PATCH 1/5] tastytrade 2.8.0 --- Casks/t/tastytrade.rb | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Casks/t/tastytrade.rb b/Casks/t/tastytrade.rb index 4cd9ab9e2c..8d996220f0 100644 --- a/Casks/t/tastytrade.rb +++ b/Casks/t/tastytrade.rb @@ -1,11 +1,14 @@ cask "tastytrade" do - arch arm: "-aarch64" + version "2.8.0" + + if Hardware::CPU.intel? + sha256 "98ace9292f65022780328fb3a61c98c6542e62046390770d16b8942a9b9e6be8" + url "https://download.tastytrade.com/desktop-#{version.major}.x.x/#{version}/tastytrade-#{version}.dmg" + else + sha256 "62532bc7b23a439e501c0eff1c3bab216adcbc5c64c05539d06fcdf5d1705088" + url "https://download.tastytrade.com/desktop-#{version.major}.x.x/#{version}/tastytrade-#{version}-aarch64.dmg" + end - version "2.5.4" - sha256 arm: "51f21ecd02cd7b0acf13d80f712e87a2a163d79a8b1721cebc78559deb1615fe", - intel: "da585b646afba35104957cbfb433c4b27cc9f1ee6fd69f3a045397c3a27d5c7f" - - 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/" From 02e3c931e1ac38adc62b22411a75ef57b83d9218 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 20 Jan 2024 13:56:27 -0300 Subject: [PATCH 2/5] tastytrade 2.8.0 --- Casks/t/tastytrade.rb | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Casks/t/tastytrade.rb b/Casks/t/tastytrade.rb index 8d996220f0..78384d9925 100644 --- a/Casks/t/tastytrade.rb +++ b/Casks/t/tastytrade.rb @@ -1,14 +1,11 @@ cask "tastytrade" do - version "2.8.0" - - if Hardware::CPU.intel? - sha256 "98ace9292f65022780328fb3a61c98c6542e62046390770d16b8942a9b9e6be8" - url "https://download.tastytrade.com/desktop-#{version.major}.x.x/#{version}/tastytrade-#{version}.dmg" - else - sha256 "62532bc7b23a439e501c0eff1c3bab216adcbc5c64c05539d06fcdf5d1705088" - url "https://download.tastytrade.com/desktop-#{version.major}.x.x/#{version}/tastytrade-#{version}-aarch64.dmg" - end + arch arm: "-aarch64" + 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/" From 014942e21d9dc55e2219f2fff2fefec7ff1ec0a3 Mon Sep 17 00:00:00 2001 From: Justin Krehel <39449589+krehel@users.noreply.github.com> Date: Sat, 20 Jan 2024 13:10:27 -0500 Subject: [PATCH 3/5] tastytrade: style fixes --- Casks/t/tastytrade.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Casks/t/tastytrade.rb b/Casks/t/tastytrade.rb index 78384d9925..79a66ee6de 100644 --- a/Casks/t/tastytrade.rb +++ b/Casks/t/tastytrade.rb @@ -4,7 +4,7 @@ cask "tastytrade" do 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" From 42e9dffbed2ee4bb9e51b743d9f7ccf9ed02ba6c Mon Sep 17 00:00:00 2001 From: Bevan Kay Date: Sun, 21 Jan 2024 15:55:31 +1100 Subject: [PATCH 4/5] tastytrade: add livecheck --- Casks/t/tastytrade.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Casks/t/tastytrade.rb b/Casks/t/tastytrade.rb index 79a66ee6de..12003fb915 100644 --- a/Casks/t/tastytrade.rb +++ b/Casks/t/tastytrade.rb @@ -11,7 +11,19 @@ cask "tastytrade" do homepage "https://tastytrade.com/technology/" livecheck do - skip "No version information available" + url "https://tastytrade.com/page-data/technology/page-data.json" + strategy :json do |json| + static_hashes = json["staticQueryHashes"] + + version = static_hashes.map do |static_hash| + 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 From ca88f767eab5090c39ab7397dcf4a7ce283bcc3a Mon Sep 17 00:00:00 2001 From: Sam Ford <1584702+samford@users.noreply.github.com> Date: Mon, 22 Jan 2024 20:42:13 -0500 Subject: [PATCH 5/5] tastytrade: update livecheck --- Casks/t/tastytrade.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/Casks/t/tastytrade.rb b/Casks/t/tastytrade.rb index 12003fb915..eaa887d966 100644 --- a/Casks/t/tastytrade.rb +++ b/Casks/t/tastytrade.rb @@ -10,12 +10,21 @@ cask "tastytrade" do 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 url "https://tastytrade.com/page-data/technology/page-data.json" strategy :json do |json| - static_hashes = json["staticQueryHashes"] + requests = 0 + version = json["staticQueryHashes"]&.each do |static_hash| + requests += 1 + break if requests > 4 - version = static_hashes.map do |static_hash| content = Homebrew::Livecheck::Strategy.page_content("https://tastytrade.com/page-data/sq/d/#{static_hash}.json") next if content.blank? || content[:content].blank?