33 lines
1.2 KiB
Ruby
33 lines
1.2 KiB
Ruby
class SqliteAnalyzer < Formula
|
|
desc "Analyze how space is allocated inside an SQLite file"
|
|
homepage "https://www.sqlite.org/"
|
|
url "https://sqlite.org/2018/sqlite-src-3240000.zip"
|
|
version "3.24.0"
|
|
sha256 "72a302f5ac624079a0aaf98316dddda00063a52053f5ab7651cfc4119e1693a5"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "31234588897314b6021b0705a59750943af2135c51e2498cff04cf99d8c4bb4c" => :high_sierra
|
|
sha256 "657ab818ffae1e7a9564f73bf4a625056692f86bef79fcb0478e534eb662a87b" => :sierra
|
|
sha256 "cbc30384739a71051f243808e4973d19730292399da929a3f85781c105d63c50" => :el_capitan
|
|
end
|
|
|
|
def install
|
|
system "./configure", "--disable-debug", "--with-tcl=/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
|