class Restic < Formula desc "Fast, efficient and secure backup program" homepage "https://restic.github.io/" url "https://github.com/restic/restic/archive/v0.9.3.tar.gz" sha256 "b95a258099aee9a56e620ccebcecabc246ee7f8390e3937ccedadd609c6d2dd0" head "https://github.com/restic/restic.git" bottle do cellar :any_skip_relocation sha256 "d7180e62a82f73cd83f792f281fd27931524c006eb3a07d58ced31fceff1933c" => :mojave sha256 "9f0189489a0bd16473f1035b18da19931a33914b336fc5d6cf1e78262114a03d" => :high_sierra sha256 "b74f743cc03c36ee832309da2c25193c51417c47876851ebbfbfaff89712cfad" => :sierra end depends_on "go" => :build def install ENV["GOPATH"] = HOMEBREW_CACHE/"go_cache" system "go", "run", "build.go" bin.install "restic" 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