homebrew-core/Formula/get_iplayer.rb
2017-10-05 01:29:25 -07:00

57 lines
2.2 KiB
Ruby

class GetIplayer < Formula
desc "Utility for downloading TV and radio programmes from BBC iPlayer"
homepage "https://github.com/get-iplayer/get_iplayer"
url "https://github.com/get-iplayer/get_iplayer/archive/v3.04.tar.gz"
sha256 "7c3de1fa796e534a03b57c45656b9e97a762174e475504dac081510f1b8febc0"
head "https://github.com/get-iplayer/get_iplayer.git", :branch => "develop"
bottle do
cellar :any_skip_relocation
sha256 "2ba8cbb3a4daf42534486a4024e0655773164d4ab2d2545a0097b0bc485f770c" => :high_sierra
sha256 "19b83f87b640b2a493c82e20b985242a1489bbc2015046923978afdd1f8434a0" => :sierra
sha256 "d482a9b684d306f8ab48d0939f42b5a5a1ab55a925e78a946654181e822f02b3" => :el_capitan
end
depends_on "atomicparsley" => :recommended
depends_on "ffmpeg" => :recommended
depends_on :macos => :yosemite
resource "IO::Socket::IP" do
url "https://cpan.metacpan.org/authors/id/P/PE/PEVANS/IO-Socket-IP-0.39.tar.gz"
sha256 "11950da7636cb786efd3bfb5891da4c820975276bce43175214391e5c32b7b96"
end
resource "Mojolicious" do
url "https://cpan.metacpan.org/authors/id/S/SR/SRI/Mojolicious-7.46.tar.gz"
sha256 "86212646e4859ddb2e003360dd5658bda6b2552202e5361908a27330c2747646"
end
def install
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"
resources.each do |r|
r.stage do
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
system "make", "install"
end
end
inreplace ["get_iplayer", "get_iplayer.cgi"] do |s|
s.gsub!(/^(my \$version_text);/i, "\\1 = \"#{pkg_version}-homebrew\";")
s.gsub! "#!/usr/bin/env perl", "#!/usr/bin/perl"
end
bin.install "get_iplayer", "get_iplayer.cgi"
bin.env_script_all_files(libexec/"bin", :PERL5LIB => ENV["PERL5LIB"])
man1.install "get_iplayer.1"
end
test do
output = shell_output("\"#{bin}/get_iplayer\" --refresh --refresh-include=\"BBC None\" --quiet dontshowanymatches 2>&1")
assert_match "get_iplayer #{pkg_version}-homebrew", output, "Unexpected version"
assert_match "INFO: 0 matching programmes", output, "Unexpected output"
assert_match "INFO: Indexing tv programmes (concurrent)", output,
"Mojolicious not found"
end
end