Skip to content

Instantly share code, notes, and snippets.

@starenka
Created November 6, 2011 17:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save starenka/1343207 to your computer and use it in GitHub Desktop.
Save starenka/1343207 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
PROJECTS_DIR="/www/outcomm/"
REPOS="ssh://chrootuser@esrv1.komunikacniagentura.cz//home/chrootuser/repos/"
VENVWRAPPER_SCRIPT="$(which virtualenvwrapper.sh)"
if [ -z "$1" ]; then echo "I need a repo name to setup the project, smeghead! (you can also specify alias as a second arg)"; exit 1; fi
if [ -z "$2" ]; then AS="$1"; else AS="$2"; fi
. $VENVWRAPPER_SCRIPT
TAR=$PROJECTS_DIR$AS
SP_DIR=$WORKON_HOME/$AS$(virtualenvwrapper_get_site_packages_dir)
RESET='\e[0m'
FAIL='\e[1;31m' # Red
OK='\e[1;32m' # Green
INFO='\e[1;33m' # Yellow
function nfo() {
echo -e "\n$2${INFO}[-] $1$RESET"
}
function ok() {
echo -e "\n\n$2${OK}[-] $1$RESET"
}
nfo "cloning repo $REPOS$1 to $TAR"
hg clone $REPOS$1 "$TAR"
nfo "making env at $WORKON_HOME/$AS"
mkvirtualenv "$AS"
cd "$TAR"
nfo "installing requirements"
pip install -r requirements.pip
nfo "installing test requirements"
pip install -r requirements_test.pip
for lib in "dol" "otherlibs"; do
nfo "cloning _outcomm_ library '$lib' to $WORKON_HOME/$AS/LIBS/$lib"
hg clone ${REPOS}LIBS/$lib $WORKON_HOME/$AS/LIBS/$lib
echo "export PYTHONPATH=\"$WORKON_HOME/$AS/LIBS/$lib:\$PYTHONPATH\"" >> $WORKON_HOME/$AS/bin/postactivate
#nfo "symlinking lib contents:" "\t"
#for f in $(ls -d $WORKON_HOME/$AS/LIBS/$lib/*); do echo -e "\t - $f"; ln -s $f $SP_DIR; done
done
nfo "cloning _outcomm_ staticlib to $WORKON_HOME/$AS/LIBS/staticlib"
hg clone ${REPOS}LIBS/staticlib $WORKON_HOME/$AS/LIBS/staticlib
ok "bye :p"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment