class Ballerina < Formula desc "The flexible, powerful and beautiful programming language" homepage "https://ballerinalang.org/" 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 rm Dir["bin/*.bat"] chmod 0755, "bin/ballerina" chmod 0755, "bin/composer" inreplace ["bin/ballerina"] do |s| s.gsub! /^BALLERINA_HOME=.*$/, "BALLERINA_HOME=#{libexec}" 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" bin.install_symlink libexec/"bin/composer" end test do (testpath/"helloWorld.bal").write <<~EOS import ballerina.io; 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