weavejester / cljfmt

A tool for formatting Clojure code
Eclipse Public License 1.0
1.12k stars 119 forks source link

Homebrew #320

Open dpassen opened 1 year ago

dpassen commented 1 year ago

Please consider adding the precompiled binaries to homebrew. Would make my team's bootstrap process (a Brewfile) a lot easier than piping a curl request to bash

weavejester commented 1 year ago

This seems like a good idea. If anyone wants to contribute a homebrew recipe for cljfmt, I'd be very appreciative.

dpassen commented 1 year ago

I started to take a look at what's entailed (https://github.com/Homebrew/homebrew-cask/commit/d7e5c4417de904d1650416f0754d03e50d034d7e) and when I audit the recipe,

$ brew audit --new-cask cljfmt
==> Downloading https://github.com/weavejester/cljfmt/releases/download/0.11.2/cljfmt-0.11.2-darwin-amd64.tar.gz
Already downloaded: /Users/dpassen/Library/Caches/Homebrew/downloads/706494976ae0e50b6bd28e2617ee8b8028806f36f4dbe96c04d96ad226d85beb--cljfmt-0.11.2-darwin-amd64.tar.gz
==> Downloading https://github.com/weavejester/cljfmt/releases/download/0.11.2/cljfmt-0.11.2-darwin-amd64.tar.gz
Already downloaded: /Users/dpassen/Library/Caches/Homebrew/downloads/706494976ae0e50b6bd28e2617ee8b8028806f36f4dbe96c04d96ad226d85beb--cljfmt-0.11.2-darwin-amd64.tar.gz
audit for cljfmt: failed
 - Signature verification failed:
/private/tmp/d20231005-32724-1kmtepo/cljfmt: rejected

macOS on ARM requires software to be signed.
Please contact the upstream developer to let them know they should sign and notarize their software.
cljfmt
  * line 9, col 2: Signature verification failed:
    /private/tmp/d20231005-32724-1kmtepo/cljfmt: rejected

    macOS on ARM requires software to be signed.
    Please contact the upstream developer to let them know they should sign and notarize their software.
Error: 1 problem in 1 cask detected.

Not sure if that's easy or not.

weavejester commented 1 year ago

Looks like I need a developer certificate, and then we'll set up a GitHub action to sign the MacOS ARM binary. It might be a while before I get around to doing that.

raszi commented 9 months ago

In the meantime what you could do is to support a Homebrew tap.

I created my version here: https://github.com/raszi/homebrew-tap/blob/master/cljfmt.rb

weavejester commented 9 months ago

Does that Homebrew tap actually work? I thought the binary would still require a signature?

raszi commented 9 months ago

It works for me on 13.6.1 (22G313):

$ brew tap raszi/tap  
==> Tapping raszi/tap
Cloning into '/opt/homebrew/Library/Taps/raszi/homebrew-tap'...
remote: Enumerating objects: 97, done.
remote: Counting objects: 100% (50/50), done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 97 (delta 32), reused 43 (delta 27), pack-reused 47
Receiving objects: 100% (97/97), 17.40 KiB | 1.02 MiB/s, done.
Resolving deltas: 100% (54/54), done.
Tapped 6 formulae (21 files, 36.5KB).
$ brew install cljfmt
==> Fetching raszi/tap/cljfmt
==> Downloading https://github.com/weavejester/cljfmt/releases/download/0.12.0/cljfmt-0.12.0-darwin-aarch64.tar.gz
Already downloaded: /Users/ikaraszi/Library/Caches/Homebrew/downloads/8533e7b608b29aa0c2a6c5ceacef537c7622acb23e27c317691bb405ec027b28--cljfmt-0.12.0-darwin-aarch64.tar.gz
==> Installing cljfmt from raszi/tap
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Settings.

If that doesn't show you any updates, run:
  sudo rm -rf /Library/Developer/CommandLineTools
  sudo xcode-select --install

Alternatively, manually download them from:
  https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 15.1.

🍺  /opt/homebrew/Cellar/cljfmt/64: 3 files, 35.3MB, built in 1 second
==> Running `brew cleanup cljfmt`...
weavejester commented 9 months ago

And when you run the cljfmt installed via the tap, it works and doesn't complain about not being signed?

raszi commented 9 months ago

Nope, no warnings:

$ which cljfmt
/opt/homebrew/bin/cljfmt
$ cljfmt
Usage:
        cljfmt (check | fix) [PATHS...]
Options:
  -h, --help
      --version
  -q, --quiet
  -v, --verbose
      --[no-]parallel                              false
      --project-root PROJECT_ROOT                  .
      --file-pattern FILE_PATTERN                  \.clj[csx]?$
      --config CONFIG_FILE
      --[no-]ansi                                  true
      --[no-]indentation                           true
      --[no-]remove-multiple-non-indenting-spaces  false
      --[no-]remove-surrounding-whitespace         true
      --[no-]remove-trailing-whitespace            true
      --[no-]insert-missing-whitespace             true
      --[no-]remove-consecutive-blank-lines        true
      --[no-]split-keypairs-over-multiple-lines    false
      --[no-]sort-ns-references                    false
      --function-arguments-indentation STYLE       community     STYLE may be community, cursive, or zprint

But please notice that I am not using macOS Sonoma but Ventura. This might be a new addition.

raszi commented 3 months ago

I upgraded to Sonoma since then and there are still no issues.

dpassen commented 3 months ago

I think the signing issue is only for recipes directly a part of homebrew. For third-party taps, it's relaxed.