2018-01-30 17:21:22 +00:00
|
|
|
class Ballerina < Formula
|
|
|
|
desc "The flexible, powerful and beautiful programming language"
|
|
|
|
homepage "https://ballerinalang.org/"
|
2018-03-27 21:54:40 +00:00
|
|
|
url "https://ballerinalang.org/downloads/ballerina-tools/ballerina-tools-0.964.0.zip"
|
|
|
|
sha256 "0ea872b63807e7e59105a353e9f7b571d8321526e3defe6a1773dc44fb6c0c7c"
|
2018-01-30 17:21:22 +00:00
|
|
|
|
|
|
|
bottle :unneeded
|
|
|
|
|
|
|
|
depends_on :java
|
|
|
|
|
|
|
|
def install
|
|
|
|
# Remove Windows files
|
2018-03-27 21:54:40 +00:00
|
|
|
rm Dir["bin/*.bat"]
|
2018-01-30 17:21:22 +00:00
|
|
|
|
|
|
|
chmod 0755, "bin/ballerina"
|
2018-03-27 21:54:40 +00:00
|
|
|
chmod 0755, "bin/composer"
|
2018-01-30 17:21:22 +00:00
|
|
|
|
|
|
|
inreplace ["bin/ballerina"] do |s|
|
|
|
|
s.gsub! /^BALLERINA_HOME=.*$/, "BALLERINA_HOME=#{libexec}"
|
2018-03-27 21:54:40 +00:00
|
|
|
s.gsub! /\r?/, ""
|
|
|
|
end
|
|
|
|
|
|
|
|
inreplace ["bin/composer"] do |s|
|
|
|
|
s.gsub! /^BASE_DIR=.*$/, "BASE_DIR=#{libexec}/bin"
|
|
|
|
s.gsub! /^PRGDIR=.*$/, "PRGDIR=#{libexec}/bin"
|
2018-01-30 17:21:22 +00:00
|
|
|
s.gsub! /\r?/, ""
|
|
|
|
end
|
|
|
|
|
|
|
|
libexec.install Dir["*"]
|
|
|
|
bin.install_symlink libexec/"bin/ballerina"
|
2018-03-27 21:54:40 +00:00
|
|
|
bin.install_symlink libexec/"bin/composer"
|
2018-01-30 17:21:22 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"helloWorld.bal").write <<~EOS
|
2018-03-27 21:54:40 +00:00
|
|
|
import ballerina.io;
|
2018-01-30 17:21:22 +00:00
|
|
|
function main (string[] args) {
|
2018-03-27 21:54:40 +00:00
|
|
|
io:println("Hello, World!");
|
2018-01-30 17:21:22 +00:00
|
|
|
}
|
|
|
|
EOS
|
|
|
|
output = shell_output("#{bin}/ballerina run helloWorld.bal")
|
|
|
|
assert_equal "Hello, World!", output.chomp
|
|
|
|
end
|
|
|
|
end
|