2018-01-30 17:21:22 +00:00
|
|
|
class Ballerina < Formula
|
|
|
|
desc "The flexible, powerful and beautiful programming language"
|
2018-06-09 13:39:27 +00:00
|
|
|
homepage "https://ballerina.io/"
|
2018-08-10 21:19:59 +00:00
|
|
|
url "https://product-dist.ballerina.io/downloads/0.981.0/ballerina-platform-0.981.0.zip"
|
|
|
|
sha256 "0f9bc7c5e2061b36faee0afff2926592642015af61b4266e6bbec6935652e0c3"
|
2018-01-30 17:21:22 +00:00
|
|
|
|
|
|
|
bottle :unneeded
|
|
|
|
|
2018-06-09 13:39:27 +00:00
|
|
|
depends_on :java => "1.8"
|
2018-01-30 17:21:22 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2018-06-09 13:39:27 +00:00
|
|
|
bin.install "bin/ballerina", "bin/composer"
|
2018-01-30 17:21:22 +00:00
|
|
|
libexec.install Dir["*"]
|
2018-07-25 06:27:42 +00:00
|
|
|
lib.install_symlink libexec/"lib/resources"
|
2018-06-09 13:39:27 +00:00
|
|
|
bin.env_script_all_files(libexec/"bin", Language::Java.java_home_env("1.8"))
|
2018-01-30 17:21:22 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"helloWorld.bal").write <<~EOS
|
2018-06-09 13:39:27 +00:00
|
|
|
import ballerina/io;
|
|
|
|
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
|