Skip to content

Instantly share code, notes, and snippets.

@retronym
Created September 17, 2012 21:54
Show Gist options
  • Save retronym/3740024 to your computer and use it in GitHub Desktop.
Save retronym/3740024 to your computer and use it in GitHub Desktop.
scala-hash
#! /bin/bash
set -e
SCALA_DEV=~/code/scala
HASH=`git --git-dir $SCALA_DEV/.git rev-list "$1" | head -n1`
DESC=`git --git-dir $SCALA_DEV/.git describe $HASH`
shift
DIR=~/usr/scala-$DESC
SCALA=$DIR/pack/bin/scala
if [[ ! -f $SCALA ]]; then
URL=http://scala-webapps.epfl.ch/artifacts/$HASH/pack.tgz
echo Downloading $URL
mkdir -p $DIR
curl -f $URL | tar -x -z -C $DIR -f -
fi
$DIR/pack/bin/scala "$@"
~/code/scala scala-hash '2.10.x@{4 days ago}'
Downloading http://scala-webapps.epfl.ch/artifacts/ea651e6fe187920d207aa5fe3c645d294e72e627/pack.tgz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 24.0M 100 24.0M 0 0 731k 0 0:00:33 0:00:33 --:--:-- 831k
Welcome to Scala version 2.10.0-20120911-120015-ea651e6fe1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_27).
Type in expressions to have them evaluated.
Type :help for more information.
scala>
~/code/scala scala-hash '2.10.x@{4 days ago}'
Welcome to Scala version 2.10.0-20120911-120015-ea651e6fe1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_27).
Type in expressions to have them evaluated.
Type :help for more information.
~/code/scala scala-hash '2.10.x@{12 days ago}' -e 'println("foo")'
Downloading http://scala-webapps.epfl.ch/artifacts/adf2d3632b07eef4fc2303aef994e66584a73f49/pack.tgz
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 24.0M 100 24.0M 0 0 891k 0 0:00:27 0:00:27 --:--:-- 921k
foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment