homebrew-core/Formula/gopass.rb
2018-06-06 23:30:22 -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://github.com/gopasspw/gopass/releases/download/v1.8.0/gopass-1.8.0.tar.gz"
sha256 "dba0e1d1a10cbaadceee18b84f363bbbf886ba52cd9c658f5eca35d37b2f3f75"
head "https://github.com/gopasspw/gopass.git"
bottle do
cellar :any_skip_relocation
sha256 "03af544c1fbc4ab575f6eb8817cfebdf1c769deb09d5fd297c3d2a3542beff8b" => :high_sierra
sha256 "7dc01d3a42ae35562b13b32e19121baca20971d764b9fe0865b02e4a5b0a07d9" => :sierra
sha256 "3f842a2a034dd1c673c5d9b917580751fb1a75f45f589121e00348587e6cc58b" => :el_capitan
end
depends_on "go" => :build
depends_on "gnupg"
def install
ENV["GOPATH"] = buildpath
(buildpath/"src/github.com/gopasspw/gopass").install buildpath.children
cd "src/github.com/gopasspw/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", "--rcs", "noop", "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