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.11/gopass-1.6.11.tar.gz" sha256 "de5b27f81649548292dc83da98e8e46b9b92d8b0bb012797dee44b3207090c67" head "https://github.com/justwatchcom/gopass.git" bottle do cellar :any_skip_relocation sha256 "a0c8b277458ec7369475c49082342f5e262e00f1e74f780df778eb9ecfee0c32" => :high_sierra sha256 "72cc9bfdf7f790c84d1e01734c371f8dc84ec2aa522f9b431c4fa4facd2c26d0" => :sierra sha256 "4562c8565ea8be8d38a6755fae8e44a634d567003f52bfffc3da09e276a5e34e" => :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