phinze/homebrew-cask

View on GitHub
Casks/r/roblox.rb

Summary

Maintainability
A
35 mins
Test Coverage
cask "roblox" do
  arch arm: "arm64/"

  version "0.641.2.6410741,c4c244493d2e42fd"
  sha256 arm:   "52a3fbd3eeb9fcab10068bb409ea3accfd3f9c8543a2061a0ee425bb642ad589",
         intel: "a8e1df74312e969382589624f0f90d710b7c1e1ee8652e2c9989cef6e061c975"

  url "https://setup.rbxcdn.com/mac/#{arch}version-#{version.csv.second}-RobloxPlayer.zip",
      verified: "setup.rbxcdn.com/"
  name "Roblox"
  desc "Online multiplayer game platform"
  homepage "https://www.roblox.com/"

  livecheck do
    url "https://clientsettingscdn.roblox.com/v1/client-version/MacPlayer"
    strategy :json do |json|
      version = json["version"]
      client_version = json["clientVersionUpload"]&.split("-")&.second
      next if version.blank? || client_version.blank?

      "#{version},#{client_version}"
    end
  end

  auto_updates true
  depends_on macos: ">= :high_sierra"

  # The default installer installs the application as `Roblox.app` - so do the same for consistency
  app "RobloxPlayer.app", target: "Roblox.app"

  uninstall quit: "com.roblox.RobloxPlayer"

  zap trash: [
    "~/Library/Preferences/com.Roblox.Roblox.plist",
    "~/Library/Preferences/com.roblox.RobloxPlayer.plist",
    "~/Library/Preferences/com.roblox.RobloxPlayerChannel.plist",
  ]
end