Shabang-Systems / Condution

Tasks? Done. That was quick.
https://www.condution.com
GNU General Public License v3.0
455 stars 19 forks source link

FEAT brew cask #81

Open Jemoka opened 4 years ago

Jemoka commented 4 years ago

Is your feature request related to a problem? Please describe. The people want to distribute this app using a brew cask.

Describe the solution you'd like Submit the lovely project to brew for casking.

Additional context This discussion on Reddit

Exr0n commented 4 years ago

So how exactly do we do this? Just submit, or do we need to meet certain criteria?

xavdid commented 4 years ago

You can just submit, no extra criteria needed. There are instructions here.

Jemoka commented 4 years ago

Let's try to get 040 Brewed if possible

Exr0n commented 4 years ago

We need to use 2 spaces..?

https://github.com/Homebrew/homebrew-cask/blob/master/CONTRIBUTING.md#style-guide

Jemoka commented 4 years ago

I think their yaml needs to be that way, but not our codebase

mayurankv commented 7 months ago

Is this something that is still planned?

Jemoka commented 7 months ago

Ideally we will support the DMG distribution primarily; is there a particular use-case where brew cask is needed? Would love to bring this up again if it is.

mayurankv commented 7 months ago

As far as I'm aware setting up a brew cask is pretty simple and just involves linking to the dmg essentially. I can't speak for everyone but personally I prefer to install things via package managers so that if I change computer or system etc, I have a list of everything that was installed. It also makes ensuring things are up to date easily so I don't have to manually check for updates and redownload the dmg etc.

It's not essential but I think it would make it somewhat easier for people to install as well as find!

mayurankv commented 7 months ago

I've been meaning to look into how to create homebrew casks for a while so if this isn't something you're planning on, I may be able to try and work it out and create a pr if I can manage.

Jemoka commented 7 months ago

sure! if you want to take a crack at it, don't hesitate to let us know how we can help

mayurankv commented 7 months ago
cask "condution" do
  version "1.2.1"
  sha256 "a4e1a30d074e724ba24e9e2674a72bc4050f00161fb7dc23295a2c189ecda5bb"

  url "https://github.com/Shabang-Systems/Condution/releases/download/v#{version}/Condution-#{version}.dmg",
      verified: "github.com/Shabang-Systems/Condution/"
  name "Condution"
  desc "Condution is a project management system that makes sense and will not burn your pockets out."
  homepage "https://www.condution.com/"

  livecheck do
    url :url
    strategy :github_latest
  end

  app "Condution.app"

  zap trash: [
    "~/Library/Application Support/Condution",
    "~/Library/Logs/Condution",
    "~/Library/Preferences/Condution.plist",
    "~/Library/Saved Application State/Condution.savedState",
  ]
end

I believe this is the main body of what is needed. What would be helpful would be to tell me which locations need to be removed on uninstall (the lines in zap trash). Also are you happy with the description?

mayurankv commented 7 months ago

Then all that is needed is to follow the steps here. I'm happy to do this but it's rather simple and I think it would make more sense for a maintainer to do this in case more detail is needed at any point about the app.

mayurankv commented 7 months ago

Oh and I need to change the sha256 hash as well and the above file should be named condition.rb.

As you can see, all this really does is link to the dmg so no extra maintenance on your side would be needed once this is done.

Jemoka commented 7 months ago

wait—a little confused—how exactly does the DMG gets unpacked here?

mayurankv commented 7 months ago

When calling brew install --cask condution, the brew system will automatically download the dmg, unpack it and add it the Applications folder. All this cask does is point the homebrew system to your GitHub dmg release so it can download and unpack it as opposed to the user manacling downloading it and installing it.

In order to bump the version after an update, as the developer (or anyone who notices there has been an update) you just run brew bump --open-pr condution. This updates the version available from homebrew. The use can then install the updated version using brew upgrade condution (or generally just brew update and brew upgrade to update all installed packages).

On uninstall, homebrew removes the app from the Applications folder and removes any user data or remaining files, these are the paths specified in zap trash. That means if condution adds files to a location, these should be specified in that section so they can be removed on uninstall. For example, if condution added to XDG_CONFIG_HOME/.condutionrc, that should be specified below. If you tell me the locations of where the app installs files, I can double check and complete this section too.

mayurankv commented 7 months ago

The updated fully correct cask up to changes in the description and the files to remove on uninstall would be

cask "condution" do
  version "1.2.1"
  sha256 "3464f8f842eda86d5e0e9e96b6788908381df7068333c6ebeb234e3a683b8ffe"

  url "https://github.com/Shabang-Systems/Condution/releases/download/v#{version}/Condution-#{version}.dmg",
      verified: "github.com/Shabang-Systems/Condution/"
  name "Condution"
  desc "Condution is a project management system that makes sense and will not burn your pockets out."
  homepage "https://www.condution.com/"

  livecheck do
    url :url
    strategy :github_latest
  end

  app "Condution.app"

  zap trash: [
    "~/Library/Application Support/Condution",
    "~/Library/Logs/Condution",
    "~/Library/Preferences/Condution.plist",
    "~/Library/Saved Application State/Condution.savedState",
  ]
end

This file would be named condution.rb and added to the homebrew cask repository via pr. Then every time a new release is created, all that would need to be done is brew bump --open-pr condution.

Jemoka commented 7 months ago

still a little confused to how the .dmg is unpacked, but the rest looks good

mayurankv commented 7 months ago

Basically it just downloads it into a homebrew downloads folder, opens it like a user would, moves the app into Applications and ejects the dmg. I'm not familiar with the exact method it does this by but it's pretty much the same as a user install.

Are you happy with the description and the paths to remove on uninstall? Is there no other files to be removed?

EDIT: Seems just using hdutil (see here) and copying the .app across. Hence why you have to specify the app in the dmg.

Jemoka commented 7 months ago

afaik the description looks good and the paths are OK. Is there any way for us to test these locally?

mayurankv commented 7 months ago

Hmm I think it would involve you installing homebrew. Lmk if you're happy to do that, otherwise I can give it a go. There a pretty simple install script and everything it installs is to /opt/homebrew (and there is also an easy uninstall script). Honestly I'd recommend downloading it in general just because it makes it so much easier to download commandline tools.

mayurankv commented 7 months ago

Testing it would be done via this section: https://docs.brew.sh/Adding-Software-to-Homebrew#testing-and-auditing-the-cask

Jemoka commented 7 months ago

Ah sounds good. I already have brew installed, best wanted to check the recipe before it’s published

mayurankv commented 7 months ago

That's great. And then the only additional step would just be brew bump --open-pr condution on release of a new version!