homebrew-core/Formula/gopass.rb
2018-11-21 13:45:05 -05: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.3/gopass-1.8.3.tar.gz"
sha256 "18281e07de961b26b9cce7c907e811d567b0e599649f0dbe703ab108984275a8"
head "https://github.com/gopasspw/gopass.git"
bottle do
cellar :any_skip_relocation
sha256 "0d7ad318e1985a08f4a410a298e758d2909ce3d1a43be08899052915b5d42fba" => :mojave
sha256 "b85d8204e8724a10e0684090e884bda6cc5c651ecd16899622da4334846ff244" => :high_sierra
sha256 "e2fc1de917adb763802ca6f07be79f4dc2fb641ca68998e913206708b5813a0f" => :sierra
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