homebrew-core/Formula/scala.rb

72 lines
1.9 KiB
Ruby
Raw Normal View History

require 'formula'
2011-03-10 05:11:03 +00:00
class Scala < Formula
homepage 'http://www.scala-lang.org/'
url 'http://www.scala-lang.org/files/archive/scala-2.10.4.tgz'
sha1 '970f779f155719838e81a267a7418a958fd4c13f'
devel do
url 'http://downloads.typesafe.com/scala/2.11.0-RC3/scala-2.11.0-RC3.tgz'
sha1 'cd1b8fb5b6896c9e3b9f2c6b3eb52556fd25bd3a'
version '2.11.0-RC3'
2013-09-18 02:25:42 +00:00
resource 'docs' do
url 'http://downloads.typesafe.com/scala/2.11.0-RC3/scala-docs-2.11.0-RC3.zip'
sha1 '34b2dfb77c2fadd276aaaae2be74c52711079ddf'
version '2.11.0-RC3'
2013-09-18 02:25:42 +00:00
end
end
2012-08-27 05:05:48 +00:00
option 'with-docs', 'Also install library documentation'
2013-09-18 02:25:42 +00:00
resource 'docs' do
url 'http://www.scala-lang.org/files/archive/scala-docs-2.10.4.zip'
sha1 '7ad47f9634fd2f452cadf35f7241102207c1a1cc'
2013-09-18 02:25:42 +00:00
end
2013-08-07 05:38:12 +00:00
resource 'completion' do
url 'https://raw.github.com/scala/scala-dist/27bc0c25145a83691e3678c7dda602e765e13413/completion.d/2.9.1/scala'
sha1 'e2fd99fe31a9fb687a2deaf049265c605692c997'
end
def install
rm_f Dir["bin/*.bat"]
doc.install Dir['doc/*']
man1.install Dir['man/man1/*']
libexec.install Dir['*']
2012-02-12 19:16:05 +00:00
bin.install_symlink Dir["#{libexec}/bin/*"]
2013-08-07 05:38:12 +00:00
bash_completion.install resource('completion')
2013-09-18 02:25:42 +00:00
if build.with? 'docs'
branch = build.stable? ? 'scala-2.10' : 'scala-2.11'
2013-09-18 02:25:42 +00:00
(share/'doc'/branch).install resource('docs')
end
2013-08-07 05:38:32 +00:00
# Set up an IntelliJ compatible symlink farm in 'idea'
idea = prefix/'idea'
idea.install_symlink libexec/'src', libexec/'lib'
(idea/'doc/scala-devel-docs').install_symlink doc => 'api'
end
def caveats; <<-EOS.undent
To use with IntelliJ, set the Scala home to:
#{opt_prefix}/idea
EOS
end
test do
file = testpath/'hello.scala'
file.write <<-EOS.undent
object Computer {
def main(args: Array[String]) {
println(2 + 2)
}
}
EOS
output = `'#{bin}/scala' #{file}`
assert_equal "4", output.strip
assert $?.success?
end
end