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.0.tar.gz" sha256 "c8f5fc6d800aae6107bf23900144804db5510c2676c93fbb269e4a0700837d68" head "https://github.com/sqlcipher/sqlcipher.git" bottle do cellar :any sha256 "281dd3eb19548f9d1ce79943a4be4f0b4e9a885a92daa5f4a82f7c48e22967a8" => :mojave sha256 "127d4b18e7b7a367d5cb0f67a01448ffd3a7658b4359797c238b08c9ce90527e" => :high_sierra sha256 "961280c1ddf743b04d7f32f4b399ca8b82c1a73ce9b2e32963daaa144d2169e5" => :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