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.13.1.tar.gz"
|
|
sha256 "f4632a062f75d01629e625ccef9625313f5d371c5f9bee744b0b811d47b92e25"
|
|
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: "1925e1bd9829e7364f2cdde85bb28137eb6cf5e726f79a8d88e99f2547ce19a4"
|
|
sha256 cellar: :any_skip_relocation, big_sur: "aae6580eb1c320c50edba6d735da4dd32301c064d8099d32a611b271e6d7353d"
|
|
sha256 cellar: :any_skip_relocation, catalina: "d4df558cf63abf8fcd401aa2b3011b951353d293d9186ec3493dab1328b48769"
|
|
sha256 cellar: :any_skip_relocation, mojave: "30b16fcbc6e2307de99bc8749719c67ffbc5231113cdaee711e3371a81ab8545"
|
|
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
|