class CypherShell < Formula desc "Command-line shell where you can execute Cypher against Neo4j" homepage "https://neo4j.com" url "https://dist.neo4j.org/cypher-shell/cypher-shell-2025.06.2.zip" sha256 "1e722a6f317df01e9d08c13f40d2ded50723739672eb6b82cfeafecbf87d4068" license "GPL-3.0-only" version_scheme 1 livecheck do url "https://neo4j.com/deployment-center/" regex(/href=.*?cypher-shell[._-]v?(\d+(?:\.\d+)+)\.zip/i) end bottle do sha256 cellar: :any_skip_relocation, all: "142b7c35ed5b7f63f75bf05f0f7be4ef47a2c3ee7b002c2ecd022d5de437f8c2" end depends_on "openjdk@21" def install libexec.install Dir["*"] (bin/"cypher-shell").write_env_script libexec/"bin/cypher-shell", Language::Java.overridable_java_home_env("21") end test do refute_match "unsupported version of the Java runtime", shell_output("#{bin}/cypher-shell -h 2>&1", 1) # The connection will fail and print the name of the host assert_match "doesntexist", shell_output("#{bin}/cypher-shell -a bolt://doesntexist 2>&1", 1) end end