Code Monkey home page Code Monkey logo

Comments (24)

baggiponte avatar baggiponte commented on June 12, 2024 3

I too thought it could be complex. Turns out, it is quite easy:

Here's what I went through as macOS user:

  1. Fork homebrew-core.
  2. Toggle brew developer on. This will activate homebrew "developer mode", i.e. homebrew is just a GH repo: now when you run brew update you will trigger a git pull in your local clone from the master branch.
  3. Run brew update.
  4. Run cd (brew --repository homebrew/core) to cd into the repo.
  5. Create a new branch
  6. Add my fork as a remote repo
  7. Run brew create --set-name=bob-nvim --rust https://github.com/MordechaiHadad/bob/archive/refs/tags/v2.4.1.tar.gz
    The URL is the url of the latest version of bob that I got from bob tags page
  8. Commit and push to my fork.
  9. Open a PR to homebrew/core to have your formula reviewed (I guess) and merged.

Some more details are at the url I referenced at the top (here too) which is a comment on a similar issue I opened in ttyper. The only hassle I see with maintaining a homebrew formula is to create a CI/CD workflow to bump the version in the formula itself (the one generated at step 7) and open a similar PR. Depends on how often you plan to release.

from bob.

Amar1729 avatar Amar1729 commented on June 12, 2024 3

Hey all, went ahead and made a PR for adding this to homebrew.

@MordechaiHadad fyi, you can make contributions to Homebrew from linux (as brew supports installing formulae on Linux as well) but depending on the package it can feel more streamlined on macOS.

from bob.

MordechaiHadad avatar MordechaiHadad commented on June 12, 2024 2

sounds like a good idea, unfortunately I am a bit too busy with other projects.
If you want you can create a PR to do it until I manage to learn and do it

from bob.

MordechaiHadad avatar MordechaiHadad commented on June 12, 2024 1

awesome! could you elaborate a bit on how homebrew repos work exactly? in Arch linux user repo(AUR) you have to create an account, create a repo with the specification of the package and push it to the repo

from bob.

MordechaiHadad avatar MordechaiHadad commented on June 12, 2024 1

@baggiponte no problem, sure go ahead lol.

from bob.

Subjective avatar Subjective commented on June 12, 2024 1

Just wanted to point out that you can also have homebrew automatically setup shell completions (see zoxide or rtx for examples).

from bob.

MordechaiHadad avatar MordechaiHadad commented on June 12, 2024 1

@Amar1729 thats awesome thank you

from bob.

Amar1729 avatar Amar1729 commented on June 12, 2024 1

Merged 👍 (i can submit a minor update with instructions to the README in a bit)

also, there is a bump-formulae GitHub Action that could be used by this repo's CI workflows on release to automatically submit PRs to homebrew, but I'm not as familiar with using it. Also not sure if it's worth it, depending on how frequently new releases happen.

from bob.

baggiponte avatar baggiponte commented on June 12, 2024 1

Thanks @Amar1729! Just installed bob with brew and it went smoothly. Guess we can close this issue!

from bob.

baggiponte avatar baggiponte commented on June 12, 2024

Would love to! I should have time to work on a draft PR by the weekend.

from bob.

tnxz avatar tnxz commented on June 12, 2024

any update on this brew formula yet

from bob.

MordechaiHadad avatar MordechaiHadad commented on June 12, 2024

I plan on adding it, but I barely get the time to do so.

from bob.

tnxz avatar tnxz commented on June 12, 2024

sure thanks for the heads up

from bob.

baggiponte avatar baggiponte commented on June 12, 2024

My bad too, barely have time. I am still interested, if you don't mind the waiting I'll gladly take it.

from bob.

MordechaiHadad avatar MordechaiHadad commented on June 12, 2024

I too thought it could be complex. Turns out, it is quite easy:

Here's what I went through as macOS user:

