require 'formula' class PureFtpd < Formula homepage 'http://www.pureftpd.org/' url 'http://download.pureftpd.org/pub/pure-ftpd/releases/pure-ftpd-1.0.35.tar.gz' sha1 'fed26bb1f36d71819a08873d94bbda52522ff96a' def install args = ["--disable-dependency-tracking", "--prefix=#{prefix}", "--mandir=#{man}", "--sysconfdir=#{etc}", "--with-pam", "--with-altlog", "--with-puredb", "--with-throttling", "--with-ratios", "--with-quotas", "--with-ftpwho", "--with-virtualhosts", "--with-virtualchroot", "--with-diraliases", "--with-peruserlimits", "--with-tls", "--with-bonjour"] args << "--with-pgsql" if which 'pg_config' args << "--with-mysql" if which 'mysql' system "./configure", *args system "make install" end def caveats; <<-EOS.undent If this is your first install, automatically load on login with: 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} To start pure-ftpd manually: pure-ftpd EOS end def startup_plist; <<-EOPLIST KeepAlive Label #{plist_name} ProgramArguments #{HOMEBREW_PREFIX}/sbin/pure-ftpd -A -j -z RunAtLoad UserName #{`whoami`.chomp} WorkingDirectory #{var} StandardErrorPath #{var}/log/pure-ftpd.log StandardOutPath #{var}/log/pure-ftpd.log EOPLIST end end