49 lines
1.7 KiB
Ruby
49 lines
1.7 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"
|
|
revision 1
|
|
head "https://github.com/sqlcipher/sqlcipher.git"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "e591938b7bc869c5eed94883d0a017f78a6c4ef00cea844c4b2c3888a3adf5a8" => :catalina
|
|
sha256 "a6ff6235a7e50d3ae89273323c0741672049cbb1ee12f9c30d794b544112c20d" => :mojave
|
|
sha256 "3d8eda2ea4d3205955380eae7275562be849fe5586494b676c8ae87b273eae85" => :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 -DSQLITE_ENABLE_COLUMN_METADATA"
|
|
|
|
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
|