class Offlineimap < Formula desc "Synchronizes emails between two repositories" homepage "http://offlineimap.org/" url "https://github.com/OfflineIMAP/offlineimap/archive/v7.1.4.tar.gz" sha256 "c6fe4a99458542b52f101d2569cb7ca6d2c758bc0eba3731d4e6263af48c6454" head "https://github.com/OfflineIMAP/offlineimap.git" bottle do cellar :any_skip_relocation sha256 "a0bbabd2ac821df9752e4f9a3939c7fe9852331f335ac903066bd60ff180587b" => :high_sierra sha256 "a0bbabd2ac821df9752e4f9a3939c7fe9852331f335ac903066bd60ff180587b" => :sierra sha256 "a0bbabd2ac821df9752e4f9a3939c7fe9852331f335ac903066bd60ff180587b" => :el_capitan end depends_on "asciidoc" => :build depends_on "docbook-xsl" => :build depends_on "sphinx-doc" => :build resource "six" do url "https://files.pythonhosted.org/packages/16/d8/bc6316cf98419719bd59c91742194c111b6f2e85abac88e496adefaf7afe/six-1.11.0.tar.gz" sha256 "70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9" end def install ENV["XML_CATALOG_FILES"] = "#{etc}/xml/catalog" system "make", "docs" man1.install "docs/offlineimap.1" man7.install "docs/offlineimapui.7" 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 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 EnvironmentVariables PATH /usr/bin:/bin:/usr/sbin:/sbin:#{HOMEBREW_PREFIX}/bin KeepAlive Label #{plist_name} ProgramArguments #{opt_bin}/offlineimap -q -u basic StartInterval 300 RunAtLoad StandardErrorPath /dev/null StandardOutPath /dev/null EOS end test do system bin/"offlineimap", "--version" end end