36 lines
1.4 KiB
Ruby
36 lines
1.4 KiB
Ruby
class SqliteAnalyzer < Formula
|
|
desc "Analyze how space is allocated inside an SQLite file"
|
|
homepage "https://www.sqlite.org/"
|
|
url "https://sqlite.org/2019/sqlite-src-3270100.zip"
|
|
version "3.27.1"
|
|
sha256 "f0fcc4da31e61a9c516f7c1ff21ec71ad6a05b1fe88f7f0b4d9aa54649c85986"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "a8c9c16f964bdd9b56857c20f6f2becdb516e59013df0b0ffeec5651d32be1d4" => :mojave
|
|
sha256 "a64448007f6ce27f80449a33996fadbdc2af781eebc0a02f74aae77e6d3580f3" => :high_sierra
|
|
sha256 "0f88839367289ed0f225ef977a0720c9f74d6ca220687460a11a867479e84688" => :sierra
|
|
end
|
|
|
|
def install
|
|
sdkprefix = MacOS.sdk_path_if_needed ? MacOS.sdk_path : ""
|
|
system "./configure", "--disable-debug",
|
|
"--with-tcl=#{sdkprefix}/System/Library/Frameworks/Tcl.framework/",
|
|
"--prefix=#{prefix}"
|
|
system "make", "sqlite3_analyzer"
|
|
bin.install "sqlite3_analyzer"
|
|
end
|
|
|
|
test do
|
|
dbpath = testpath/"school.sqlite"
|
|
sqlpath = testpath/"school.sql"
|
|
sqlpath.write <<~EOS
|
|
create table students (name text, age integer);
|
|
insert into students (name, age) values ('Bob', 14);
|
|
insert into students (name, age) values ('Sue', 12);
|
|
insert into students (name, age) values ('Tim', 13);
|
|
EOS
|
|
system "/usr/bin/sqlite3 #{dbpath} < #{sqlpath}"
|
|
system bin/"sqlite3_analyzer", dbpath
|
|
end
|
|
end
|