ogpk
ogpk copied to clipboard
Better Homebrew Formula file
I found a code to create a Homebrew Formula file on the Makefile. https://github.com/almonk/ogpk/blob/b12259d737ddcbda650402f072e33c787b748bc5/Makefile#L32-L61
What do you think about these ideas?
-
Add a line
depends_on "timg"to make it a dependency and install it automatically. -
Make it possible to install not only macOS but also Linux.
-
How about using GoReleaser?
And why do you add these
ifconditions? For Rosetta 2? https://github.com/almonk/ogpk/blob/b12259d737ddcbda650402f072e33c787b748bc5/Makefile#L46-L52
My opinion is like this.
class Ogpk < Formula
desc "CLI tool to fetch OpenGraph data from a URL"
homepage "https://github.com/almonk/ogpk"
version "0.1.3"
depends_on "timg"
on_macos do
if Hardware::CPU.intel?
url "https://github.com/almonk/ogpk/releases/download/0.1.3/ogpk-0.1.3-darwin-amd64"
sha256 "e5006c7fcd6f7337cb5a77ae2ba4fb531728e9fff8f882f36139fbaed92baa63"
def install
bin.install "ogpk-#{version}-darwin-amd64" => name.to_s
end
end
if Hardware::CPU.arm?
url "https://github.com/almonk/ogpk/releases/download/0.1.3/ogpk-0.1.3-darwin-arm64"
sha256 "296ec2d80a2de5d711e438827e27d76ec1b5ba31690af39f38668921f9ec1a4e"
def install
bin.install "ogpk-#{version}-darwin-arm64" => name.to_s
end
end
end
on_linux do
if Hardware::CPU.intel?
url "https://github.com/almonk/ogpk/releases/download/0.1.3/ogpk-0.1.3-linux-amd64"
sha256 "e821b6ba9c6cd27628caa9a50fa2c48dc81f08f2d3284128b49eaba583c2f2f3"
def install
bin.install "ogpk-#{version}-linux-amd64" => name.to_s
end
end
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
url "https://github.com/almonk/ogpk/releases/download/0.1.3/ogpk-0.1.3-linux-arm64"
sha256 "3a203121f68edc135a7bc79756d74c6f3d0438af7c5674b75d873019cf9eadc1"
def install
bin.install "ogpk-#{version}-linux-arm64" => name.to_s
end
end
end
end
@5ouma i like these ideas a lot! would you like to add a PR?
I'd like to make these changes when I have time.
How do you feel about GoReleaser? If you introduce it to this project, it will become much easier to make GitHub Releases and publish Formula files. However, of course, mastering GoReleaser is harder than just modding the Makefile.
Also, I have another idea to keep up-to-date with the Formula file. When a new release has been created, you can update its file by brew bump-formula-pr ogpk --version=<version>.
If you run this command, a PR will be created to almonk/homebrew-ogpk like https://github.com/5ouma/homebrew-cask/pull/7.
The command automatically updates its version and hash.
@5ouma oh thanks for the tip! – I'll look into it.