Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions Casks/s/sqlcl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,26 @@
regex(/href=.*?sqlcl[._-]v?(\d+(?:\.\d+)+)\.zip/i)
end

depends_on formula: "openjdk@11"

stage_only true

zap trash: "~/.sqlcl"
postflight do
cask_dir = Pathname("#{HOMEBREW_PREFIX}/Caskroom/sqlcl")
version_dir = cask_dir/version
latest_dir = cask_dir/"latest"

caveats do
depends_on_java "11+"
path_environment_variable "#{staged_path}/sqlcl/bin"
latest_dir.delete if latest_dir.symlink?

latest_dir.make_symlink(version_dir)
end
Comment on lines 15 to 25
Copy link
Copy Markdown
Member

@bevanjkay bevanjkay Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
stage_only true
zap trash: "~/.sqlcl"
postflight do
cask_dir = Pathname("#{HOMEBREW_PREFIX}/Caskroom/sqlcl")
version_dir = cask_dir/version
latest_dir = cask_dir/"latest"
caveats do
depends_on_java "11+"
path_environment_variable "#{staged_path}/sqlcl/bin"
latest_dir.delete if latest_dir.symlink?
latest_dir.make_symlink(version_dir)
end
binary "sqlcl/bin/sql", target: "sqlcl"

This should allow us to avoid the entire postflight block, and the need to add the binary to path at all.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be good but unfortunately, thats not how we ship the code everywhere else. It’s known everywhere as a sql prompt. I’m open to other suggestions. Ultimately, even this way, we;d be adding a soft link to link it to sql or telling customers to add a link to link sqlcl to sql in their environment

Copy link
Copy Markdown
Member

@bevanjkay bevanjkay Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe when it is shipped directly from the developer, but the current cask file results in a bad user experience because it is not compatible with Homebrew API. We really shouldn't be shipping custom logic like this in homebrew-cask.

Regarding how the code is shipped "everywhere else".

It's shipped as sqlcl by nixpkg - https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/sq/sqlcl/package.nix
It's shipped as both sql and sqlcl by AUR - https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=sqlcl
It's shipped as sqlcl by slackbuilds - https://slackbuilds.org/slackbuilds/15.0/development/sqlcl/sqlcl.SlackBuild

All this to say that installing sqlcl as sqlcl is a common way to install the binary with a Package Manager.


zap trash: "~/.sqlcl"

caveats <<~EOS
sqlcl requires Java 11 or later.

To use sqlcl, add the following to your shell PATH:
export PATH="#{HOMEBREW_PREFIX}/Caskroom/sqlcl/latest/sqlcl/bin:$PATH"
EOS
end
Loading