homebrew-core/Formula/scala.rb
2018-12-06 08:33:59 -05:00

46 lines
1.2 KiB
Ruby

class Scala < Formula
desc "JVM-based programming language"
homepage "https://www.scala-lang.org/"
url "https://downloads.lightbend.com/scala/2.12.8/scala-2.12.8.tgz"
mirror "https://www.scala-lang.org/files/archive/scala-2.12.8.tgz"
mirror "https://downloads.typesafe.com/scala/2.12.8/scala-2.12.8.tgz"
sha256 "440ea00c818fd88c5261dd85889711a9d1f7e6a39caa475fcf0583ab57db80a3"
bottle :unneeded
depends_on :java => "1.8+"
def install
rm_f Dir["bin/*.bat"]
doc.install Dir["doc/*"]
share.install "man"
libexec.install "bin", "lib"
bin.install_symlink Dir["#{libexec}/bin/*"]
# Set up an IntelliJ compatible symlink farm in 'idea'
idea = prefix/"idea"
idea.install_symlink libexec/"src", libexec/"lib"
idea.install_symlink doc => "doc"
end
def caveats; <<~EOS
To use with IntelliJ, set the Scala home to:
#{opt_prefix}/idea
EOS
end
test do
file = testpath/"Test.scala"
file.write <<~EOS
object Test {
def main(args: Array[String]) {
println(s"${2 + 2}")
}
}
EOS
out = shell_output("#{bin}/scala -nc #{file}").strip
assert_equal "4", out
end
end