-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcodegpt.rb
44 lines (37 loc) · 1.44 KB
/
codegpt.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
class Codegpt < Formula
desc "A CLI written in Go language that writes git commit messages for you using ChatGPT AI (gpt-3.5-turbo model) and automatically installs a git prepare-commit-msg hook."
homepage "https://github.com/appleboy/CodeGPT"
version "0.16.1"
os = OS.mac? ? "darwin" : "linux"
arch = case Hardware::CPU.arch
when :x86_64 then "amd64"
when :arm64 then "arm64"
else
raise "CodeGPT: Unsupported system architecture #{Hardware::CPU.arch}"
end
@@filename = "CodeGPT-#{version}-#{os}-#{arch}"
@@url = "https://github.com/appleboy/CodeGPT/releases/download/v#{version}/#{@@filename}"
@@url += ".xz"
@@using = nil
depends_on "xz"
@@sha256 = case "#{os}-#{arch}"
when "linux-amd64" then "e0b4debcf9659e00360c04947539bff6aca8d8a5450b2365248edc7eccc48ca3"
when "linux-arm64" then "00ec6f31c1322125b725710842071fa724d83328caf73557a11de8361077e001"
when "darwin-amd64" then "3c2b5835fcf8e098434532ff41dccfb61f796f4fba4e2b76c0de4570df5fc316"
when "darwin-arm64" then "857c694458d903bf13813b69a0f2ff2322caba6cf3871c0d3e504a10ba50e407"
else
raise "CodeGPT: Unsupported system #{os}-#{arch}"
end
sha256 @@sha256
url @@url,
using: @@using
depends_on "git"
depends_on "zsh" => :optional
def install
filename = Codegpt.class_variable_get("@@filename")
bin.install filename => "codegpt"
end
test do
system "#{bin}/codegpt", "version"
end
end