-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscala.rb
34 lines (31 loc) · 1.25 KB
/
scala.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# typed: false
# frozen_string_literal: true
# Experimental Scala Formula
class Scala < Formula
desc "Experimental launcher for Scala"
homepage "https://virtuslab.github.io/scala-cli/"
url (RUBY_PLATFORM.include? "arm64") ?
"https://github.com/Virtuslab/scala-cli/releases/download/v1.6.2/scala-cli-aarch64-apple-darwin.gz" :
"https://github.com/Virtuslab/scala-cli/releases/download/v1.6.2/scala-cli-x86_64-apple-darwin.gz"
version "1.6.2"
sha256 (RUBY_PLATFORM.include? "arm64") ?
"b11ffc2936f31eaf13217f399b73d567989fcdeb701b34bfde21122166be2c0d" :
"08ca53e5ef57655f20771dd343a9b011e5c7a4a4176072c0b28ca27934413df9"
license "Apache-2.0"
def install
if (RUBY_PLATFORM.include? "arm64")
bin.install "scala-cli-aarch64-apple-darwin" => "scala-cli"
else
bin.install "scala-cli-x86_64-apple-darwin" => "scala-cli"
end
bin.install_symlink "scala-cli" => "scala"
end
test do
(testpath / "Hello.scala").write "object Hello {
def main(args: Array[String]): Unit =
println(\"Hello from Scala\")
}"
output = shell_output("#{bin}/scala-cli Hello.scala")
assert_equal ["Hello from Scala\n"], output.lines
end
end