homebrew-core/Formula/ammonite-repl.rb

35 lines
1.2 KiB
Ruby

class AmmoniteRepl < Formula
desc "Ammonite is a cleanroom re-implementation of the Scala REPL"
homepage "https://ammonite.io/"
# Prefer 2.13-x.xx versions, until significant regression in 3.0-x.xx is resolved
# See https://github.com/com-lihaoyi/Ammonite/issues/1190
url "https://github.com/com-lihaoyi/Ammonite/releases/download/2.5.4/2.13-2.5.4"
version "2.5.4"
sha256 "81c4a66ff85c5d05770e4ca59f498fc90ee7cc9df07a5504e4b3ca76444c69a0"
license "MIT"
bottle do
sha256 cellar: :any_skip_relocation, all: "ab1a9252e52a095340ca483c9987d6f7bb121c918eefaa974b1d47429e6f0072"
end
depends_on "openjdk"
def install
(libexec/"bin").install Dir["*"].first => "amm"
chmod 0755, libexec/"bin/amm"
(bin/"amm").write_env_script libexec/"bin/amm", Language::Java.overridable_java_home_env
end
# This test demonstrates the bug on 3.0-x.xx versions
# If/when it passes there, it should be safe to upgrade again
test do
(testpath/"testscript.sc").write <<~EOS
#!/usr/bin/env amm
@main
def fn(): Unit = println("hello world!")
EOS
output = shell_output("#{bin}/amm #{testpath}/testscript.sc")
assert_equal "hello world!", output.lines.last.chomp
end
end