homebrew-core/Formula/gopass.rb
2017-10-25 23:19:39 -07:00

58 lines
2 KiB
Ruby

class Gopass < Formula
desc "The slightly more awesome Standard Unix Password Manager for Teams"
homepage "https://www.justwatch.com/gopass"
url "https://www.justwatch.com/gopass/releases/1.5.1/gopass-1.5.1.tar.gz"
sha256 "7a4f42be34c77d3e22e75bcc7be20340c8cd0437bd04cde9667ad0fe6b621121"
head "https://github.com/justwatchcom/gopass.git"
bottle do
cellar :any_skip_relocation
sha256 "85f0f90252e29e600a807567eb408cbaeea7b4b28aec3f2738c1a1fabede1154" => :high_sierra
sha256 "d18f790d8e6bc4803a53998ad6d8922159af679b55d26fbebd04b056de1fbf1c" => :sierra
sha256 "438b6231c1ad8c527ba2de91c722e17623e1413883a2c65811c5de43aa9e2842" => :el_capitan
end
depends_on "go" => :build
depends_on :gpg => :run
def install
ENV["GOPATH"] = buildpath
(buildpath/"src/github.com/justwatchcom/gopass").install buildpath.children
cd "src/github.com/justwatchcom/gopass" do
prefix.install_metafiles
ENV["PREFIX"] = prefix
system "make", "install"
end
output = Utils.popen_read("#{bin}/gopass completion bash")
(bash_completion/"gopass-completion").write output
end
test do
assert_match version.to_s, shell_output("#{bin}/gopass version")
(testpath/"batch.gpg").write <<~EOS
Key-Type: RSA
Key-Length: 2048
Subkey-Type: RSA
Subkey-Length: 2048
Name-Real: Testing
Name-Email: testing@foo.bar
Expire-Date: 1d
%no-protection
%commit
EOS
begin
system Formula["gnupg"].opt_bin/"gpg", "--batch", "--gen-key", "batch.gpg"
system bin/"gopass", "init", "--nogit", "testing@foo.bar"
system bin/"gopass", "generate", "Email/other@foo.bar", "15"
assert_predicate testpath/".password-store/Email/other@foo.bar.gpg", :exist?
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