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.3.2/gopass-1.3.2.tar.gz" sha256 "83eb409ed683b6e574680e70272977299e5741b1a7e82c835f0dea9485063aba" head "https://github.com/justwatchcom/gopass.git" bottle do cellar :any_skip_relocation sha256 "59a5cd330e6df3bdfc5da666c2c5d6edd8612137fc196a605879c7d1707e723b" => :high_sierra sha256 "05223f9c31e3aed7bf3f483eaa41159d8f1e2755fe1dd0fb24837e0ef4a13e29" => :sierra sha256 "afea43d98e86969f9c7424099e63ff67cfcf5a834ef09b4db28285e43ce222e5" => :el_capitan sha256 "8b2c1ce0392083f76a98cf0a7a13f1209c6476b4eb7ecff07fb075f9e9fb0f35" => :yosemite 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.undent 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 File.exist?(".password-store/Email/other@foo.bar.gpg") 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