Skip to content
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

publish in homebrew #16

Closed
dherman opened this issue Jan 14, 2018 · 8 comments
Closed

publish in homebrew #16

dherman opened this issue Jan 14, 2018 · 8 comments

Comments

@dherman
Copy link
Collaborator

dherman commented Jan 14, 2018

We should publish Mac installers as formulae in homebrew.

@twokul
Copy link
Contributor

twokul commented Apr 28, 2018

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 😬

Name

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.

Homebrew formula

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

Audit

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.

@claydiffrient
Copy link

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.

@alizain
Copy link

alizain commented Dec 21, 2019

@dherman now that this project has been renamed to volta, any plans on adding a homebrew formula?

@cowboy
Copy link

cowboy commented Feb 12, 2020

@dherman is there anything the project needs to help make this happen?

@filipekiss
Copy link

filipekiss commented Mar 3, 2020

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

@filipekiss
Copy link

filipekiss commented Mar 4, 2020

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.

@filipekiss
Copy link

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…

@charlespierce
Copy link
Contributor

It looks like this was completed some time ago thanks to @filipekiss!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants