-
Notifications
You must be signed in to change notification settings - Fork 8
/
awless.rb
54 lines (44 loc) · 1.61 KB
/
awless.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
51
52
53
54
class Awless < Formula
version = "v0.1.11"
desc "The Mighty CLI for AWS"
homepage "https://github.com/wallix/awless"
url "https://github.com/wallix/awless.git",
:tag => version
head "https://github.com/wallix/awless.git"
bottle do
root_url "https://github.com/wallix/homebrew-awless/releases/download/#{version}"
cellar :any_skip_relocation
sha256 "dbd1e5f4afd1de6fe00372bd8b6fffa9a448bbf461019094a5061b1b96924096" => :sierra
end
depends_on "go" => :build
def install
ENV["GOPATH"] = buildpath
arch = MacOS.prefer_64_bit? ? "amd64" : "x86"
dir = buildpath/"src/github.com/wallix/awless"
dir.install buildpath.children - [buildpath/".brew_home"]
cd dir do
# Make binary
system "go", "run", "release.go", "-tag", "v#{version}", "-brew", "-arch", "#{arch}", "-os", "darwin"
bin.install "awless"
# Install bash completion
output = Utils.popen_read("#{bin}/awless completion bash")
(bash_completion/"awless").write output
# Install zsh completion
output = Utils.popen_read("#{bin}/awless completion zsh")
(zsh_completion/"_awless").write output
end
end
def caveats
<<~EOS
In order to get awless completion,
[bash] you need to install `bash-completion` with brew.
OR
[zsh], add the following line to your ~/.zshrc:
source #{HOMEBREW_PREFIX}/share/zsh/site-functions/_awless
EOS
end
test do
run_output = shell_output("#{bin}/awless --help 2>&1")
assert_match "Awless is a powerful command line tool to inspect, sync and manage your infrastructure", run_output
end
end