/
jolie.rb
63 lines (49 loc) 路 1.54 KB
/
jolie.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
class Jolie < Formula
desc "Service-oriented programming language"
homepage "https://www.jolie-lang.org/"
url "https://github.com/jolie/jolie/releases/download/v1.11.0/jolie-1.11.0.jar"
sha256 "31d86a5870353ce0da7a7f435bbbdcef6990737f21086bb853a3c95d75e9a267"
license "LGPL-2.1-only"
bottle do
sha256 cellar: :any_skip_relocation, all: "c0210ed772406c23a1e22b09ba486c8e402a7b52474bea1b2f7264a5c25025e5"
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