We should publish Mac installers as formulae in homebrew.
I feel like I got the formula to a decent place and we can start talking about it.
Spoiler: I'm new to Rust/Cargo and how the build system works don't yell at me for doing silly things π¬
There is already a cask package called "notion", see here. I'd say we can name ours notion-cli, or we can keep it as notion (since cask packages and regular ones have different registries).
I personally would go with notion-cli, but I'd love your thoughts @dherman.
The formula itself (snippet below) gets generated automatically by running:
brew create https://dl.dropboxusercontent.com/s/rawxzfb4fsruu14/notion-cli-0.1.0.tgz
Properties and methods like desc, homepage, depends_on, install and test were added by me. File name has to contain 0.1.0 so we don't specify it in the formula itself via version property.
I hacked together a notion-cli archive just to get started, it contains:
$ tree -L 1 homebrew
homebrew
βββ Cargo.lock
βββ Cargo.toml
βββ build.sh
βββ crates
βββ install.sh
βββ install.sh.in
βββ src
Once the folder is downloaded, we run cargo build and then build and install scripts. From then on, notion should be available and good to go.
Also, I believe we can remove the code from install.sh.in which adds notion binary to the PATH and replace it with bin.install in the recipe.
class NotionCli < Formula
desc "The hassle-free node.js manager"
homepage "https://github.com/notion-cli/notion"
url "https://dl.dropboxusercontent.com/s/rawxzfb4fsruu14/notion-cli-0.1.0.tgz"
sha256 "90f96b6c7e33593acb0dfb6917461e9dbc095f4c71bf6ea06a75b06638f4aa18"
depends_on "rust" => :build
def install
system "cargo", "build", "--release"
system "./build.sh",
"./target/release/notion",
"./target/release/node",
"./target/release/launchbin",
"./target/release/launchscript"
system "./install.sh"
end
test do
assert_equal "The hassle-free node.js manager", (system "notion -V")
end
end
Homebrew documentation suggest we run brew audit command on a newly generated formula to make sure we adhere to their standards.
Audit showed that we are not notable enough yet:
$ brew audit --new-formula notion-cli
notion-cli:
* GitHub repository not notable enough (<20 forks, <20 watchers and <50 stars)
Error: 1 problem in 1 formula
I'm not sure what to do about the above yet, let's discuss.
Has anyone circled back to this? It'd be cool to get this in now since it appears that the repo is notable enough now.
@dherman now that this project has been renamed to volta, any plans on adding a homebrew formula?
@dherman is there anything the project needs to help make this happen?
I've created a simple formula that might be a good starting point. It's available here.
The formula does not build from source but uses the tar. I wanted to make sure the installation was as close to using curl https://get.volta.sh | bash. The only thing the Formula doesn't do currently is running volta setup. Whenever I try to run volta setup during the installation process, I get an error saying that volta couldn't find any of the profiles to edit. I'm looking into it, but I have very little experience with homebrew formula
Update: I've opened a pull-request to homebrew/homebrew-core
While working on the formula for Homebrew I've encountered an issue and I'm not sure if I should file this as a separate bug, but the installation script from brew is not able to run volta setup:
error: Could not locate user profile.
Tried $PROFILE (), ~/.bashrc, ~/.bash_profile, ~/.zshrc, ~/.profile, and ~/.config/fish/config.fish
Please create one of these and try again; or you can edit your profile manually to add '/Users/filipekiss/.volta/bin' to your PATH
Running volta setup as soon as the installation is finished works as intended.
I think this has something to do with Homebrew's superenv so I'm not sure if it's worthing pursuing this.
Anyone who has access to a macOS Catalina can try to help me debug the formula? I'm getting an error when building to Catalina during the CI step for the pull-request and I'm not able to figure out how to deal with it since I don't have access to Catalinaβ¦
It looks like this was completed some time ago thanks to @filipekiss!
Most helpful comment
I've created a simple formula that might be a good starting point. It's available here.
The formula does not build from source but uses the tar. I wanted to make sure the installation was as close to using
curl https://get.volta.sh | bash. The only thing the Formula doesn't do currently is runningvolta setup. Whenever I try to runvolta setupduring the installation process, I get an error saying that volta couldn't find any of the profiles to edit. I'm looking into it, but I have very little experience with homebrew formulaUpdate: I've opened a pull-request to homebrew/homebrew-core