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-2026.01.3.zip" sha256 "ffea5fa87ffc4ae79847651760b427de4347d0a0b8dabeed633ebefbcdc342bc" 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: "891bdb7233013b4c1de6f31b118aeac03f9262fc364c72af4ce7fbdf4842a0a8" 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