forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathblackbox.rb
40 lines (36 loc) · 1.25 KB
/
blackbox.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
class Blackbox < Formula
desc "Safely store secrets in Git/Mercurial/Subversion"
homepage "https://github.com/StackExchange/blackbox"
url "https://github.com/StackExchange/blackbox/archive/v1.20181219.tar.gz"
sha256 "afd40d1676645ce9aaf4cdbf71352bf1a8f6d426998436cea3ae536881ef5f81"
bottle :unneeded
depends_on "gnupg"
def install
libexec.install Dir["bin/*"]
bin.write_exec_script Dir[libexec/"*"].select { |f| File.executable? f }
end
test do
(testpath/"batch.gpg").write <<~EOS
Key-Type: RSA
Key-Length: 2048
Subkey-Type: RSA
Subkey-Length: 2048
Name-Real: Testing
Name-Email: [email protected]
Expire-Date: 1d
%no-protection
%commit
EOS
begin
system Formula["gnupg"].opt_bin/"gpg", "--batch", "--gen-key", "batch.gpg"
system "git", "init"
system bin/"blackbox_initialize", "yes"
add_created_key = shell_output("#{bin}/blackbox_addadmin Testing 2>&1")
assert_match "<[email protected]>", add_created_key
ensure
system Formula["gnupg"].opt_bin/"gpgconf", "--kill", "gpg-agent"
system Formula["gnupg"].opt_bin/"gpgconf", "--homedir", "keyrings/live",
"--kill", "gpg-agent"
end
end
end