https://github.com/dream11/homebrew-tools
Homebrew tap formula(s) for Dream11 internal tools.
https://github.com/dream11/homebrew-tools
brew d11-coreinfra devx formula homebrew tap
Last synced: 7 months ago
JSON representation
Homebrew tap formula(s) for Dream11 internal tools.
- Host: GitHub
- URL: https://github.com/dream11/homebrew-tools
- Owner: dream11
- Created: 2022-01-31T08:25:27.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-20T10:51:43.000Z (11 months ago)
- Last Synced: 2025-01-20T11:29:19.014Z (11 months ago)
- Topics: brew, d11-coreinfra, devx, formula, homebrew, tap
- Language: Ruby
- Homepage:
- Size: 67.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# homebrew-tools :beer:
Homebrew tap formula(s) for Dream11 tools.
## Tap
```shell
brew tap dream11/tools
```
## Install
```shell
brew install dream11/tools/
```
> Can run directly without running `brew tap`.
Example
```shell
brew install dream11/tools/odin
```
## Development
### Repository structure
```shell
+-- homebrew-tools
+-- formula
+-- tool.rb
+-- lib
+-- function.rb
```
#### `formula`
Contains all installation formula(s).
#### `formula/lib`
Contains all library functions required by the formula(s).
### Writing a formula
#### Importing libraries
Importing library from `formula/lib/library.rb`
```ruby
require_relative "lib/library"
```
#### Initiating a formula class
```ruby
class Odin < Formula
desc "Formula description"
homepage "https://github.com/dream11/tool-name"
version "1.0.0"
# add installation steps here
end
```
### Example: Formula for installing a binary
#### Pre-requisites
For a repository `github.com/dream11/tool` -
1. Create a tag `1.0.0`.
2. Create a release, from above tag.
3. Attach the compiled binary `tool`, compressed within `tool_os_arch.tar.gz`.
#### Formula
Create a formula, `homebrew-tools/formula/tool.rb`,
If repository is public,
```ruby
# 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 ""
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 ""
end
conflicts_with "tool"
def install
bin.install "tool"
end
test do
system "#{bin}/tool --version"
end
end
```
Install by running,
```shell
brew install dream11/tools/
```
If repository is private,
```ruby
# 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 ""
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 ""
end
conflicts_with "tool"
def install
bin.install "tool"
end
test do
system "#{bin}/tool --version"
end
end
```
Install by running,
```shell
# A github personal access token will be required to access the private repository
export HOMEBREW_GITHUB_API_TOKEN=
brew install dream11/tools/
```
#### Formula Version
To enable `brew install tool@version`. Write the formula as stated [here](#formula-1), just change the class name according to the convention and place it in the file named as `homebrew-tools/formula/tool@.rb`.
Example - [odin.rb](./formula/odin.rb) v/s [odin@1.0.0-alpha.rb](./formula/odin@1.0.0-alpha.rb)
#### Class naming convention
1. For `tool`, class name becomes `Tool`
2. For `tool@version`, class name becomes `ToolAt`
a. version 1.0.0 gives - `ToolAt100`
b. version 1.0.0-beta gives - `ToolAt100Beta`
#### Installation
```shell
export HOMEBREW_GITHUB_API_TOKEN=
brew tap dream11/tools
brew install dream11/tools/tool
```