homebrew-core/Formula/couchpotatoserver.rb

53 lines
1.3 KiB
Ruby
Raw Normal View History

2014-07-21 02:23:22 +00:00
require "formula"
class Couchpotatoserver < Formula
2014-07-21 02:23:22 +00:00
homepage "https://couchpota.to"
url "https://github.com/RuudBurger/CouchPotatoServer/archive/build/2.5.2.tar.gz"
sha1 "b19509aa2fefca8c1caa8682a99bbce7e478ba22"
2014-07-21 02:23:22 +00:00
head "https://github.com/RuudBurger/CouchPotatoServer.git"
def install
2013-05-28 02:12:40 +00:00
prefix.install_metafiles
2014-07-21 02:23:22 +00:00
libexec.install Dir["*"]
(bin+"couchpotatoserver").write(startup_script)
end
2014-07-21 02:23:22 +00:00
plist_options :manual => "couchpotatoserver"
def plist; <<-EOS.undent
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>#{plist_name}</string>
<key>Program</key>
2014-03-06 05:28:31 +00:00
<string>#{opt_bin}/couchpotatoserver</string>
<key>ProgramArguments</key>
<array>
<string>--quiet</string>
<string>--daemon</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>UserName</key>
<string>#{`whoami`.chomp}</string>
</dict>
</plist>
EOS
end
def startup_script; <<-EOS.undent
2013-05-28 02:12:40 +00:00
#!/bin/bash
python "#{libexec}/CouchPotato.py"\
"--pid_file=#{var}/run/couchpotatoserver.pid"\
"--data_dir=#{etc}/couchpotatoserver"\
"$@"
EOS
end
2013-05-28 02:12:40 +00:00
def caveats
"CouchPotatoServer defaults to port 5050."
end
end