class SshVault < Formula desc "Encrypt/decrypt using SSH keys" homepage "https://ssh-vault.com/" url "https://github.com/ssh-vault/ssh-vault.git", :tag => "0.12.3", :revision => "33b59a33979223c2a5e7e5b63f0bd01e50fc04ae" head "https://github.com/ssh-vault/ssh-vault.git" bottle do cellar :any_skip_relocation sha256 "449945a60458fde34c31a6a8b97fd1e6572dc295ab70bee410a4c3ae2f4c57c1" => :high_sierra sha256 "6fa89a87974ee2b4a791ba0a2f28249b7bd12abc64436a5015e207cb0d73b6a0" => :sierra sha256 "57ab92a375411d4cc60796247a77ea8855ca6ca16411d051ebac75782f1d1403" => :el_capitan end depends_on "dep" => :build depends_on "go" => :build def install ENV["GOPATH"] = buildpath (buildpath/"src/github.com/ssh-vault/ssh-vault").install buildpath.children cd "src/github.com/ssh-vault/ssh-vault" do system "dep", "ensure" ldflags = "-s -w -X main.version=#{version}" system "go", "build", "-ldflags", ldflags, "-o", "#{bin}/ssh-vault", "cmd/ssh-vault/main.go" prefix.install_metafiles end end test do output = shell_output("echo hi | #{bin}/ssh-vault -u new create") fingerprint = output.split("\n").first.split(";").last cmd = "#{bin}/ssh-vault -k https://ssh-keys.online/#{fingerprint} view" output = pipe_output(cmd, output, 0) assert_equal "hi", output.chomp end end