class Zrepl < Formula desc "One-stop ZFS backup & replication solution" homepage "https://zrepl.github.io" url "https://github.com/zrepl/zrepl/archive/v0.3.0.tar.gz" sha256 "669b59ca524f487a76145f7153b9c048442cd1b96a293e0dc18048f5024a2997" license "MIT" head "https://github.com/zrepl/zrepl.git" bottle do cellar :any_skip_relocation sha256 "d476be049ac26213db683e0d2bf9a2ec0d3e43dad951a10c20b40afa6ede42c3" => :catalina sha256 "23f0442f06dd7faf6782d9ac79607ba43e31e5dfd6cfa3450063ed012514e091" => :mojave sha256 "75334d924255ced1155afb9523258e53be8e1c2ad6538e6b88c79c19251a17b4" => :high_sierra end depends_on "go" => :build resource "sample_config" do url "https://raw.githubusercontent.com/zrepl/zrepl/master/config/samples/local.yml" sha256 "f27b21716e6efdc208481a8f7399f35fd041183783e00c57f62b3a5520470c05" end def install system "go", "build", *std_go_args, "-ldflags", "-X github.com/zrepl/zrepl/version.zreplVersion=#{version}" end def post_install (var/"log/zrepl").mkpath (var/"run/zrepl").mkpath (etc/"zrepl").mkpath end plist_options startup: true, manual: "sudo zrepl daemon" def plist <<~EOS EnvironmentVariables PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:#{HOMEBREW_PREFIX}/bin KeepAlive Label #{plist_name} ProgramArguments #{opt_bin}/zrepl daemon RunAtLoad StandardErrorPath #{var}/log/zrepl/zrepl.err.log StandardOutPath #{var}/log/zrepl/zrepl.out.log ThrottleInterval 30 WorkingDirectory #{var}/run/zrepl EOS end test do resources.each do |r| r.verify_download_integrity(r.fetch) assert_equal "", shell_output("#{bin}/zrepl configcheck --config #{r.cached_download}") end end end