class Syncthing < Formula desc "Open source continuous file synchronization application" homepage "https://syncthing.net/" url "https://github.com/syncthing/syncthing.git", :tag => "v0.12.22", :revision => "94c6110f2e10ab8dbb0a416556701317ecd437cc" head "https://github.com/syncthing/syncthing.git" bottle do cellar :any_skip_relocation revision 1 sha256 "a1bcb0a2a531940e3d86a570d761b93790951eb54943f67b64bdbc00a7131cb9" => :el_capitan sha256 "da8d917a1e5ad5c7d691de072db5428b4cd5ed309077d7101d93ba3b206fcc95" => :yosemite sha256 "b4276fc05ba69825cb62f2c1622311109b9f4108ee73d3f69c4bf5a8e78e6d44" => :mavericks end depends_on "go" => :build depends_on :hg => :build def install ENV["GOPATH"] = cached_download/".gopath" ENV.append_path "PATH", "#{ENV["GOPATH"]}/bin" # FIXTHIS: do this without mutating the cache! hack_dir = cached_download/".gopath/src/github.com/syncthing" rm_rf hack_dir mkdir_p hack_dir ln_s cached_download, "#{hack_dir}/syncthing" system "./build.sh", "noupgrade" bin.install "syncthing" end plist_options :manual => "syncthing" def plist; <<-EOS.undent Label #{plist_name} ProgramArguments #{opt_bin}/syncthing -no-browser -no-restart KeepAlive Crashed SuccessfulExit ProcessType Background StandardErrorPath #{var}/log/syncthing.log StandardOutPath #{var}/log/syncthing.log EOS end test do system bin/"syncthing", "-generate", "./" end end