Homebrew tap formula(s) for Dream11 tools.
brew tap dream11/tools
brew install dream11/tools/<formula name>
Can run directly without running
brew tap
.
Example
brew install dream11/tools/odin
+-- homebrew-tools
+-- formula
+-- tool.rb
+-- lib
+-- function.rb
Contains all installation formula(s).
Contains all library functions required by the formula(s).
Importing library from formula/lib/library.rb
require_relative "lib/library"
class Odin < Formula
desc "Formula description"
homepage "https://github.com/dream11/tool-name"
version "1.0.0"
# add installation steps here
end
For a repository github.com/dream11/tool
-
- Create a tag
1.0.0
. - Create a release, from above tag.
- Attach the compiled binary
tool
, compressed withintool_os_arch.tar.gz
.
Create a formula, homebrew-tools/formula/tool.rb
,
If repository is public,
# typed: false
class Tool < Formula
desc "Tool description"
homepage "https://github.com/dream11/tool"
version "1.0.0"
# For MacOs Intel based systems
if OS.mac? && Hardware::CPU.intel?
url "https://github.com/dream11/tool/releases/download/1.0.0/tool_darwin_amd64.tar.gz"
sha256 "<sha256 of tool_darwin_amd64.tar.gz>"
end
# For MacOs M1 based systems
if OS.mac? && Hardware::CPU.arm?
url "https://github.com/dream11/tool/releases/download/1.0.0/tool_darwin_arm64.tar.gz"
sha256 "<sha256 of tool_darwin_arm64.tar.gz>"
end
conflicts_with "tool"
def install
bin.install "tool"
end
test do
system "#{bin}/tool --version"
end
end
Install by running,
brew install dream11/tools/<tool>
If repository is private,
# typed: false
require_relative "lib/github"
class Tool < Formula
desc "Tool description"
homepage "https://github.com/dream11/tool"
version "1.0.0"
# For MacOs Intel based systems
if OS.mac? && Hardware::CPU.intel?
url "https://github.com/dream11/tool/releases/download/1.0.0/tool_darwin_amd64.tar.gz", :using => GitHubPrivateRepositoryReleaseDownloadStrategy
sha256 "<sha256 of tool_darwin_amd64.tar.gz>"
end
# For MacOs M1 based systems
if OS.mac? && Hardware::CPU.arm?
url "https://github.com/dream11/tool/releases/download/1.0.0/tool_darwin_arm64.tar.gz", :using => GitHubPrivateRepositoryReleaseDownloadStrategy
sha256 "<sha256 of tool_darwin_arm64.tar.gz>"
end
conflicts_with "tool"
def install
bin.install "tool"
end
test do
system "#{bin}/tool --version"
end
end
Install by running,
# A github personal access token will be required to access the private repository
export HOMEBREW_GITHUB_API_TOKEN=<Github API token>
brew install dream11/tools/<tool>
To enable brew install tool@version
. Write the formula as stated here, just change the class name according to the convention and place it in the file named as homebrew-tools/formula/tool@<version>.rb
.
Example - odin.rb v/s [email protected]
-
For
tool
, class name becomesTool
-
For
tool@version
, class name becomesToolAt<Version>
a. version 1.0.0 gives -ToolAt100
b. version 1.0.0-beta gives -ToolAt100Beta
export HOMEBREW_GITHUB_API_TOKEN=<your github access token>
brew tap dream11/tools
brew install dream11/tools/tool