Created
January 19, 2023 12:47
-
-
Save palmerj/399c934034be5cd811608dfc4cbe0f91 to your computer and use it in GitHub Desktop.
PgTAP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Pgtap < Formula | |
desc "Unit testing framework for PostgreSQL" | |
homepage "http://pgtap.org/" | |
url "https://api.pgxn.org/dist/pgtap/1.2.0/pgtap-1.2.0.zip" | |
sha256 "1b574735576f1cd8c6bbbfc91e0435cb067d7a09c4319d61826960aa3911d780" | |
revision 1 | |
head "https://github.com/theory/pgtap.git" | |
bottle do | |
cellar :any | |
sha256 "cdc7061668561266d6e4f3af7b1edeabced55a4b916fb05a01839783e8b8c016" => :el_capitan | |
sha256 "adeffa3e59f69e34e637815eeed7e52277550bfb41b4303c0ae0f62b28d35a31" => :yosemite | |
sha256 "2da98046f27fc92f0a652004557609132fb8aa50a18e994d0071aac736eaac3f" => :mavericks | |
end | |
# Not :postgresql, because we need to install into its share directory. | |
depends_on "postgresql" | |
resource "Test::Harness" do | |
url "https://cpan.metacpan.org/authors/id/L/LE/LEONT/Test-Harness-3.36.tar.gz" | |
sha256 "e7566f13b041d028b56f184b77ec2545ec6f0bb5a0f8f5368f7e4a08b496b63e" | |
end | |
resource "TAP::Parser::SourceHandler::pgTAP" do | |
url "https://cpan.metacpan.org/authors/id/D/DW/DWHEELER/TAP-Parser-SourceHandler-pgTAP-3.36.tar.gz" | |
sha256 "07be51532e063eac6ed8e581505470eebc81d5506441af2dcf32bc0ebee98c67" | |
end | |
resource "DBD::Pg" do | |
url "https://cpan.metacpan.org/authors/id/T/TU/TURNSTEP/DBD-Pg-3.16.0.tar.gz" | |
sha256 "2c31163d8bdaaf8beaef9c97b8f260432d67a534bc7b69e7265c21cb841432b8" | |
end | |
def install | |
# Make sure modules can find just-installed dependencies. | |
arch = `perl -MConfig -E 'print $Config{archname}'` | |
plib = "#{lib}/perl5" | |
ENV["PERL5LIB"] = "#{plib}:#{plib}/#{arch}:#{lib}:#{lib}/#{arch}" | |
resource("Test::Harness").stage do | |
system "perl", "Makefile.PL", "INSTALL_BASE=#{prefix}", | |
"INSTALLSITEMAN1DIR=#{man1}", "INSTALLSITEMAN3DIR=#{man3}" | |
system "make" | |
system "make", "install" | |
end | |
resource("TAP::Parser::SourceHandler::pgTAP").stage do | |
system "perl", "Build.PL", "--install_base", prefix, "--install_path", | |
"bindoc=#{man1}", "--install_path", "libdoc=#{man3}" | |
system "./Build" | |
system "./Build", "install" | |
end | |
resource("DBD::Pg").stage do | |
system "perl", "Makefile.PL", "INSTALL_BASE=#{prefix}", | |
"INSTALLSITEMAN3DIR=#{man3}" | |
system "make" | |
system "make", "install" | |
end | |
pg_config = "#{Formula["postgresql"].opt_bin}/pg_config" | |
mkdir "stage" | |
system "make", "PG_CONFIG=#{pg_config}" | |
system "make", "install", "DESTDIR=#{buildpath}/stage" | |
(doc/"postgresql/extension").install Dir["stage/**/share/doc/postgresql/extension/*"] | |
(share/"postgresql/extension").install Dir["stage/**/share/postgresql/extension/*"] | |
bin.env_script_all_files(libexec/"bin", PERL5LIB: ENV["PERL5LIB"]) | |
end | |
test do | |
# This is a bit of a "fake" test but it allows us to check the Perl env | |
# has been configured correctly and the tools have basic functionality. | |
system "#{Formula["postgresql"].opt_bin}/initdb", testpath/"test" | |
system bin/"pg_prove", testpath/"test" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment