40 lines
1.1 KiB
Ruby
40 lines
1.1 KiB
Ruby
class Ballerina < Formula
|
|
desc "A Programming Language for Network Distributed Applications"
|
|
homepage "https://v1-0.ballerina.io"
|
|
url "https://product-dist.ballerina.io/downloads/1.0.2/jballerina-1.0.2.zip"
|
|
sha256 "e4ea5c605fb9a9e96872ca77449c6465ad9b8137cc492d9ea98089e0cecc09a1"
|
|
|
|
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() {
|
|
io:println("Hello, World!");
|
|
}
|
|
EOS
|
|
output = shell_output("#{bin}/ballerina run helloWorld.bal")
|
|
assert_equal "Hello, World!", output.chomp
|
|
end
|
|
end
|