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.10/gopass-1.6.10.tar.gz" sha256 "2b481d0847abb2cb2446dfca6533c2e051b976011f42745c1ab1abbbf0bbdc8b" head "https://github.com/justwatchcom/gopass.git" bottle do cellar :any_skip_relocation sha256 "a30f17220395b1aeb731ea60f6f3e0fe0443915e41fdf7c71d0e703798b70a64" => :high_sierra sha256 "14e3be402cb9784aecd694e2cf3bba7bc123d9e90d6ed79fcc2c0f9a4c3a3d8c" => :sierra sha256 "3da71a728f98b072a1bfa087cbda00566d5c5011edd4e72e701041a5486bc00f" => :el_capitan end depends_on "go" => :build depends_on "gnupg" 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