73 lines
2.4 KiB
Ruby
73 lines
2.4 KiB
Ruby
class Syncthing < Formula
|
|
desc "Open source continuous file synchronization application"
|
|
homepage "https://syncthing.net/"
|
|
url "https://github.com/syncthing/syncthing/archive/v1.14.0.tar.gz"
|
|
sha256 "ab34f328fdca5a1a334af844787e72e6a80988830a5223d82a915efe038433ec"
|
|
license "MPL-2.0"
|
|
head "https://github.com/syncthing/syncthing.git", branch: "main"
|
|
|
|
livecheck do
|
|
url :stable
|
|
strategy :github_latest
|
|
end
|
|
|
|
bottle do
|
|
sha256 cellar: :any_skip_relocation, arm64_big_sur: "68c432762e6c944436156a4a6e5030d0c4404129df1336732772b8517a6fb0bf"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "3669bca08e3a6166bfd443ace1954ddc0b3fcba29154a9cab9e5bc927a762274"
|
|
sha256 cellar: :any_skip_relocation, catalina: "dea720b306548ac56883f8403bb1773974bf62107ee8431d390290073e122fe9"
|
|
sha256 cellar: :any_skip_relocation, mojave: "a5634372c54dac12632134c75b1fa83f9a2f59f1dfc3c9d4b78f09552c05e87f"
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
def install
|
|
build_version = build.head? ? "v0.0.0-#{version}" : "v#{version}"
|
|
system "go", "run", "build.go", "--version", build_version, "--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
|
|
build_version = build.head? ? "v0.0.0-#{version}" : "v#{version}"
|
|
assert_match "syncthing #{build_version} ", shell_output("#{bin}/syncthing --version")
|
|
system bin/"syncthing", "-generate", "./"
|
|
end
|
|
end
|