forked from Homebrew/homebrew-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathballerina.rb
40 lines (33 loc) · 1.12 KB
/
ballerina.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
class Ballerina < Formula
desc "The flexible, powerful and beautiful programming language"
homepage "https://ballerina.io/"
url "https://product-dist.ballerina.io/downloads/0.991.0/ballerina-0.991.0.zip"
sha256 "be7d039c42e8882572f58c1f67e8dbf6e3c4ca719190a4e7da1405dd595ca66b"
bottle :unneeded
depends_on :java => "1.8"
def install
# Remove Windows files
rm Dir["bin/*.bat"]
chmod 0755, "bin/ballerina"
inreplace ["bin/ballerina"] do |s|
s.gsub! /^BALLERINA_HOME=.*$/, "BALLERINA_HOME=#{libexec}"
s.gsub! /\r?/, ""
end
bin.install "bin/ballerina"
libexec.install Dir["*"]
# Add symlinks for the Language Server
prefix.install_symlink libexec/"bre"
prefix.install_symlink libexec/"lib"
bin.env_script_all_files(libexec/"bin", Language::Java.java_home_env("1.8"))
end
test do
(testpath/"helloWorld.bal").write <<~EOS
import ballerina/io;
public function main(string... args) {
io:println("Hello, World!");
}
EOS
output = shell_output("#{bin}/ballerina run helloWorld.bal")
assert_equal "Hello, World!", output.chomp
end
end