Skip to content

Instantly share code, notes, and snippets.

@vigorouscoding
Created August 20, 2016 19:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vigorouscoding/ee1a36e5af7ecd3e55dd442cbce80de2 to your computer and use it in GitHub Desktop.
Save vigorouscoding/ee1a36e5af7ecd3e55dd442cbce80de2 to your computer and use it in GitHub Desktop.
structr helpers for bash_profile
backup_structr() {
[ ! -d files ] || [ ! -d db ] && echo "db and files must be present. not in structr-ui folder?" && return 1
local OPT=""
[ ! -z $1 ] && OPT="-"$1 && OPT=${OPT//[^a-zA-Z0-9-_]/}
local BAKFILE=db-files-$(date +%Y%m%d-%H%M%S)$OPT.tar.bz2
echo "backing up to "$BAKFILE
tar cvfj $BAKFILE db files
}
cdstructr() {
cd ~/Documents/structr/structr-ui
}
structr() {
COMPILE="mvn clean install -DskipTests -Dmaven.test.skip=true -Dmaven.javadoc.skip=true -Dgpg.skip=true -DskipDeb=true -Dassembly.skipAssembly=true"
CURDIR=`basename $(pwd)`
RESULT=0
if [ "$CURDIR" = "structr-ui" ]
then
cd ..;
$COMPILE;
RESULT=$?;
cd structr-ui;
if [ $RESULT -eq 0 ]
then
./copy-modules.sh
./run_debug.sh;
else
echo "Compilation failed - please see the above error messages!";
fi
else
if [ "$CURDIR" = "structr" ]
then
$COMPILE;
RESULT=$?;
cd structr-ui;
if [ "$RESULT" -eq 0 ]
then
./copy-modules.sh
./run_debug.sh;
else
echo "Compilation failed - please see the above error messages!";
fi
else
echo "Not in a structr directory."
fi
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment