vv9k / epick

Color picker for creating harmonic color palettes that works on Linux, Windows, macOS and web.
GNU General Public License v3.0
101 stars 2 forks source link

Homebrew #39

Open Jomy10 opened 2 years ago

Jomy10 commented 2 years ago

I have added Homebrew support.

Instructions for building:

In /scripts/homebrew

./build_homebrew.sh

This script will build the app with cargo and copy it to app/epick.app. Afterwards, epick.app is archived to a .tar.gz.

The epick.app.tar.gz must then be uploaded somewhere so it can be downloaded, like to GitHub's Releases. When uploaded, copy the link to the file and run

VERSION={CURRENT_VERSION} URL="{URL}" ./build_cask.sh > path/to/Casks/epick.rb

Where CURRENT_VERSION is the current version of the app (e.g. 0.6.1) and URL is the url of the .tar.gz file.

Now you will need a repo called homebrew-epick. You can copy mine: https://github.com/Jomy10/homebrew-epick.

Lastly: replace path/to/Casks/epick.rb with the path to your local copy of the epick.rb of the homebrew-epick repo.

Now just commit & push to GitHub and you should be able to install epick from Homebrew:

brew tap vv9k/epick && brew install --cask epick
Jomy10 commented 2 years ago

Linked issue: #23

Jomy10 commented 2 years ago

Forgot to mention as well, we can add the cask to the Homebrew repo. I haven't tried this out, but I can look into it, if this is good?

vv9k commented 2 years ago

Thanks for the PR! Awesome work :) Will test it out on my mac later when I get some time.

Forgot to mention as well, we can add the cask to the Homebrew repo. I haven't tried this out, but I can look into it, if this is good?

Sounds good to me!

I just have one question, does the archive epick.app.tar.gz have to be commited in? And what is the content of this archive? Perhaps it would be better to add it to .gitignore along with all generated icons if they are not necessary to be present in the repo for the cask to work. I don't have prior experience with creating new homebrew formulae but from what I remember it usually used to be just one ruby file called formulae that would contain the whole build description. Has anything changed since then?

Jomy10 commented 2 years ago

The epick.app.tar.gz and all the generated icons doesn't need to be in the repo for homebrew to work. The archive only needs to be uploaded somewhere (like GitHub Releases). The content of this file is just the epick.app located in scripts/homebrew/app, which is essentially just a wrapper around the executable file generated by the rust compiler (with some necessary config files and the app icon).

I don't have prior experience with creating new homebrew formulae but from what I remember it usually used to be just one ruby file called formulae that would contain the whole build description. Has anything changed since then?

Yup, that single ruby file (located in my homebrew-epick repo) is what the VERSION={CURRENT_VERSION} URL="{URL}" ./build_cask.sh > path/to/Casks/epick.rb command generates. But, since we are dealing with a GUI application, we can't use a formulae (those are for CLI's), but instead a Cask. They are pretty similar.

I'll look into adding the app to the Homebrew repo once you have uploaded the archive file. Let me know if you have any further questions.

vv9k commented 2 years ago

Sorry for my late answer, I've been pretty busy lately.

I was wondering that perhaps it would be better to assemble this archive with all the icons during the CI release build so that it's added along with all other release archives. Would you be willing to update the current CI to include the archive? I'm not sure what are the instructions to create it. It would have to be added somewhere here: https://github.com/vv9k/epick/blob/771c0cbddeafe980ac26f77d4ee93a7762d6e8ab/.github/workflows/release.yml#L63-L158

Jomy10 commented 2 years ago

Hi. No problem.

I haven’t used CI too much, but I’ll try to implement this!