Created by
Steven Berlan
| #!/bin/bash
# This hook is run after a new virtualenv is activated.
PYTHON_FILE=./requirements.txt
GULP_FILE=./gulpfile.js
BOWER_FILE=./bower.json
NPM_FILE=./package.json
if [ -z "$LIBRARY_PATH" ]; then
LIBRARY_PATH=/usr/local/lib:/usr/lib
fi
setvirtualenvproject
[ -x "./premkvirtualenv.py" ] && /usr/bin/env python "./premkvirtualenv.py"
[ -x "./premkvirtualenv.js" ] && /usr/bin/env node "./premkvirtualenv.js"
[ -x "./premkvirtualenv.sh" ] && bash "./premkvirtualenv.sh"
if [ -r "$PYTHON_FILE" ]; then
echo "*** Installing package requirements..."
pip install --upgrade -r "$PYTHON_FILE"
if [ $? -ne 0 ]; then
echo "Failed to install package requirements!"
return 1
fi
fi
if [ -r "$NPM_FILE" ] || [ -r "$BOWER_FILE" ] || [ -r "$GULP_FILE" ]; then
echo "*** Node dependencies found, creating node environment..."
pip install nodeenv &> /dev/null
nodeenv --prebuilt -p &> /dev/null
fi
if [ -r "$NPM_FILE" ]; then
echo "*** Installing node dependencies..."
npm install
if [ $? -ne 0 ]; then
echo "Failed to install node packages!"
return 1
fi
fi
if [ -r "$BOWER_FILE" ]; then
echo "*** Installing bower dependencies..."
if [ -x 'node_modules/.bin/bower' ]; then
node_modules/.bin/bower install
else
npm install -g bower
bower install
fi
if [ $? -ne 0 ]; then
echo "Failed to run bower!"
fi
fi
if [ -r "$GULP_FILE" ]; then
echo "*** Installing gulp dependencies..."
if [ -x 'node_modules/.bin/gulp' ]; then
node_modules/.bin/gulp
else
npm install -g gulp
gulp
fi
if [ $? -ne 0 ]; then
echo "Failed to run gulp!"
fi
fi
[ -x "./postmkvirtualenv.py" ] && /usr/bin/env python "./postmkvirtualenv.py"
[ -x "./postmkvirtualenv.js" ] && /usr/bin/env node "./postmkvirtualenv.js"
[ -x "./postmkvirtualenv.sh" ] && bash "./postmkvirtualenv.sh"
|