class Gopass < Formula desc "The slightly more awesome Standard Unix Password Manager for Teams" homepage "https://github.com/gopasspw/gopass" url "https://github.com/gopasspw/gopass/releases/download/v1.8.5/gopass-1.8.5.tar.gz" sha256 "f4350837bed86632a1c1051aa7436095aaece462854052a2a566b68ca2e3eecc" head "https://github.com/gopasspw/gopass.git" bottle do cellar :any_skip_relocation sha256 "ab85e9c4a05a80e9aa2c1116785af178ff151db1abc11263854a67d4adbdf526" => :mojave sha256 "125f189b3b38a0a965c544b61b70bfb4117fbbd44e7e1ae132fe23a0a502ff41" => :high_sierra sha256 "4d2a940c2fc2ca2fb11739f814fc2b4e2b18c32382eddb4fccad6801431352a8" => :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