def installed_version
unless @installed_version
@installed_version = if Scalac.installed?
begin
props = Zip::ZipFile.open(File.expand_path('lib/scala-library.jar', Scalac.scala_home)) do |zipfile|
zipfile.read 'library.properties'
end
version_str = props.match(/version\.number\s*=\s*([^\s]+)/).to_a[1]
if version_str
md = version_str.match(/\d+\.\d[\d\.]*/) or
fail "Unable to parse Scala version: #{version_str}"
md[0].sub(/.$/, "")
end
rescue => e
warn "Unable to parse library.properties in $SCALA_HOME/lib/scala-library.jar: #{e}"
nil
end
end
end
@installed_version
end