homebrew-core/Formula/apache-flink.rb
Till Rohrmann 4c1d4a3d3b
apache-flink 1.6.0
Closes #30924.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
2018-08-09 15:26:13 +01:00

39 lines
1.3 KiB
Ruby

class ApacheFlink < Formula
desc "Scalable batch and stream data processing"
homepage "https://flink.apache.org/"
url "https://www.apache.org/dyn/closer.lua?path=flink/flink-1.6.0/flink-1.6.0-bin-hadoop27-scala_2.11.tgz"
version "1.6.0"
sha256 "460da13ba3cc51cd1ceaaa2d286215056321c769ed2a5720d8fb5bebf0ac1b99"
head "https://github.com/apache/flink.git"
bottle :unneeded
depends_on :java => "1.8"
def install
rm_f Dir["bin/*.bat"]
libexec.install Dir["*"]
(libexec/"bin").env_script_all_files(libexec/"libexec", Language::Java.java_home_env("1.8"))
chmod 0755, Dir["#{libexec}/bin/*"]
bin.write_exec_script "#{libexec}/bin/flink"
end
test do
(testpath/"log").mkpath
(testpath/"input").write "foo bar foobar"
expected = <<~EOS
(foo,1)
(bar,1)
(foobar,1)
EOS
ENV.prepend "_JAVA_OPTIONS", "-Djava.io.tmpdir=#{testpath}"
ENV.prepend "FLINK_LOG_DIR", testpath/"log"
system libexec/"bin/start-cluster.sh"
system bin/"flink", "run", "-p", "1",
libexec/"examples/streaming/WordCount.jar", "--input", "input",
"--output", "result"
system libexec/"bin/stop-cluster.sh"
assert_predicate testpath/"result", :exist?
assert_equal expected, (testpath/"result").read
end
end