homebrew-core/Formula/ballerina.rb

45 lines
1.2 KiB
Ruby
Raw Normal View History

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"
bottle :unneeded
depends_on :java
def install
# Remove Windows files
2018-03-27 21:54:40 +00:00
rm Dir["bin/*.bat"]
chmod 0755, "bin/ballerina"
2018-03-27 21:54:40 +00:00
chmod 0755, "bin/composer"
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"
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"
end
test do
(testpath/"helloWorld.bal").write <<~EOS
2018-03-27 21:54:40 +00:00
import ballerina.io;
function main (string[] args) {
2018-03-27 21:54:40 +00:00
io:println("Hello, World!");
}
EOS
output = shell_output("#{bin}/ballerina run helloWorld.bal")
assert_equal "Hello, World!", output.chomp
end
end