forked from lampepfl/homebrew-brew
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdotty.rb
44 lines (37 loc) · 1.14 KB
/
dotty.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
35
36
37
38
39
40
41
42
43
44
class Dotty < Formula
desc "Experimental Scala Compiler"
homepage "http://dotty.epfl.ch/"
url "https://github.com/lampepfl/dotty/releases/download/3.1.0/scala3-3.1.0.tar.gz"
sha256 "f5bb19d85b486fa02f0375b7af656fd1d3cd89cb988cc073dd7e3ccf8e40beff"
# mirror "https://www.scala-lang.org/files/archive/scala-2.12.2.tgz"
bottle :unneeded
depends_on "openjdk@8"
def install
rm_f Dir["bin/*.bat"]
prefix.install "bin", "lib"
end
test do
# test scalac and scala:
file = testpath/"Test.scala"
file.write <<~EOS
object Test {
def main(args: Array[String]) = {
println(s"${2 + 2}")
}
}
EOS
shell_output("#{bin}/scalac #{file}")
out = shell_output("#{bin}/scala Test").strip
assert_equal "4", out
# test scalad:
Dir.mkdir "#{testpath}/site"
index_out = testpath/"site"/"index.md"
index_out.write <<~EOS
Hello, world!
=============
EOS
shell_output("#{bin}/scalad -siteroot #{testpath}/site -project Hello #{file}")
index_file = File.open("#{testpath}/site/_site/index.html", "rb").read
assert index_file.include? 'Hello, world!'
end
end