homebrew-core/Formula/syncthing.rb
2019-05-07 15:41:14 +02:00

70 lines
2 KiB
Ruby

class Syncthing < Formula
desc "Open source continuous file synchronization application"
homepage "https://syncthing.net/"
url "https://github.com/syncthing/syncthing.git",
:tag => "v1.1.2",
:revision => "a54d7a32d1f308be63837f1b31d9f468940fc5ef"
head "https://github.com/syncthing/syncthing.git"
bottle do
cellar :any_skip_relocation
sha256 "3405384a23fff1ad6dfa0e7dce022b2d44f3d5e1014501dbeb31572d08d294cd" => :mojave
sha256 "f40941ff3569a416841dd17beb7a0d1c6326efc375476d1377b4fa45891c5ce8" => :high_sierra
sha256 "e68baed7734c3fb56ca01e5ea519bb6c33816531bc746ead45d9a9d0eb7262d4" => :sierra
end
depends_on "go" => :build
def install
ENV["GO111MODULE"] = "on"
ENV["GOPATH"] = buildpath
src = buildpath/"src/github.com/syncthing/syncthing"
src.install buildpath.children
src.cd do
system "./build.sh", "noupgrade"
bin.install "syncthing"
man1.install Dir["man/*.1"]
man5.install Dir["man/*.5"]
man7.install Dir["man/*.7"]
prefix.install_metafiles
end
end
plist_options :manual => "syncthing"
def plist; <<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>ProgramArguments</key>
<array>
<string>#{opt_bin}/syncthing</string>
<string>-no-browser</string>
<string>-no-restart</string>
</array>
<key>KeepAlive</key>
<dict>
<key>Crashed</key>
<true/>
<key>SuccessfulExit</key>
<false/>
</dict>
<key>ProcessType</key>
<string>Background</string>
<key>StandardErrorPath</key>
<string>#{var}/log/syncthing.log</string>
<key>StandardOutPath</key>
<string>#{var}/log/syncthing.log</string>
</dict>
</plist>
EOS
end
test do
system bin/"syncthing", "-generate", "./"
end
end