require 'formula' class OfflineImap < Formula homepage 'http://offlineimap.org/' url 'https://github.com/downloads/spaetz/offlineimap/offlineimap-v6.5.2.1.tar.gz' md5 'fd87752605eb8d98d7addc70a8e96576' head 'https://github.com/spaetz/offlineimap.git' def install prefix.install 'offlineimap.conf', 'offlineimap.conf.minimal' libexec.install 'bin/offlineimap' => 'offlineimap.py' libexec.install 'offlineimap' bin.install_symlink libexec+'offlineimap.py' => 'offlineimap' plist_path.write startup_plist plist_path.chmod 0644 end def caveats; <<-EOS.undent To get started, copy one of these configurations to ~/.offlineimaprc: * minimal configuration: cp -n #{prefix}/offlineimap.conf.minimal ~/.offlineimaprc * advanced configuration: cp -n #{prefix}/offlineimap.conf ~/.offlineimaprc To launch on startup and run every 5 minutes: * if this is your first install: mkdir -p ~/Library/LaunchAgents cp #{plist_path} ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} * if this is an upgrade and you already have the #{plist_path.basename} loaded: launchctl unload -w ~/Library/LaunchAgents/#{plist_path.basename} cp #{plist_path} ~/Library/LaunchAgents/ launchctl load -w ~/Library/LaunchAgents/#{plist_path.basename} EOS end def startup_plist; <<-EOPLIST.undent KeepAlive Label #{plist_name} ProgramArguments #{HOMEBREW_PREFIX}/bin/offlineimap StartInterval 300 RunAtLoad StandardErrorPath /dev/null StandardOutPath /dev/null EOPLIST end end