homebrew-core/Formula/ballerina.rb

42 lines
1.1 KiB
Ruby

class Ballerina < Formula
desc "Programming Language for Network Distributed Applications"
homepage "https://ballerina.io"
url "https://dist.ballerina.io/downloads/1.2.19/ballerina-1.2.19.zip"
sha256 "f75b8bd2f3b5f84bb2caa5dcf151492ca13cd926c401ed844e03120738495440"
license "Apache-2.0"
livecheck do
url "https://ballerina.io/downloads/"
regex(%r{href=.*?/downloads/.*?ballerina[._-]v?(\d+(?:\.\d+)+)\.}i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "c4d999de5a09c1d62a7dddc0a59ce84400d355b5adcc276bd0ef371ee997f0dd"
end
depends_on arch: :x86_64 # openjdk@8 does not have ARM support
depends_on "openjdk@8"
def install
# Remove Windows files
rm Dir["bin/*.bat"]
chmod 0755, "bin/bal"
bin.install "bin/bal"
libexec.install Dir["*"]
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}/bal run helloWorld.bal")
assert_equal "Hello, World!", output.chomp
end
end