Skip to content

Instantly share code, notes, and snippets.

@IanConnolly
Last active February 3, 2017 18:24
Show Gist options
  • Save IanConnolly/b72ff3641e7ecdb0345b0df5d8436e8f to your computer and use it in GitHub Desktop.
Save IanConnolly/b72ff3641e7ecdb0345b0df5d8436e8f to your computer and use it in GitHub Desktop.
require 'formula'
class Scala210 < Formula
homepage 'http://www.scala-lang.org/'
url 'http://www.scala-lang.org/files/archive/scala-2.10.5.tgz'
sha256 '918daf7de186305ff3c47bd0e6b03e74d6648c5239c050687b57b8fac2f87eb2'
keg_only 'Conflicts with scala in main repository.'
option 'with-docs', 'Also install library documentation'
resource 'docs' do
url 'http://www.scala-lang.org/files/archive/scala-docs-2.10.5.zip'
sha256 '0c104c185de295d35a44e0d0b8e743ff49e4b87c'
end
resource 'completion' do
url 'https://raw.github.com/scala/scala-dist/27bc0c25145a83691e3678c7dda602e765e13413/completion.d/2.9.1/scala'
sha256 '95aeba51165ce2c0e36e9bf006f2904a90031470ab8d10b456e7611413d7d3fd'
end
def install
rm_f Dir["bin/*.bat"]
doc.install Dir['doc/*']
man1.install Dir['man/man1/*']
libexec.install Dir['*']
bin.install_symlink Dir["#{libexec}/bin/*"]
bash_completion.install resource('completion')
doc.install resource('docs') if build.with? 'docs'
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment