homebrew-core/Formula/cromwell.rb

75 lines
2.0 KiB
Ruby

class Cromwell < Formula
desc "Workflow Execution Engine using Workflow Description Language"
homepage "https://github.com/broadinstitute/cromwell"
url "https://github.com/broadinstitute/cromwell/releases/download/68.1/cromwell-68.1.jar"
sha256 "621967bc0ee44fb31b89c6196047b917b9217f40005eb058567a69b4ca4177a8"
license "BSD-3-Clause"
bottle do
sha256 cellar: :any_skip_relocation, all: "f5ed34c2ec4cb842f20618f4ad40f64c95dd5d49759c83909b4acc89dfb17a60"
end
head do
url "https://github.com/broadinstitute/cromwell.git"
depends_on "sbt" => :build
end
depends_on "openjdk"
resource "womtool" do
url "https://github.com/broadinstitute/cromwell/releases/download/68.1/womtool-68.1.jar"
sha256 "4b63a101a04794828b4a3367197d2cc4be1fc944f041d7fe1098848f2535268c"
end
def install
if build.head?
system "sbt", "assembly"
libexec.install Dir["server/target/scala-*/cromwell-*.jar"][0] => "cromwell.jar"
libexec.install Dir["womtool/target/scala-*/womtool-*.jar"][0] => "womtool.jar"
else
libexec.install "cromwell-#{version}.jar" => "cromwell.jar"
resource("womtool").stage do
libexec.install "womtool-#{version}.jar" => "womtool.jar"
end
end
(bin/"cromwell").write <<~EOS
#!/bin/bash
exec "#{Formula["openjdk"].opt_bin}/java" $JAVA_OPTS -jar "#{libexec}/cromwell.jar" "$@"
EOS
(bin/"womtool").write <<~EOS
#!/bin/bash
exec "#{Formula["openjdk"].opt_bin}/java" -jar "#{libexec}/womtool.jar" "$@"
EOS
end
test do
(testpath/"hello.wdl").write <<~EOS
task hello {
String name
command {
echo 'hello ${name}!'
}
output {
File response = stdout()
}
}
workflow test {
call hello
}
EOS
(testpath/"hello.json").write <<~EOS
{
"test.hello.name": "world"
}
EOS
result = shell_output("#{bin}/cromwell run --inputs hello.json hello.wdl")
assert_match "test.hello.response", result
end
end