homebrew-core/Formula/gopass.rb
2017-12-13 22:00:40 -08: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/justwatchcom/gopass/releases/download/v1.6.4/gopass-1.6.4.tar.gz"
sha256 "c1f12206a7cbd9a0ca6dda4ae39dc124d69cc51a9be6ae37d914373bcbba81cb"
head "https://github.com/justwatchcom/gopass.git"
bottle do
cellar :any_skip_relocation
sha256 "a4f8fdc842ebdaf672545de1b9a162ecd1565236854c144bd62777377d5bfb49" => :high_sierra
sha256 "1a08c9be97bac1cd77b74723bf4041bcde65d71bcf65850897c447285ceb6206" => :sierra
sha256 "dc759cd75b77f49ebb4586c9be1b10cc235889bfde02bc2ce09da17c4d6a0ffc" => :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