Skip to content

Instantly share code, notes, and snippets.

@dnicolson
Last active December 17, 2019 00:11
Show Gist options
  • Save dnicolson/105751066bf1defcfce3b89855de91d4 to your computer and use it in GitHub Desktop.
Save dnicolson/105751066bf1defcfce3b89855de91d4 to your computer and use it in GitHub Desktop.
A brew formula for weatherspect, the changes on line 99 fix an SSL issue but the weather parsing no longer works
class Weatherspect < Formula
desc "Virtual weather environment in ASCII"
homepage "http://robobunny.com/projects/weatherspect/html/"
url "http://robobunny.com/projects/weatherspect/weatherspect_v1.11.tar.gz"
sha256 "6186b41c7db8529eaf98864c2760837a2664cf107d1fa53620beef686c2dc1b8"
depends_on "openssl"
resource "Curses" do
url "https://cpan.metacpan.org/authors/id/G/GI/GIRAFFED/Curses-1.34.tar.gz"
sha256 "808e44d5946be265af5ff0b90f3d0802108e7d1b39b0fe68a4a446fe284d322b"
end
resource "Term::Animation" do
url "http://robobunny.com/projects/animation/Term-Animation-2.6.tar.gz"
sha256 "7d5c3c2d4f9b657a8b1dce7f5e2cbbe02ada2e97c72f3a0304bf3c99d084b045"
end
resource "LWP::Protocol::https" do
url "https://cpan.metacpan.org/authors/id/M/MS/MSCHILLI/LWP-Protocol-https-6.06.tar.gz"
sha256 "b86c83cc1dcf4a6f84e2fbe32f9c39591a36e6e418af00533505f3452496adef"
end
resource "LWP::Simple" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/libwww-perl-6.15.tar.gz"
sha256 "6f349d45c21b1ec0501c4437dfcb70570940e6c3d5bff783bd91d4cddead8322"
end
resource "HTTP::Message" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/HTTP-Message-6.11.tar.gz"
sha256 "e7b368077ae6a188d99920411d8f52a8e5acfb39574d4f5c24f46fd22533d81b"
end
resource "URI" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/URI-1.71.tar.gz"
sha256 "9c8eca0d7f39e74bbc14706293e653b699238eeb1a7690cc9c136fb8c2644115"
end
resource "HTTP::Date" do
url "https://cpan.metacpan.org/authors/id/G/GA/GAAS/HTTP-Date-6.02.tar.gz"
sha256 "e8b9941da0f9f0c9c01068401a5e81341f0e3707d1c754f8e11f42a7e629e333"
end
resource "Encode::Locale" do
url "https://cpan.metacpan.org/authors/id/G/GA/GAAS/Encode-Locale-1.05.tar.gz"
sha256 "176fa02771f542a4efb1dbc2a4c928e8f4391bf4078473bd6040d8f11adb0ec1"
end
resource "HTML::TokeParser" do
url "https://cpan.metacpan.org/authors/id/G/GA/GAAS/HTML-Parser-3.72.tar.gz"
sha256 "ec28c7e1d9e67c45eca197077f7cdc41ead1bb4c538c7f02a3296a4bb92f608b"
end
resource "HTML::Tagset" do
url "https://cpan.metacpan.org/authors/id/P/PE/PETDANCE/HTML-Tagset-3.20.tar.gz"
sha256 "adb17dac9e36cd011f5243881c9739417fd102fce760f8de4e9be4c7131108e2"
end
resource "Net::SSLeay" do
url "https://cpan.metacpan.org/authors/id/M/MI/MIKEM/Net-SSLeay-1.74.tar.gz"
sha256 "167a955410168a6d617fbb11d8a40a5ebffaef950035fb072b3e9b6b706cbc7d"
end
resource "File::Listing" do
url "https://cpan.metacpan.org/authors/id/G/GA/GAAS/File-Listing-6.04.tar.gz"
sha256 "1e0050fcd6789a2179ec0db282bf1e90fb92be35d1171588bd9c47d52d959cf5"
end
resource "Net::HTTP" do
url "https://cpan.metacpan.org/authors/id/E/ET/ETHER/Net-HTTP-6.09.tar.gz"
sha256 "52762b939d84806908ba544581c5708375f7938c3c0e496c128ca3fbc425e58d"
end
resource "IO::HTML" do
url "https://cpan.metacpan.org/authors/id/C/CJ/CJM/IO-HTML-1.001.tar.gz"
sha256 "ea78d2d743794adc028bc9589538eb867174b4e165d7d8b5f63486e6b828e7e0"
end
resource "IO::Socket::SSL" do
url "https://cpan.metacpan.org/authors/id/S/SU/SULLR/IO-Socket-SSL-2.027.tar.gz"
sha256 "723517ea71f90105579e7db7a1a2e053bf5c8142a187df8bc1fe3881c3383f67"
end
def install
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"
resources.each do |r|
r.stage do
if r.name == "Net::SSLeay"
inreplace "inc/Module/Install/PRIVATE/Net/SSLeay.pm", "if ( $self->prompt(", "if ( 0 && $self->prompt("
end
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
system "make"
system "make", "install"
end
end
inreplace "weatherspect", "$document = get($self->{_url});", "$ua->ssl_opts(verify_hostname => 0);\n $document = get($self->{_url});"
chmod 0755, "weatherspect"
bin.install "weatherspect"
bin.env_script_all_files(libexec/"bin", :PERL5LIB => ENV["PERL5LIB"])
end
test do
assert_match "^You don't seem to have a config file.", shell_output(bin/"weatherspect")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment