From da5be2dd5db7079f9b1b50088696cc9c8908da8b Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Tue, 30 Jan 2018 22:51:22 +0530 Subject: [PATCH] ballerina 0.96.0 (new formula) (#23460) --- Formula/ballerina.rb | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Formula/ballerina.rb diff --git a/Formula/ballerina.rb b/Formula/ballerina.rb new file mode 100644 index 0000000000..f57c88ced8 --- /dev/null +++ b/Formula/ballerina.rb @@ -0,0 +1,37 @@ +class Ballerina < Formula + desc "The flexible, powerful and beautiful programming language" + homepage "https://ballerinalang.org/" + url "https://ballerinalang.org/downloads/ballerina-runtime/ballerina-0.96.0.zip" + sha256 "7bbaecbbce0f2132854104a7975dec7e9019ed699536dedca3499d42f908cc87" + + bottle :unneeded + + depends_on :java + + def install + # Remove Windows files + rm "bin/ballerina.bat" + + chmod 0755, "bin/ballerina" + + inreplace ["bin/ballerina"] do |s| + # Translate ballerina script + s.gsub! /^BALLERINA_HOME=.*$/, "BALLERINA_HOME=#{libexec}" + # dos to unix (bug fix for version 2.3.11) + s.gsub! /\r?/, "" + end + + libexec.install Dir["*"] + bin.install_symlink libexec/"bin/ballerina" + end + + test do + (testpath/"helloWorld.bal").write <<~EOS + function main (string[] args) { + println("Hello, World!"); + } + EOS + output = shell_output("#{bin}/ballerina run helloWorld.bal") + assert_equal "Hello, World!", output.chomp + end +end