homebrew formula for git-stack
brew tap magus/git-stack
brew install git-stackUse the Formula Cookbook to generate a local formula for testing.
Most of the work is done under Formula/git-stack.core.rb using the templates/git-stack.core.rb.template.
The formula are build as a part of the publish process in magus/git-stack-cli.
-
Run a command like below to create the local formula you will use to test and submit to
homebrew/corebrew create --node https://registry.npmjs.org/git-stack-cli/-/git-stack-cli-1.15.1.tgz
-
Copy the contents of
Formula/git-stack.core.rbinto the generated local formula -
Install the formula, note the path to the source file generated by
brew createabovebrew install --verbose --build-from-source /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/g/git-stack-cli.rb
-
After install you can test the formula
brew test git-stack-cli -
Use the command below to audit the formula
brew audit --new git-stack-cli
In order to submit to core the Github repo needs to be notable enough 75+ stars, 30+ forks, 30+ watchers, etc.
Until that time it is simpler to just do a tap and install binaries directly, bypassing homebrew/core.
When running brew audit --new git-stack we receive the error below
❯ brew audit --new git-stack
git-stack
* GitHub repository not notable enough (<30 forks, <30 watchers and <75 stars)
Error: 1 problem in 1 formula detected.git-stack.core.rb.template does the full build of the single-file executable for the appropriate target platform.
However this is an expensive operation and takes a long time since it requires fetching the node binary to bundle alongside git-stack.
In homebrew/core this would generate a bottle for all the platforms and not really be an issue since most installs
would use the prebuilt bottle.
git-stack.tap.rb.template on the other hand, leverages prebuilt binaries attached to Github.
This allows us to build the binaries once time for all targets and download them directly in the formula.
This gets around the otherwise prohibitively long install time.
git submodule add https://github.com/magus/homebrew-git-stack-cli homebrew
git submodule init
git submodule update
git add .gitmodules homebrew
git commit
git pushafter cloning
git submodule update --init --recursiveBun formula was very informative on how to handle CPU architectures etc.
https://github.com/oven-sh/homebrew-bun/blob/main/Formula/bun.rb