Skip to content

Instantly share code, notes, and snippets.

@JoshRosen
Last active Apr 24, 2016
Embed
What would you like to do?
Homebrew formula for installing Scala 2.9.3
require 'formula'
class ScalaDocs < Formula
homepage 'http://www.scala-lang.org/'
url 'http://www.scala-lang.org/downloads/distrib/files/scala-docs-2.9.3.zip'
sha1 '633a31ca2eb87ce5b31b4f963bdfd1d4157282ad'
end
class ScalaCompletion < Formula
homepage 'http://www.scala-lang.org/'
url 'https://raw.github.com/scala/scala-dist/27bc0c25145a8/completion.d/2.9.1/scala'
version '2.9.1'
sha1 'e2fd99fe31a9fb687a2deaf049265c605692c997'
end
class Scala < Formula
homepage 'http://www.scala-lang.org/'
url 'http://www.scala-lang.org/downloads/distrib/files/scala-2.9.3.tgz'
sha1 '01bf9e2c854e2385b2bcef319840415867a00388'
def options
[['--with-docs', 'Also install library documentation']]
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/*"]
ScalaCompletion.new.brew { (prefix+'etc/bash_completion.d').install 'scala' }
ScalaDocs.new.brew { doc.install Dir['*'] } if ARGV.include? '--with-docs'
end
def caveats; <<-EOS.undent
Bash completion has been installed to:
#{etc}/bash_completion.d
EOS
end
end
@JoshRosen
Copy link
Author

JoshRosen commented Aug 11, 2013

To install:

brew install https://gist.github.com/JoshRosen/5989131/raw/63ede7527a4bc2fa7d34cdd10676a06389ce31d5/scala.rb

@yluppo
Copy link

yluppo commented Oct 8, 2013

brew install https://gist.github.com/JoshRosen/5989131/raw/63ede7527a4bc2fa7d34cdd10676a06389ce31d5/scala.rb >>>

######################################################################## 100.0%
==> Downloading http://www.scala-lang.org/downloads/distrib/files/scala-2.9.3.tgz
                                                                           0.0%
curl: (22) The requested URL returned error: 404
Error: Download failed: http://www.scala-lang.org/downloads/distrib/files/scala-2.9.3.tgz

Scala moved the 2.9.3 link to http://www.scala-lang.org/files/archive/scala-2.9.3.tgz

@yluppo
Copy link

yluppo commented Oct 8, 2013

The following edits to your script did the trick for me. Thanks for your help btw.

require 'formula'

class ScalaDocs < Formula
  homepage 'http://www.scala-lang.org/'
  url 'http://www.scala-lang.org/files/archive/scala-docs-2.9.3.zip'
  sha1 '5bf44bd04b2b37976bde5d4a4c9bb6bcdeb10eb2'
end

class ScalaCompletion < Formula
  homepage 'http://www.scala-lang.org/'
  url 'https://raw.github.com/scala/scala-dist/27bc0c25145a8/completion.d/2.9.1/scala'
  version '2.9.1'
  sha1 'e2fd99fe31a9fb687a2deaf049265c605692c997'
end

class Scala < Formula
  homepage 'http://www.scala-lang.org/'
  url 'http://www.scala-lang.org/files/archive/scala-2.9.3.tgz'
  sha1 '01bf9e2c854e2385b2bcef319840415867a00388'

  def options
    [['--with-docs', 'Also install library documentation']]
  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/*"]
    ScalaCompletion.new.brew { (prefix+'etc/bash_completion.d').install 'scala' }
    ScalaDocs.new.brew { doc.install Dir['*'] } if ARGV.include? '--with-docs'
  end

  def caveats; <<-EOS.undent
    Bash completion has been installed to:
      #{etc}/bash_completion.d
    EOS
  end
end

@berkeleymalagon
Copy link

berkeleymalagon commented Dec 22, 2013

Thanks for fix update, yluppo

@mangelino
Copy link

mangelino commented Jan 24, 2014

Can you please update the script as in the above post? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment