ttytter: fix readline support

Closes Homebrew/homebrew#41835.
This commit is contained in:
Alex Dunn 2015-07-17 12:07:18 -07:00
parent 0476b7f038
commit 730358b235

View file

@ -1,24 +1,37 @@
require 'formula'
class Ttytter < Formula
desc "Twitter command-line client"
homepage 'http://www.floodgap.com/software/ttytter/'
url 'http://www.floodgap.com/software/ttytter/dist2/2.1.00.txt'
sha1 'a72b2c4b7da8a370ff15c7f5a1a3ecf9056590f0'
homepage "http://www.floodgap.com/software/ttytter/"
url "http://www.floodgap.com/software/ttytter/dist2/2.1.00.txt"
sha256 "86c6e7767c65e3179d4ed6368e27df5c4b200285207c3df3164c5a84a73517b1"
depends_on "readline" => :optional
resource "Term::ReadLine::TTYtter" do
url "https://cpan.metacpan.org/authors/id/C/CK/CKAISER/Term-ReadLine-TTYtter-1.4.tar.gz"
mirror "http://www.cpan.org/authors/id/C/CK/CKAISER/Term-ReadLine-TTYtter-1.4.tar.gz"
sha256 "ac373133cee1b2122a8273fe7b4244613d0eecefe88b668bd98fe71d1ec4ac93"
end
def install
bin.install "#{version}.txt" => "ttytter"
if build.with? "readline"
ENV.prepend_create_path "PERL5LIB", libexec/"lib/perl5"
resource("Term::ReadLine::TTYtter").stage do
system "perl", "Makefile.PL", "INSTALL_BASE=#{libexec}"
system "make"
system "make", "install"
end
bin.env_script_all_files(libexec/"bin", :PERL5LIB => ENV["PERL5LIB"])
chmod 0755, libexec/"bin/ttytter"
end
end
def caveats; <<-EOS.undent
To take full advantage of readline features you must install readline:
brew install readline
and the Perl Module Term::ReadLine::TTYtter
cpan -i Term::ReadLine::TTYtter
Or if you have cpanminus:
cpanm Term::ReadLine::TTYtter
EOS
test do
IO.popen("#{bin}/ttytter", "r+") do |pipe|
assert_equal "-- using SSL for default URLs.", pipe.gets.chomp
pipe.puts "^C"
pipe.close_write
end
end
end