30cfa4b3eb
Closes #34078. Signed-off-by: Chongyu Zhu <i@lembacon.com>
38 lines
1 KiB
Ruby
38 lines
1 KiB
Ruby
class Ballerina < Formula
|
|
desc "The flexible, powerful and beautiful programming language"
|
|
homepage "https://ballerina.io/"
|
|
url "https://product-dist.ballerina.io/downloads/0.983.0/ballerina-0.983.0.zip"
|
|
sha256 "faad9e8f71a6a2c9fe9bf36f27da02aa7e00d95955570e1a84fc95435f7ff3ae"
|
|
|
|
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["*"]
|
|
lib.install_symlink libexec/"lib/resources"
|
|
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
|