class Dbhash < Formula desc "Computes the SHA1 hash of schema and content of a SQLite database" homepage "https://www.sqlite.org/dbhash.html" url "https://sqlite.org/2018/sqlite-src-3230100.zip" version "3.23.1" sha256 "2db45af989d8c61cb7e179b64e2d48878336428c8c8c379b4594e8861aca7dfc" bottle do cellar :any_skip_relocation sha256 "fe4a6156c073e9f4e0dfae615d41dc89aa641043069bc82cea1c2d1aa38312d0" => :high_sierra sha256 "b849a136f559fde8f3de6bb6df5790ccddf8f1d99ed3fe2048c8b961e8040bb0" => :sierra sha256 "8137b38236bac7c875f7415bb89d62cf0a5256e05dea4459a27e2a2016d261aa" => :el_capitan end def install system "./configure", "--disable-debug", "--prefix=#{prefix}" system "make", "dbhash" bin.install "dbhash" end test do dbpath = testpath/"test.sqlite" sqlpath = testpath/"test.sql" sqlpath.write "create table test (name text);" system "/usr/bin/sqlite3 #{dbpath} < #{sqlpath}" assert_equal "b6113e0ce62c5f5ca5c9f229393345ce812b7309", shell_output("#{bin}/dbhash #{dbpath}").strip.split.first end end