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.14.tar.gz" sha256 "6436a942b819aaa4b3df56f990812124909476142febe6432304e7a621411522" revision 1 head "https://github.com/get-iplayer/get_iplayer.git", :branch => "develop" bottle do cellar :any_skip_relocation sha256 "0ba5c91219bcc6591fef339adc2911e8586417dc2a1bb9c1ad714a1c19e17cd4" => :high_sierra sha256 "db39518eb4fe8a45613c164377c7a87a4816b0c3ac72883066279774d13422c4" => :sierra sha256 "91f8d9272c2b4e760559d038e2d034236e69c654f787e307445409ea2a9e1d14" => :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 "IO::Socket::SSL" do url "https://cpan.metacpan.org/authors/id/S/SU/SULLR/IO-Socket-SSL-2.056.tar.gz" sha256 "91451ecc28b243a78b438f0a42db24c4b60a86f088879b38e40bdbd697818259" end resource "Mojolicious" do url "https://cpan.metacpan.org/authors/id/S/SR/SRI/Mojolicious-7.77.tar.gz" sha256 "b6416de94938ee621e355c36fd837704dd7cf15846148dfbbfb82e8710af846b" end resource "Mozilla::CA" do url "https://cpan.metacpan.org/authors/id/A/AB/ABH/Mozilla-CA-20180117.tar.gz" sha256 "f2cc9fbe119f756313f321e0d9f1fac0859f8f154ac9d75b1a264c1afdf4e406" end def install ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5" ENV["NO_NETWORK_TESTING"] = "1" 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