Skip to content

Instantly share code, notes, and snippets.

@justinfx
Created June 27, 2013 10:43
Show Gist options
  • Save justinfx/5875551 to your computer and use it in GitHub Desktop.
Save justinfx/5875551 to your computer and use it in GitHub Desktop.
A helper shell script to completely rebuild Plow server / client, along with dropping the Postgres plow schema, and building it again. Run with the path to the root of the plow source location as the first argument. Adjust the psql host/port to suit
#!/bin/bash
if [ -z $1 ] || [ ! -d ${1}/server ]; then
echo "plow_rebuild.sh <path to plow source>"
exit 1
fi
realpath1() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
PLOW=`realpath1 "$1"`
echo ============================================
echo Regenerating thrift bindings
cd ${PLOW}/lib/thrift && \
./generate-sources.sh
echo
echo ============================================
echo Building java client
cd ${PLOW}/lib/java && \
mvn install
echo
echo ============================================
echo Building java server
cd ${PLOW}/server && \
mvn package && \
ln -f -s ${PLOW}/server/target/plow.war ${PLOW}/server/dist/webapps/plow.war
echo
echo ============================================
echo Dropping and adding the Plow Postgres schema
# You may need to adjust the username or port if its different for you
cd ${PLOW}/server && \
psql --host localhost --port 5432 --username plow --dbname plow -c "drop schema plow cascade;" && \
psql --host localhost --port 5432 --username plow --dbname plow -f ${PLOW}/server/ddl/plow-schema.sql
echo
echo ============================================
echo Building python client
export CC=gcc
export CXX=gcc
export PKG_CONFIG_PATH=/usr/local/lib/pkg-config:$PKG_CONFIG_PATH
export ARCHFLAGS="-arch x86_64"
cd ${PLOW}/lib/python && \
python setup.py develop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment