class Restic < Formula desc "Fast, efficient and secure backup program" homepage "https://restic.github.io/" url "https://github.com/restic/restic/archive/v0.9.4.tar.gz" sha256 "c7dca90fb6fd83cee8b9f6a2776f5839794341af1953d251bf06a91870be7a8e" head "https://github.com/restic/restic.git" bottle do cellar :any_skip_relocation sha256 "a5280c51d22c55696e877a16f932f25ff4d71b85063f2932eadc542bf043e516" => :mojave sha256 "6d86bf805fe4e102adda32d856a35d5fd3008f6a8803a42f92b7f3ab740e2223" => :high_sierra sha256 "815f61f1f227974a9185de81f851b07e2d2d95ea297780e3a41a7f5b5aef3754" => :sierra end depends_on "go" => :build def install ENV["GOPATH"] = HOMEBREW_CACHE/"go_cache" system "go", "run", "build.go" mkdir "completions" system "./restic", "generate", "--bash-completion", "completions/restic" system "./restic", "generate", "--zsh-completion", "completions/_restic" mkdir "man" system "./restic", "generate", "--man", "man" bin.install "restic" bash_completion.install "completions/restic" zsh_completion.install "completions/_restic" man1.install Dir["man/*.1"] end test do mkdir testpath/"restic_repo" ENV["RESTIC_REPOSITORY"] = testpath/"restic_repo" ENV["RESTIC_PASSWORD"] = "foo" (testpath/"testfile").write("This is a testfile") system "#{bin}/restic", "init" system "#{bin}/restic", "backup", "testfile" system "#{bin}/restic", "restore", "latest", "-t", "#{testpath}/restore" assert compare_file "testfile", "#{testpath}/restore/testfile" end end