homebrew-core/Formula/syncthing.rb
2019-08-06 09:09:07 +10: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.2.1",
:revision => "d0c36971523d72dc1619b405891929e745809400"
head "https://github.com/syncthing/syncthing.git"
bottle do
cellar :any_skip_relocation
sha256 "9be30c2cae528ab2c01a901f2167b7fa65295050990dc00210f62260b0dbef2a" => :mojave
sha256 "68a38f0b5af18c6d1cc3a84cee8417b8bf89e7f721b57851fba901a07da75b62" => :high_sierra
sha256 "2538544e3a1d69e3b44fa6611b7b04c92f2940862e9437ed4f44fa4d6e839745" => :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