class Offlineimap < Formula desc "Synchronizes emails between two repositories" homepage "http://offlineimap.org/" url "https://github.com/OfflineIMAP/offlineimap/archive/v7.1.0.tar.gz" sha256 "dc998d1032f0e4f944cae0e584a146b70ea732422fc52c909eebe6e8f95b1ae4" head "https://github.com/OfflineIMAP/offlineimap.git" bottle do cellar :any_skip_relocation sha256 "50a415b6604fa91123111ce7e701af91c89371c707fb02105267418eafac3fc3" => :sierra sha256 "54c3afb8fbabf3a9f82b99dcde2576451ae6cec23941c8c6dd0420cbe35820c3" => :el_capitan sha256 "54c3afb8fbabf3a9f82b99dcde2576451ae6cec23941c8c6dd0420cbe35820c3" => :yosemite end resource "six" do url "https://files.pythonhosted.org/packages/b3/b2/238e2590826bfdd113244a40d9d3eb26918bd798fc187e2360a8367068db/six-1.10.0.tar.gz" sha256 "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a" end def install ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages" resource("six").stage do system "python", *Language::Python.setup_install_args(libexec/"vendor") end etc.install "offlineimap.conf", "offlineimap.conf.minimal" libexec.install "bin/offlineimap" => "offlineimap.py" libexec.install "offlineimap" (bin/"offlineimap").write_env_script(libexec/"offlineimap.py", :PYTHONPATH => ENV["PYTHONPATH"]) end def caveats; <<-EOS.undent To get started, copy one of these configurations to ~/.offlineimaprc: * minimal configuration: cp -n #{etc}/offlineimap.conf.minimal ~/.offlineimaprc * advanced configuration: cp -n #{etc}/offlineimap.conf ~/.offlineimaprc EOS end plist_options :manual => "offlineimap" def plist; <<-EOS.undent EnvironmentVariables PATH /usr/bin:/bin:/usr/sbin:/sbin:#{HOMEBREW_PREFIX}/bin KeepAlive Label #{plist_name} ProgramArguments #{opt_bin}/offlineimap StartInterval 300 RunAtLoad StandardErrorPath /dev/null StandardOutPath /dev/null EOS end test do system bin/"offlineimap", "--version" end end