homebrew-core/Formula/syncthing.rb
2015-06-21 21:13:36 +08: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.10", :revision => "2463819a3dea84671e321fcb75e6457bf5b15efd"
head "https://github.com/syncthing/syncthing.git"
bottle do
cellar :any
sha256 "aacaa7f903e69289d7924a48faa64d6b5a2c6e931623e220cc0a93c432a72925" => :yosemite
sha256 "3635f9f950a39f3baaa52a122fcd87497d66d145ea035e08d923d45dcde1043f" => :mavericks
sha256 "e7964e1d8ae70e9d295b1a2bbd43418df5a2b696740f0c02ec994389520d21e0" => :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