Skip to content

Instantly share code, notes, and snippets.

@bverbeken
Created January 14, 2012 14:55
Show Gist options
  • Save bverbeken/1611715 to your computer and use it in GitHub Desktop.
Save bverbeken/1611715 to your computer and use it in GitHub Desktop.
script to easily switch between Playframework versions
#!/bin/bash
BASE_PATH="$HOME/Development/tools/playframework"
changePath () {
path_remove $1;
export PATH="$1:$PATH";
}
path_remove () {
export PATH=`echo -n $PATH | awk -v RS=: -v ORS=: '$0 != "'$1'"' | sed 's/:$//'`;
}
usage() {
echo 'Use this script to quickly switch between Play!Framework versions.'
echo 'Usage: usePlay version'
echo 'Possible versions are:'
echo ' 1 - 1.2.4 (latest stable)'
echo ' 2 - 2.0-beta'
echo ' 2s - latest from github (this script does not update!)'
}
if [[ $# != 1 ]]
then
echo 'Error: please specify the version you wich to use'
echo ' '
usage
else
case $1 in
"1") export PLAY_HOME="$BASE_PATH/play-1.2.4"; version="1.2.4" ;;
"2") export PLAY_HOME="$BASE_PATH/play-2.0-beta"; version="2.0-beta" ;;
"2s") export PLAY_HOME="$BASE_PATH/sources/Play20"; version="2.0 (latest from gitHub)" ;;
esac
if [[ $version ]]
then
changePath $PLAY_HOME
echo "Ok. Using Play! $version now"
else
echo 'Warning: unsupported version: ' $1
echo
usage
fi
fi
@bverbeken
Copy link
Author

While this works (kind of), there's the Play Version Manager, i'm using that instead https://github.com/kaiinkinen/pvm

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