homebrew-core/Formula/syncthing.rb
2016-11-22 17:32:43 -05:00

65 lines
2.1 KiB
Ruby

class Syncthing < Formula
desc "Open source continuous file synchronization application"
homepage "https://syncthing.net/"
url "https://github.com/syncthing/syncthing.git",
:tag => "v0.14.12",
:revision => "5bb74ee61ca43da27120ad99ea98e10e0a1f76a3"
head "https://github.com/syncthing/syncthing.git"
bottle do
cellar :any_skip_relocation
sha256 "c98d2f2281ad48904a3d96dc7b3e69830d494125eb28c7d5bd7717c75c89923f" => :sierra
sha256 "979b5980ed7be51648ac2ab2f8b7803a48c28f645b4fadf016ee3a267daf7751" => :el_capitan
sha256 "53c49f8e919e9c9bf487c1305ef617372b90dcf5a4dec788b1928de491af2603" => :yosemite
end
depends_on "go" => :build
def install
ENV["GOPATH"] = buildpath/".syncthing-gopath"
mkdir_p buildpath/".syncthing-gopath/src/github.com/syncthing"
cp_r cached_download, buildpath/".syncthing-gopath/src/github.com/syncthing/syncthing"
ENV.append_path "PATH", "#{ENV["GOPATH"]}/bin"
cd buildpath/".syncthing-gopath/src/github.com/syncthing/syncthing"
system "./build.sh", "noupgrade"
bin.install "syncthing"
end
plist_options :manual => "syncthing"
def plist; <<-EOS.undent
<?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