require 'formula' class Sickbeard < Formula homepage 'http://www.sickbeard.com/' url 'https://github.com/midgetspy/Sick-Beard/tarball/build-498' sha1 '39b57fadf7c5562e889f9203c0dac5212eab9b79' head 'https://github.com/midgetspy/Sick-Beard.git' depends_on 'Cheetah' => :python def install prefix.install Dir['*'] (bin+"sickbeard").write(startup_script) end plist_options :manual => 'sickbeard' def plist; <<-EOS.undent Label #{plist_name} ProgramArguments #{opt_prefix}/bin/sickbeard -q --nolaunch -p 8081 RunAtLoad UserName #{`whoami`.chomp} EOS end def startup_script; <<-EOS.undent #!/usr/bin/env ruby me = begin File.expand_path( File.join( File.dirname(__FILE__), File.readlink(__FILE__) ) ) rescue __FILE__ end path = File.join(File.dirname(me), '..', 'SickBeard.py') args = ["--pidfile=#{var}/run/sickbeard.pid", "--datadir=#{etc}/sickbeard"] exec("python", path, *(args + ARGV)) EOS end def caveats; <<-EOS.undent SickBeard defaults to port 8081. EOS end end