Module: Buildr::Scala

Defined in:
lib/buildr/scala/bdd.rb,
lib/buildr/scala/shell.rb,
lib/buildr/scala/tests.rb,
lib/buildr/scala/compiler.rb

Defined Under Namespace

Modules: Check Classes: ScalaShell, ScalaTest, Scalac, Specs

Constant Summary collapse

DEFAULT_VERSION =

currently the latest (Oct 31, 2009)

'2.7.7'

Class Method Summary collapse

Class Method Details

.versionObject



38
39
40
41
42
43
44
45
46
47
# File 'lib/buildr/scala/compiler.rb', line 38

def version
  if version_str
    # any consecutive sequence of numbers followed by dots
    match = version_str.match(/\d+\.\d[\d\.]*/) or
      fail "Unable to parse Scala version: #{version_str} "
    match[0].sub(/.$/, "") # remove trailing dot, if any
  else
    DEFAULT_VERSION       # TODO return the version installed from Maven repo
  end
end

.version_strObject

Retrieves the Scala version string from the standard library or nil if Scala is not available.



29
30
31
32
33
34
35
36
# File 'lib/buildr/scala/compiler.rb', line 29

def version_str
  begin
    # Scala version string normally looks like "version 2.7.3.final"
    Java.scala.util.Properties.versionString.sub 'version ', ''
  rescue
    nil
  end
end