forked from sjackman/linuxbrew-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ahoy.rb
50 lines (41 loc) · 1.54 KB
/
ahoy.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
45
46
47
48
49
50
class Ahoy < Formula
desc "Creates self documenting CLI programs from commands in YAML files"
homepage "http://www.ahoycli.com/"
url "https://github.com/ahoy-cli/ahoy/archive/2.0.0.tar.gz"
sha256 "cc3e426083bf7b7309e484fa69ed53b33c9b00adf9be879cbe74c19bdaef027c"
bottle do
cellar :any_skip_relocation
sha256 "fb8e03826f9109edc8bb5b1e0c7c9d8054d76e364bca13e0afdf7a23b022a817" => :catalina
sha256 "eabaf2c0faa64d878f3fd552823b9d5103e0755ba5f3120628e605964fc93257" => :mojave
sha256 "93db889b646270f7a92d32f649c9e256e4e90cfa006a04c614334f28557ce7ca" => :high_sierra
sha256 "5743854a4e6553adb3318a2facfd941bcf4d95a7ab3c2399400c7818c6e19c6f" => :sierra
sha256 "feaeb1fd36f11d336ecf3a38606e742cc41bf80f076b6413eadde577ec1ac133" => :x86_64_linux
end
depends_on "go" => :build
def install
ENV["GOPATH"] = buildpath
bin_path = buildpath/"src/github.com/ahoy-cli/ahoy"
bin_path.install Dir["*"]
cd bin_path do
system "go", "build", "-o", bin/"ahoy", "-ldflags", "-X main.version=#{version}", "."
end
end
def caveats; <<~EOS
===== UPGRADING FROM 1.x TO 2.x =====
If you are upgrading from ahoy 1.x, note that you'll
need to upgrade your ahoyapi settings in your .ahoy.yml
files to 'v2' instead of 'v1'.
See other changes at:
https://github.com/ahoy-cli/ahoy
EOS
end
test do
(testpath/".ahoy.yml").write <<~EOS
ahoyapi: v2
commands:
hello:
cmd: echo "Hello Homebrew!"
EOS
assert_equal "Hello Homebrew!\n", `#{bin}/ahoy hello`
end
end