cask "nwjs" do arch arm: "arm64", intel: "x64" version "0.101.2" sha256 arm: "64a725013cdbb39f86d156ac41234fb165c2c3417992cc2823253840095a4897", intel: "279a9552ccb1b50a500450ed90d8af2aec0fb1680506b867a755e2b9c02eccec" url "https://dl.nwjs.io/v#{version}/nwjs-sdk-v#{version}-osx-#{arch}.zip" name "NW.js" desc "Call all Node.js modules directly from the DOM and Web Workers" homepage "https://nwjs.io/" # The upstream download page appends a UNIX epoch timestamp (in milliseconds) # to the JSON URL, so we do the same (in case it affects the returned data). livecheck do url "https://nwjs.io/versions.json?#{DateTime.now.strftime("%Q")}" regex(/^v?(\d+(?:\.\d+)+)$/i) strategy :json do |json, regex| match = json["stable"]&.match(regex) next if match.blank? match[1] end end depends_on macos: ">= :big_sur" app "nwjs-sdk-v#{version}-osx-#{arch}/nwjs.app" binary "nwjs-sdk-v#{version}-osx-#{arch}/nwjc" zap trash: [ "~/Library/Application Support/nwjs", "~/Library/Caches/nwjs", "~/Library/Preferences/io.nwjs.nwjs.plist", "~/Library/Saved Application State/io.nwjs.nwjs.savedState", ] end