homebrew-core/Formula/syncthing.rb

71 lines
2.0 KiB
Ruby

class Syncthing < Formula
desc "Open source continuous file synchronization application"
homepage "https://syncthing.net/"
url "https://github.com/syncthing/syncthing/archive/v1.8.0.tar.gz"
sha256 "915a3ac5faf40aea3e5f17c20b7287b7f4108e22157961cf0ca3133fd1dbef9a"
license "MPL-2.0"
revision 1
head "https://github.com/syncthing/syncthing.git"
livecheck do
url :head
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
bottle do
cellar :any_skip_relocation
sha256 "0876723f808790afd0a87292483a62ac07498ab75ffbadd628ad4f2f8affa3da" => :catalina
sha256 "80c543d88c241baff1587eabfccad009099ccec3037995a9826a3b9a85100de2" => :mojave
sha256 "f9277420596daaeaac43c06297673775ca2ec1d92e174106a88953054d0c35bf" => :high_sierra
end
depends_on "go@1.14" => :build
def install
system "go", "run", "build.go", "--no-upgrade", "tar"
bin.install "syncthing"
man1.install Dir["man/*.1"]
man5.install Dir["man/*.5"]
man7.install Dir["man/*.7"]
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