class Sickrage < Formula desc "Automatic video library manager for TV Shows" homepage "https://www.sickrage.tv" url "https://github.com/SiCKRAGETV/SickRage/archive/v4.0.66.tar.gz" sha256 "37e74190b1393c4cd2fafc72581ced6f9188e5c90ad3af9192706e2173e1db6f" head "https://github.com/SiCKRAGETV/SickRage.git" bottle do cellar :any sha256 "2c6ce172da9c55c3f7baf1b93581c4ead89713346e21a437038dbe1ad35dc1ac" => :el_capitan sha256 "81ef3934e67213f5836beb673da263bd278a22d66750cabe1157bc5b8f49ddf1" => :yosemite sha256 "8d41c66dfcc471a110857c8a33578df9416e12ba93d7f42b519d7df4043af769" => :mavericks end depends_on :python if MacOS.version <= :snow_leopard depends_on "openssl" resource "Cheetah" do url "https://pypi.python.org/packages/source/C/Cheetah/Cheetah-2.4.4.tar.gz" sha256 "be308229f0c1e5e5af4f27d7ee06d90bb19e6af3059794e5fd536a6f29a9b550" end resource "Markdown" do url "https://pypi.python.org/packages/source/M/Markdown/Markdown-2.6.2.tar.gz" sha256 "ee17d0d7dc091e645dd48302a2e21301cc68f188505c2069d8635f94554170bf" end resource "pyOpenSSL" do url "https://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-0.15.1.tar.gz" sha256 "f0a26070d6db0881de8bcc7846934b7c3c930d8f9c79d45883ee48984bc0d672" end resource "cffi" do url "https://pypi.python.org/packages/source/c/cffi/cffi-1.1.2.tar.gz" sha256 "390970b602708c91ddc73953bb6929e56291c18a4d80f360afa00fad8b6f3339" end resource "cryptography" do url "https://pypi.python.org/packages/source/c/cryptography/cryptography-1.0.tar.gz" sha256 "211c02fe77d791d7fc437227ba1c046268d5da665e05d8a53fc19f4f74c21001" end resource "enum34" do url "https://pypi.python.org/packages/source/e/enum34/enum34-1.0.4.tar.gz" sha256 "d3c19f26a6a34629c18c775f59dfc5dd595764c722b57a2da56ebfb69b94e447" end resource "idna" do url "https://pypi.python.org/packages/source/i/idna/idna-2.0.tar.gz" sha256 "16199aad938b290f5be1057c0e1efc6546229391c23cea61ca940c115f7d3d3b" end resource "ipaddress" do url "https://pypi.python.org/packages/source/i/ipaddress/ipaddress-1.0.14.tar.gz" sha256 "226f4be44c6cb64055e23060848266f51f329813baae28b53dc50e93488b3b3e" end resource "pyasn1" do url "https://pypi.python.org/packages/source/p/pyasn1/pyasn1-0.1.8.tar.gz" sha256 "5d33be7ca0ec5997d76d29ea4c33b65c00c0231407fff975199d7f40530b8347" end resource "pycparser" do url "https://pypi.python.org/packages/source/p/pycparser/pycparser-2.14.tar.gz" sha256 "7959b4a74abdc27b312fed1c21e6caf9309ce0b29ea86b591fd2e99ecdf27f73" end resource "six" do url "https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz" sha256 "e24052411fc4fbd1f672635537c3fc2330d9481b18c0317695b46259512c91d5" end def install ENV.prepend_create_path "PYTHONPATH", libexec/"vendor/lib/python2.7/site-packages" resources.each do |r| r.stage do system "python", *Language::Python.setup_install_args(libexec/"vendor") end end libexec.install Dir["*"] (bin/"sickrage").write <<-EOS.undent #!/bin/bash export PYTHONPATH="#{libexec}/vendor/lib/python2.7/site-packages:$PYTHONPATH" python "#{libexec}/SickBeard.py"\ "--pidfile=#{var}/run/sickrage.pid"\ "--datadir=#{etc}/sickrage"\ "$@" EOS end plist_options :manual => "sickrage" def plist; <<-EOS.undent Label #{plist_name} ProgramArguments #{opt_bin}/sickrage -q --nolaunch -p 8081 RunAtLoad EOS end test do assert_match /SickBeard\.py/, shell_output("#{bin}/sickrage --help 2>&1", 1) end end