Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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: 19 days 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 3 years ago)
- Default Branch: main
- Last Pushed: 2024-06-28T11:23:28.000Z (7 months ago)
- Last Synced: 2024-11-06T13:46:55.595Z (2 months ago)
- Topics: brew, d11-coreinfra, devx, formula, homebrew, tap
- Language: Ruby
- Homepage:
- Size: 47.9 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
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: falseclass 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 ""
endconflicts_with "tool"
def install
bin.install "tool"
endtest do
system "#{bin}/tool --version"
endend
```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 ""
endconflicts_with "tool"
def install
bin.install "tool"
endtest do
system "#{bin}/tool --version"
endend
```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/[email protected]`.
Example - [odin.rb](./formula/odin.rb) v/s [[email protected]](./formula/[email protected])
#### 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
```