Scala

From GeilThings

Jump to: navigation, search
Scala
General
Version 2.10.2
Stable 2.10.2
Function Programming Language
Package Manager sbaz (Scala Bazaar System)
Scripts


Contents


General

Installing Scala

DATE=`date +%Y-%m-%d`
APPNAME=scala
RAWOLDVERSION=`scala -version`
# TODO. This is miserable, e.g. it did not work for 1.9.1-1.
OLDVERSION=${RAWOLDVERSION:25:6}
echo ${OLDVERSION}
RAWNEWVERSION=`curl -sd "action=ask&query=[[Scala]]|%3FStable&format=json" http://www.geilthings.com/api.php` 
# Get Version as Substring.  
# Using grep to sed to extract STRING between first occurrence of MATCH1 and next occurrence of MATCH2:  
# http://stackoverflow.com/questions/4392106/sed-extract-string-between-first-occurrence-of-match1-and-next-occurrence-of-m  
NEWVERSION=`echo "$RAWNEWVERSION" | grep -Po '^.*?\K(?<=Stable\":\[\").*?(?=\")'`  
echo $NEWVERSION
echo ${APPNAME}: ${NEWVERSION}
 
cd /opt
wget http://www.scala-lang.org/downloads/distrib/files/scala-${NEWVERSION}.tgz
 
tar -zxvf scala-${NEWVERSION}.tgz
 
# Rename directory so future scala upgrades are easier.
mv "/opt/scala" "old_scala_${OLDVERSION}"
mv scala-${NEWVERSION} scala
 
# Modify the PATH environment variable;
# Add to /etc/profile and to to .bash_profile from the user.
PATH=$PATH:/opt/scala/bin
export PATH
 
# Check version.
scala -version
 
# TODO. Delete or remove the old version later.

Running

  • Compile a scala program:
scalac -classpath /opt/tomcat/lib/servlet-api.jar:/path/to/web/app/WEB-INF/lib/mysql-connector-java-5.1.19-bin.jar -d /path/to/compiled/web/app/jar/files/WEB-INF/classes /path/to/source/code/file/helloworld_mysql.scala

Upgrade Scala

See Installing Scala. 2.9.1-1 was installed from scratch, as well as 2.9.2. It seems to be that ..."sbaz is deprecated and gone"...: http://groups.google.com/group/scala-language/msg/affcee5cff0dee32?pli=1

Re-install Scala.

Deprecated

Upgrading Scala

Valid for 2.9.0.1 to 2.9.1: using sbaz (See Scala Bazaar System).

# Update the list of available packages.
sbaz update
 
# Upgrade the whole scala installation.
sbaz upgrade

Programming


Web Frameworks

Versions

Software name Version number Version date
Scala 2.10.0
2.10.1
2.10.2
8 January 2013
13 March 2013
22 June 2013

Comments

blog comments powered by Disqus