1. Fork [homebrew-core](https://github.com/Homebrew/homebrew-core).

2. Toggle `brew developer on`. This will activate homebrew "developer mode", i.e. homebrew is just a [GH repo](https://github.com/Homebrew/homebrew-core): now when you run brew update you will trigger a git pull in your local clone from the master branch.

3. Run `brew update`.

4. Run `cd (brew --repository homebrew/core)` to cd into the repo.

5. Create a new branch

6. Add my fork as a remote repo

7. Run `brew create --set-name=bob-nvim --rust https://github.com/MordechaiHadad/bob/archive/refs/tags/v2.4.1.tar.gz`
   The URL is the url of the latest version of bob that I got from [bob tags page](https://github.com/MordechaiHadad/bob/archive/refs/tags)

8. Commit and push to my fork.

9. Open a PR to homebrew/core to have your formula reviewed (I guess) and merged.

Some more details are at the url I referenced at the top (here too) which is a comment on a similar issue I opened in ttyper. The only hassle I see with maintaining a homebrew formula is to create a CI/CD workflow to bump the version in the formula itself (the one generated at step 7) and open a similar PR. Depends on how often you plan to release.

Do I have to use macOS for this?

from bob.

MordechaiHadad avatar MordechaiHadad commented on June 12, 2024

Thanks awesome thank you for your work, regarding GH action idk if it's necessary at this point bob is complete-ish so releases are a lot slower now

from bob.

MordechaiHadad avatar MordechaiHadad commented on June 12, 2024

@Amar1729 what does one have to change in the formula file to indicate an update?

from bob.

Amar1729 avatar Amar1729 commented on June 12, 2024

@MordechaiHadad if nothing changes about the build or test process, generally you only need to change the url and sha256. Homebrew's CI will update the bottles stanza for you during merge.

from bob.

MordechaiHadad avatar MordechaiHadad commented on June 12, 2024

@MordechaiHadad if nothing changes about the build or test process, generally you only need to change the url and sha256. Homebrew's CI will update the bottles stanza for you during merge.

Oh okay, how do you regenerate new sha256 hashes though?

from bob.

Amar1729 avatar Amar1729 commented on June 12, 2024

how do you regenerate new sha256 hashes

There are a couple ways.

  1. In practice, what I frequently do is change just the url, then (on my local machine), run brew install <whatever>. Homebrew will download the .tar.gz, then warn that the hash doesn't match along with the actual value. Then I just copy the actual value in to the formula file, rerun brew install to test, and make a commit+pr.

  2. There is probably a "better" way to do it with brew bump-formula-pr, which i think is something like brew bump-formula-pr --dry-run --url <url> (and brew will try to determine the new hash if not given?)

  3. If you don't have brew installed locally, you could simply download the .tar.gz from a release yourself and check the hash (e.g. sha265sum whatever.tar.gz).

If you want to do it from within CI, there might be a homebrew action you can use? if not, you would simply do something like (2) in a new manually defined action step using brew (can be installed on macOS or linux) and pass the url from a new release that's been made by a previous CI step

from bob.

MordechaiHadad avatar MordechaiHadad commented on June 12, 2024

how do you regenerate new sha256 hashes

There are a couple ways.

1. In practice, what I frequently do is change _just_ the url, then (on my local machine), run `brew install <whatever>`. Homebrew will download the .tar.gz, then warn that the hash doesn't match along with the actual value. Then I just copy the actual value in to the formula file, rerun `brew install` to test, and make a commit+pr.

2. There is probably a "better" way to do it with `brew bump-formula-pr`, which i think is something like `brew bump-formula-pr --dry-run --url <url>` (and `brew` will try to determine the new hash if not given?)

3. If you don't have brew installed locally, you could simply download the .tar.gz from a release yourself and check the hash (e.g. `sha265sum whatever.tar.gz`).

If you want to do it from within CI, there might be a homebrew action you can use? if not, you would simply do something like (2) in a new manually defined action step using brew (can be installed on macOS or linux) and pass the url from a new release that's been made by a previous CI step

Anyway I can do it on windows? my WSL arch installed is fucked.

from bob.

Amar1729 avatar Amar1729 commented on June 12, 2024

Hm - not sure how to check hashes of filles on win of the top of my head but I'd assume there's a powershell cmdlet/windows command to get the hash of a file? If not, could probably just look up "sha256 hash site"? After that, it really is just a change to two lines of a ruby file in a git repo.

from bob.

MordechaiHadad avatar MordechaiHadad commented on June 12, 2024

@Amar1729 what was that CI u mentioned

from bob.

Amar1729 avatar Amar1729 commented on June 12, 2024

@MordechaiHadad I could draw up an outline for the ci in a new issue to avoid pinging everyone subscribed to this one

from bob.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.