homebrew-core/Formula/liquigraph.rb
2018-08-22 22:18:23 +02:00

49 lines
2.1 KiB
Ruby

class Liquigraph < Formula
desc "Migration runner for Neo4j"
homepage "https://www.liquigraph.org/"
url "https://github.com/liquigraph/liquigraph/archive/liquigraph-3.0.3.tar.gz"
sha256 "11ec760e27d3c6d8addcae17096aa731f7f1b2b796e90e6e4aea4bff4b98da4f"
head "https://github.com/liquigraph/liquigraph.git"
bottle do
cellar :any_skip_relocation
sha256 "407227e02e7e7b2485a7de47643d38f80ba081bc3cb8d9ae01c882d9e01a18e8" => :mojave
sha256 "2d7d8f969594414fa7d9f0ab333c9d8fadad06b43f31a0eda5d9a2dd2189b349" => :high_sierra
sha256 "b0fe4a27ef00f62f5fb8716dd49ef4e3c748cec97de7f2ed4b5b1a13450869ce" => :sierra
sha256 "fe8a020c5656dc0b4d57cb1043badc17a39a8ec4daa48b2e6517d46a612f4e05" => :el_capitan
end
depends_on "maven" => :build
depends_on :java => "1.8"
def install
cmd = Language::Java.java_home_cmd("1.8")
ENV["JAVA_HOME"] = Utils.popen_read(cmd).chomp
system "mvn", "-B", "-q", "-am", "-pl", "liquigraph-cli", "clean", "package", "-DskipTests"
(buildpath/"binaries").mkpath
system "tar", "xzf", "liquigraph-cli/target/liquigraph-cli-bin.tar.gz", "-C", "binaries"
libexec.install "binaries/liquigraph-cli/liquigraph.sh"
libexec.install "binaries/liquigraph-cli/liquigraph-cli.jar"
(bin/"liquigraph").write_env_script libexec/"liquigraph.sh", Language::Java.java_home_env("1.8")
end
test do
failing_hostname = "verrryyyy_unlikely_host"
changelog = testpath/"changelog"
changelog.write <<~EOS
<?xml version="1.0" encoding="UTF-8"?>
<changelog>
<changeset id="hello-world" author="you">
<query>CREATE (n:Sentence {text:'Hello monde!'}) RETURN n</query>
</changeset>
<changeset id="hello-world-fixed" author="you">
<query>MATCH (n:Sentence {text:'Hello monde!'}) SET n.text='Hello world!' RETURN n</query>
</changeset>
</changelog>
EOS
jdbc = "jdbc:neo4j:http://#{failing_hostname}:7474/"
output = shell_output("#{bin}/liquigraph -c #{changelog.realpath} -g #{jdbc} 2>&1", 1)
assert_match "UnknownHostException: #{failing_hostname}", output
end
end