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.0.1.tar.gz" sha256 "2f803017378c7479cb791be59b7bad8392a15acddbcc094e4433581fe421f4ca" head "https://github.com/sqlcipher/sqlcipher.git" bottle do cellar :any sha256 "8ba2fd076a260e4ac32148ca6920afde9866a46396d9ce55a71f7053ce87a9fb" => :mojave sha256 "48860256ecb6db7e072e6fca8db450c20323cd9c0874349c4317e1f29418127e" => :high_sierra sha256 "8fcdf53d01a09aeec89caecaf3e4dd6fbc4b8c91058db7eb29d328788a286b3f" => :sierra end depends_on "openssl" def install args = %W[ --prefix=#{prefix} --enable-tempstore=yes --with-crypto-lib=#{Formula["openssl"].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