-
-
Notifications
You must be signed in to change notification settings - Fork 12.6k
60 lines (49 loc) · 1.62 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
class ScalaAT212 < Formula
desc "JVM-based programming language"
homepage "https://www.scala-lang.org/"
url "https://downloads.lightbend.com/scala/2.12.19/scala-2.12.19.tgz"
mirror "https://www.scala-lang.org/files/archive/scala-2.12.19.tgz"
mirror "https://downloads.typesafe.com/scala/2.12.19/scala-2.12.19.tgz"
sha256 "d1876659c9298b6664f91aa7ef4b2c5baca6356ff47a9a598070045058968fb2"
license "Apache-2.0"
livecheck do
url "https://www.scala-lang.org/files/archive/"
regex(/href=.*?scala[._-]v?(2\.12(?:\.\d+)+)(?:[._-]final)?\.t/i)
end
bottle do
sha256 cellar: :any_skip_relocation, all: "abbae8ff17e1068a9a53d595801dc8e34dcbca87c912b871ede0fb6577f19745"
end
keg_only :versioned_formula
depends_on "openjdk"
def install
inreplace Dir["man/man1/scala{,c}.1"], "/usr/local", HOMEBREW_PREFIX
rm_f Dir["bin/*.bat"]
doc.install Dir["doc/*"]
share.install "man"
libexec.install "bin", "lib"
bin.install Dir["#{libexec}/bin/*"]
bin.env_script_all_files libexec/"bin", Language::Java.overridable_java_home_env
# 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