Skip to content

Commit

Permalink
j 9.5.2
Browse files Browse the repository at this point in the history
The `livecheck` block checks the upstream Installation wiki page but
this only lists major/minor release versions. To identify subsequent
patch versions (e.g., 9.5.2), we have to check the download page for
a given release, which links to dmg files like `j9.5.2_mac64.zip`.
  • Loading branch information
samford committed May 5, 2024
1 parent a7813f6 commit a4d2b90
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Casks/j/j.rb
@@ -1,8 +1,8 @@
cask "j" do
version "9.5"
version "9.5.2"
sha256 "78efb1db5423939e776f0053ff074a5c641b376e0517ded04773e38c001609c5"

url "https://www.jsoftware.com/download/j#{version}/install/j#{version}_mac64.zip"
url "https://www.jsoftware.com/download/j#{version.major_minor}/install/j#{version}_mac64.zip"
name "J"
desc "Programming language for mathematical, statistical and logical analysis of data"
homepage "https://www.jsoftware.com/"
Expand All @@ -14,7 +14,19 @@

livecheck do
url "https://code.jsoftware.com/wiki/System/Installation"
regex(/Jv?(\d+(?:\.\d+)+)\srelease/i)
regex(/Jv?(\d+(?:\.\d+)+)\s+release/i)
strategy :page_match do |page, regex|
# Identify partial release version (e.g., J1.2) on installation page
release = page.scan(regex)
.flatten
.max_by { |v| Version.new(v) }
next if release.blank?

# Fetch the release install page (containing full versions like 1.2.3)
install_page = Homebrew::Livecheck::Strategy.page_content("https://www.jsoftware.com/download/j#{release}/install/")
install_page[:content]&.scan(/href=.*?j[._-]?v?(\d+(?:\.\d+)+)[._-]mac/i)
&.map { |match| match[0] }
end
end

installer script: "j#{version}/macos-fix.command"
Expand Down

0 comments on commit a4d2b90

Please sign in to comment.