Skip to content

Commit cf5b537

Browse files
committed
feat(cli): add gitflow-toolkit homebrew formula and checksum task
- implement homebrew formula for gitflow-toolkit - include platform-specific binaries and checksums - add git subcommand symlinks for workflow integration - introduce checksums task for release file verification Signed-off-by: kovacs <mritd@linux.com>
1 parent d88b73a commit cf5b537

2 files changed

Lines changed: 85 additions & 0 deletions

File tree

Formula/gitflow-toolkit.rb

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
class GitflowToolkit < Formula
2+
desc "CLI tool for standardizing git commits following Angular commit specification"
3+
homepage "https://github.com/mritd/gitflow-toolkit"
4+
license "MIT"
5+
6+
# Get latest version from GitHub API
7+
latest_version = JSON.parse(
8+
URI.open("https://api.github.com/repos/mritd/gitflow-toolkit/releases/latest").read
9+
)["tag_name"].delete_prefix("v")
10+
11+
version latest_version
12+
13+
# Fetch checksums from release
14+
checksums_url = "https://github.com/mritd/gitflow-toolkit/releases/download/v#{version}/checksums.txt"
15+
checksums = URI.open(checksums_url).read.lines.to_h { |l| l.strip.split(" ").reverse }
16+
17+
on_macos do
18+
on_intel do
19+
url "https://github.com/mritd/gitflow-toolkit/releases/download/v#{version}/gitflow-toolkit-darwin-amd64"
20+
sha256 checksums["gitflow-toolkit-darwin-amd64"]
21+
end
22+
23+
on_arm do
24+
url "https://github.com/mritd/gitflow-toolkit/releases/download/v#{version}/gitflow-toolkit-darwin-arm64"
25+
sha256 checksums["gitflow-toolkit-darwin-arm64"]
26+
end
27+
end
28+
29+
on_linux do
30+
on_intel do
31+
if Hardware::CPU.is_64_bit?
32+
url "https://github.com/mritd/gitflow-toolkit/releases/download/v#{version}/gitflow-toolkit-linux-amd64"
33+
sha256 checksums["gitflow-toolkit-linux-amd64"]
34+
else
35+
url "https://github.com/mritd/gitflow-toolkit/releases/download/v#{version}/gitflow-toolkit-linux-386"
36+
sha256 checksums["gitflow-toolkit-linux-386"]
37+
end
38+
end
39+
40+
on_arm do
41+
if Hardware::CPU.is_64_bit?
42+
url "https://github.com/mritd/gitflow-toolkit/releases/download/v#{version}/gitflow-toolkit-linux-arm64"
43+
sha256 checksums["gitflow-toolkit-linux-arm64"]
44+
else
45+
url "https://github.com/mritd/gitflow-toolkit/releases/download/v#{version}/gitflow-toolkit-linux-armv7"
46+
sha256 checksums["gitflow-toolkit-linux-armv7"]
47+
end
48+
end
49+
end
50+
51+
def install
52+
binary_name = stable.url.split("/").last
53+
bin.install binary_name => "gitflow-toolkit"
54+
55+
# Create git subcommand symlinks
56+
%w[ci ps feat fix docs style refactor test chore perf hotfix].each do |cmd|
57+
bin.install_symlink "gitflow-toolkit" => "git-#{cmd}"
58+
end
59+
end
60+
61+
def caveats
62+
<<~EOS
63+
Git subcommands have been installed:
64+
git ci - Interactive commit
65+
git ps - Push with TUI
66+
git feat - Create feature branch
67+
git fix - Create fix branch
68+
... and more
69+
70+
For AI-powered commit generation, configure your LLM:
71+
git config --global gitflow.llm-api-key "your-api-key"
72+
EOS
73+
end
74+
75+
test do
76+
assert_match version.to_s, shell_output("#{bin}/gitflow-toolkit -v")
77+
end
78+
end

Taskfile.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,13 @@ tasks:
124124
- task: linux-arm64
125125
- task: darwin-amd64
126126
- task: darwin-arm64
127+
- task: checksums
128+
129+
checksums:
130+
desc: Generate checksums.txt for release
131+
cmds:
132+
- cd dist && shasum -a 256 gitflow-toolkit-* > checksums.txt
133+
- cat dist/checksums.txt
127134

128135
default:
129136
desc: Build for current platform

0 commit comments

Comments
 (0)