class DbxCli < Formula desc "Command-line interface for DBX database connections, schema, and safe queries" homepage "https://github.com/t8y2/dbx" url "https://registry.npmjs.org/@dbx-app/cli/-/cli-0.4.7.tgz" sha256 "d507138dc5bd9611ad1e668a14e5a099754e8a1a3994742f2d03dbc22da911d8" license "Apache-2.0" depends_on "node" on_linux do depends_on "pkgconf" => :build depends_on "libsecret" end def install system "npm", "install", *std_npm_args bin.install_symlink libexec.glob("bin/*") # Rebuild better-sqlite3 and keytar native bindings for the current platform. # prebuild-install is blocked by the Homebrew sandbox during npm install, # so we must rebuild them explicitly via node-gyp. node_modules = libexec/"lib/node_modules/@dbx-app/cli/node_modules" cd node_modules/"better-sqlite3" do system "npm", "run", "build-release" end cd node_modules/"keytar" do rm_r "prebuilds" if File.directory?("prebuilds") system "npm", "run", "build" end end test do assert_path_exists bin/"dbx" system bin/"dbx", "doctor" end end