class Gopass < Formula desc "The slightly more awesome Standard Unix Password Manager for Teams" homepage "https://www.justwatch.com/gopass" url "https://www.justwatch.com/gopass/releases/1.6.0/gopass-1.6.0.tar.gz" sha256 "9c482ae75842d24f012bfa87c5503a64fc9f05d815821aa04bac0af399941bd1" head "https://github.com/justwatchcom/gopass.git" bottle do cellar :any_skip_relocation sha256 "dd77dfe2b9938803096bb26c0f78e1096b1178eb543fabe9045019339d9e5a11" => :high_sierra sha256 "51f4b36a81c0af23534d54464b3fae8d9cb47d7cafed47fda58d1bab6a7daa46" => :sierra sha256 "759870ca3e94a1f29932a5f7305ed32afe77225f528c53f97ac45f4162a4f778" => :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