-
Notifications
You must be signed in to change notification settings - Fork 2
Add jsonschema formula (Linux + macOS) and deprecate cask #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
9dfccd3
a22a70a
3f166a7
7599f5d
0c21d67
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,23 +1,26 @@ | ||
| cask "jsonschema" do | ||
| version "14.14.2" | ||
|
|
||
| arch arm: "arm64", intel: "x86_64" | ||
|
|
||
| version "14.14.2" | ||
| sha256 arm: "ae73b90e79a7e587f05d722de502b31eeb701b072e2563c38d717388a5c6e785", | ||
| intel: "dc6b99a44a1e9d002e7c534cec452fe351ae63791dfdd65e147a327c64974d51" | ||
|
|
||
| url "https://github.com/sourcemeta/jsonschema/releases/download/v#{version}/jsonschema-#{version}-darwin-#{arch}.zip" | ||
| name "JSON Schema CLI" | ||
| desc "The CLI for working with JSON Schema" | ||
| desc "CLI for working with JSON Schema" | ||
| homepage "https://github.com/sourcemeta/jsonschema" | ||
|
|
||
| deprecate! date: "2026-03-11", because: "it moved to a formula; uninstall with: brew uninstall --cask jsonschema" | ||
|
|
||
| binary "jsonschema-#{version}-darwin-#{arch}/bin/jsonschema" | ||
| bash_completion "jsonschema-#{version}-darwin-#{arch}/share/bash-completion/completions/jsonschema" | ||
| zsh_completion "jsonschema-#{version}-darwin-#{arch}/share/zsh/site-functions/_jsonschema" | ||
|
|
||
| postflight do | ||
| system_command "xattr", args: ["-c", "#{staged_path}/jsonschema-#{version}-darwin-#{arch}/bin/jsonschema"] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You need this on the formula on macOS, otherwise the systen complains the binary is not code signed
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Im definitely mac clueless. |
||
| # As a test | ||
| system_command "#{staged_path}/jsonschema-#{version}-darwin-#{arch}/bin/jsonschema" | ||
|
|
||
| puts "" | ||
| puts "Tip: Try the Sourcemeta Studio VS Code extension for an enhanced experience!" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also keep this little note? |
||
| puts " Open in VS Code: vscode:extension/sourcemeta.sourcemeta-studio" | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,60 @@ | ||||||
| class Jsonschema < Formula | ||||||
| desc "CLI for working with JSON Schema" | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Just to match the old one?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Random consistency edit...
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consistency with what? Is this a Homebrew convention? |
||||||
| homepage "https://github.com/sourcemeta/jsonschema" | ||||||
| version "14.14.2" | ||||||
| license "AGPL-3.0-only" | ||||||
|
|
||||||
| on_macos do | ||||||
| on_arm do | ||||||
| url "https://github.com/sourcemeta/jsonschema/releases/download/v#{version}/jsonschema-#{version}-darwin-arm64.zip" | ||||||
| sha256 "ae73b90e79a7e587f05d722de502b31eeb701b072e2563c38d717388a5c6e785" | ||||||
| end | ||||||
|
|
||||||
| on_intel do | ||||||
| url "https://github.com/sourcemeta/jsonschema/releases/download/v#{version}/jsonschema-#{version}-darwin-x86_64.zip" | ||||||
| sha256 "dc6b99a44a1e9d002e7c534cec452fe351ae63791dfdd65e147a327c64974d51" | ||||||
| end | ||||||
| end | ||||||
|
|
||||||
| on_linux do | ||||||
| on_arm do | ||||||
| url "https://github.com/sourcemeta/jsonschema/releases/download/v#{version}/jsonschema-#{version}-linux-arm64.zip" | ||||||
| sha256 "cb8fd293ead5bb68be931d23b81c8d2278d047defb91b27e2d2892704211c198" | ||||||
| end | ||||||
|
|
||||||
| on_intel do | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. BTW note that we offer a musl x86 binary. Is there a way to correctly use it on musl systems? Not a blocker, as its more of a bonus thing, but I wonder if it is possible
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Im honestly not sure how you specify a musl variant in brew. Brew itself would have to have dependencies on musl libraries being available I think, either that or the OS itself needs to ensure they are there. |
||||||
| url "https://github.com/sourcemeta/jsonschema/releases/download/v#{version}/jsonschema-#{version}-linux-x86_64.zip" | ||||||
| sha256 "6473ee098c77d93afa15f4237c6e0fd2ce6cf3105d00ddb097cad1cf8b2f368e" | ||||||
| end | ||||||
| end | ||||||
|
|
||||||
| # jsonschema was previously distributed as a cask. The conflicts_with stanza | ||||||
| # blocks installation if the cask is still present, with a clear error telling | ||||||
| # the user to run: | ||||||
| # brew uninstall --cask sourcemeta/apps/jsonschema | ||||||
| conflicts_with cask: "sourcemeta/apps/jsonschema", because: "both install a `jsonschema` binary" | ||||||
cavanaug marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
|
|
||||||
| def install | ||||||
| # Homebrew auto-chdirs into the single top-level directory of the zip, | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this comment can go away too |
||||||
| # so bin/ and share/ are directly accessible here. | ||||||
| bin.install "bin/jsonschema" | ||||||
| bash_completion.install "share/bash-completion/completions/jsonschema" | ||||||
| zsh_completion.install "share/zsh/site-functions/_jsonschema" | ||||||
| end | ||||||
|
|
||||||
| def post_install | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add the |
||||||
| caskroom = HOMEBREW_CASKROOM/"jsonschema" | ||||||
| return unless caskroom.exist? | ||||||
|
|
||||||
| opoo <<~EOS | ||||||
| A Cask installation of jsonschema was detected at #{caskroom}. | ||||||
| The cask has been superseded by this formula. To complete migration, run: | ||||||
| brew uninstall --cask sourcemeta/apps/jsonschema | ||||||
| brew install sourcemeta/apps/jsonschema | ||||||
| EOS | ||||||
| end | ||||||
|
|
||||||
cavanaug marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| test do | ||||||
| system bin/"jsonschema", "--version" | ||||||
| end | ||||||
| end | ||||||
Uh oh!
There was an error while loading. Please reload this page.