homebrew-core/Formula/jolie.rb

64 lines
1.5 KiB
Ruby

class Jolie < Formula
desc "Service-oriented programming language"
homepage "https://www.jolie-lang.org/"
url "https://github.com/jolie/jolie/releases/download/v1.10.13/jolie-1.10.13.jar"
sha256 "475c32552eaacb0de1f50e109f52e713610a99538b71abfc9167755e41c022a1"
license "LGPL-2.1-only"
bottle do
sha256 cellar: :any_skip_relocation, all: "3f2b2870d5769acb0d8a1ab6a3b7f24e4c3a654d55567627a708e641256e8206"
end
depends_on "openjdk"
def install
system Formula["openjdk"].opt_bin/"java",
"-jar", "jolie-#{version}.jar",
"--jolie-home", libexec,
"--jolie-launchers", libexec/"bin"
bin.install Dir["#{libexec}/bin/*"]
bin.env_script_all_files libexec/"bin",
JOLIE_HOME: "${JOLIE_HOME:-#{libexec}}",
JAVA_HOME: "${JAVA_HOME:-#{Formula["openjdk"].opt_prefix}}"
end
test do
file = testpath/"test.ol"
file.write <<~EOS
from console import Console, ConsoleIface
interface PowTwoInterface { OneWay: powTwo( int ) }
service main(){
outputPort Console { interfaces: ConsoleIface }
embed Console in Console
inputPort In {
location: "local://testPort"
interfaces: PowTwoInterface
}
outputPort Self {
location: "local://testPort"
interfaces: PowTwoInterface
}
init {
powTwo@Self( 4 )
}
main {
powTwo( x )
println@Console( x * x )()
}
}
EOS
out = shell_output("#{bin}/jolie #{file}").strip
assert_equal "16", out
end
end