homebrew-core/Formula/syncthing.rb
2015-06-14 19:18:32 +01:00

64 lines
1.9 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.11.9", :revision => "1437952aee2069e47c856ae2c06d1e9aefb46d9d"
head "https://github.com/syncthing/syncthing.git"
bottle do
cellar :any
sha256 "392d1b861c5eae39e44148842947dfbeb3640cb0d031e0a42fef3ec49d31252b" => :yosemite
sha256 "28b78c3826f3a9a6c1b521ad91b2e7c91b3bc6417f7e175a2e83960ad2f78e1d" => :mavericks
sha256 "a1c9ae1947ae60898b14820577ffafc4bbb5e92039d02ebf9e8d2aa9e5fffaea" => :mountain_lion
end
depends_on "go" => :build
depends_on :hg => :build
def install
ENV["GOPATH"] = cached_download/".gopath"
ENV.append_path "PATH", "#{ENV["GOPATH"]}/bin"
# FIXTHIS: do this without mutating the cache!
hack_dir = cached_download/".gopath/src/github.com/syncthing"
rm_rf hack_dir
mkdir_p hack_dir
ln_s cached_download, "#{hack_dir}/syncthing"
system "./build.sh", "noupgrade"
bin.install "syncthing"
end
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>KeepAlive</key>
<true/>
<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>RunAtLoad</key>
<true/>
<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