2009-10-15 08:07:12 +00:00
|
|
|
require 'formula'
|
2009-09-04 01:26:09 +00:00
|
|
|
|
2011-03-10 05:11:03 +00:00
|
|
|
class Scala < Formula
|
2010-07-14 16:52:07 +00:00
|
|
|
homepage 'http://www.scala-lang.org/'
|
2014-07-24 10:48:17 +00:00
|
|
|
url 'http://www.scala-lang.org/files/archive/scala-2.11.2.tgz'
|
|
|
|
sha1 '904e9ee3bb96e8350b1e0f2502a704f836c0cdf1'
|
2013-05-23 22:06:58 +00:00
|
|
|
|
2014-07-24 11:17:00 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
|
|
|
sha1 "da4919e3f11b1d10923e12c20ba50f738db58380" => :mavericks
|
|
|
|
sha1 "15ecc67ac62795c1ae7a9fae01838bea412df6ec" => :mountain_lion
|
|
|
|
sha1 "10784c54d59746277a6f0535ef9d3ff4974fad56" => :lion
|
|
|
|
end
|
|
|
|
|
2012-08-27 05:05:48 +00:00
|
|
|
option 'with-docs', 'Also install library documentation'
|
2014-04-28 22:45:02 +00:00
|
|
|
option 'with-src', 'Also install sources for IDE support'
|
2010-12-31 03:53:13 +00:00
|
|
|
|
2013-09-18 02:25:42 +00:00
|
|
|
resource 'docs' do
|
2014-07-24 10:48:17 +00:00
|
|
|
url 'http://www.scala-lang.org/files/archive/scala-docs-2.11.2.zip'
|
|
|
|
sha1 '2add2130989c3434b8f6ef30f05ed3dd98ab156a'
|
2013-09-18 02:25:42 +00:00
|
|
|
end
|
|
|
|
|
2014-04-28 22:45:02 +00:00
|
|
|
resource 'src' do
|
2014-07-24 10:48:17 +00:00
|
|
|
url 'https://github.com/scala/scala/archive/v2.11.2.tar.gz'
|
|
|
|
sha1 '52654124565a1706e9e6d0ad7b0969d319628847'
|
2014-04-28 22:45:02 +00:00
|
|
|
end
|
|
|
|
|
2013-08-07 05:38:12 +00:00
|
|
|
resource 'completion' do
|
2014-07-24 10:48:17 +00:00
|
|
|
url 'https://raw.githubusercontent.com/scala/scala-dist/v2.11.2/bash-completion/src/main/resources/completion.d/2.9.1/scala'
|
2013-08-07 05:38:12 +00:00
|
|
|
sha1 'e2fd99fe31a9fb687a2deaf049265c605692c997'
|
|
|
|
end
|
|
|
|
|
2009-09-04 01:26:09 +00:00
|
|
|
def install
|
2010-04-07 05:58:35 +00:00
|
|
|
rm_f Dir["bin/*.bat"]
|
2010-08-08 15:49:45 +00:00
|
|
|
doc.install Dir['doc/*']
|
2014-05-22 15:12:03 +00:00
|
|
|
share.install "man"
|
|
|
|
libexec.install "bin", "lib"
|
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')
|
2014-04-28 22:45:02 +00:00
|
|
|
doc.install resource('docs') if build.with? 'docs'
|
|
|
|
libexec.install resource('src').files('src') if build.with? 'src'
|
2013-07-28 22:35:05 +00:00
|
|
|
|
2013-08-07 05:38:32 +00:00
|
|
|
# Set up an IntelliJ compatible symlink farm in 'idea'
|
2013-07-28 22:35:05 +00:00
|
|
|
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:
|
2013-08-07 07:06:29 +00:00
|
|
|
#{opt_prefix}/idea
|
2013-07-28 22:35:05 +00:00
|
|
|
EOS
|
2012-03-11 16:44:26 +00:00
|
|
|
end
|
2014-03-06 02:56:24 +00:00
|
|
|
|
|
|
|
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
|
2009-09-04 01:26:09 +00:00
|
|
|
end
|