47 lines
1.6 KiB
Ruby
47 lines
1.6 KiB
Ruby
class Sqlcipher < Formula
|
|
desc "SQLite extension providing 256-bit AES encryption"
|
|
homepage "https://www.zetetic.net/sqlcipher/"
|
|
url "https://github.com/sqlcipher/sqlcipher/archive/v4.3.0.tar.gz"
|
|
sha256 "fccb37e440ada898902b294d02cde7af9e8706b185d77ed9f6f4d5b18b4c305f"
|
|
head "https://github.com/sqlcipher/sqlcipher.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "1de7fda1b6e412d3bb49f18cb7a174f40af184d917064c79c047a9abf65d89ae" => :catalina
|
|
sha256 "76195cf0c62a5045b8d977b937938d448a3b9fc842b69f0b2a126ad918c6b7dd" => :mojave
|
|
sha256 "66462c093665ae487d19de677d544489a2608e239792317d4cbacd75d692d8a6" => :high_sierra
|
|
end
|
|
|
|
depends_on "openssl@1.1"
|
|
|
|
def install
|
|
args = %W[
|
|
--prefix=#{prefix}
|
|
--enable-tempstore=yes
|
|
--with-crypto-lib=#{Formula["openssl@1.1"].opt_prefix}
|
|
--enable-load-extension
|
|
--disable-tcl
|
|
]
|
|
|
|
# Build with full-text search enabled
|
|
args << "CFLAGS=-DSQLITE_HAS_CODEC -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_FTS5"
|
|
|
|
system "./configure", *args
|
|
system "make"
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
path = testpath/"school.sql"
|
|
path.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', json_extract('{"age": 13}', '$.age'));
|
|
select name from students order by age asc;
|
|
EOS
|
|
|
|
names = shell_output("#{bin}/sqlcipher < #{path}").strip.split("\n")
|
|
assert_equal %w[Sue Tim Bob], names
|
|
end
|
|
end
|