Created
July 13, 2014 09:55
-
-
Save allex/cb0c8000aca295926ffa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ================================================ | |
# Description: Deploy current project happy | |
# GistID: cb0c8000aca295926ffa | |
# GistURL: https://gist.github.com/allex/cb0c8000aca295926ffa | |
# Last Modified: Tue Aug 05, 2014 11:39AM | |
# Author: Allex Wang ([email protected]) | |
# ================================================ | |
CUR_DIR=$PWD | |
arg1=$1 | |
ARGS=("${@}") | |
ARGS[${#ARGS[@]}]="-Dlog4j_level=debug" | |
ARGS[${#ARGS[@]}]="-Drose_log4j_level=debug" | |
# cleanup maven build folders with named `target` | |
if [ "${arg1}" = "clean" ]; then | |
for f in `find -L $CUR_DIR -type d -name target`; do echo $f; if [ -f `dirname $f`/pom.xml ]; then rm -rf $f; fi; done | |
exit 0; | |
fi | |
TARGET=$arg1 | |
if [ "${TARGET}x" != "x" ] && [ -d $CUR_DIR/$TARGET ]; then | |
ARGS=(${ARGS[@]:1}) | |
cd $CUR_DIR/$TARGET | |
if [ -f "$CUR_DIR/$TARGET/release.sh" ]; then | |
sh ./release.sh "${ARGS[@]}" | |
rm -rf ./target | |
else | |
mvn clean install "${ARGS[@]}" | |
rm -rf ./target | |
fi | |
cd - >/dev/null 2>&1 | |
exit 0; | |
fi | |
PROJ_DIR=`CP=${CUR_DIR}; while [ -n "$CP" ] ; do if [ -f "$CP/release.sh" ] || [ -f "$CP/pom.xml" ]; then echo $CP; break; fi; CP=${CP%/*}; done;` | |
if [ -n "$PROJ_DIR" ]; then | |
echo "Building ${PROJ_DIR} ..." | |
cd "$PROJ_DIR" | |
if [ -f "$PROJ_DIR/release.sh" ]; then | |
sh ./release.sh "${ARGS[@]}" | |
rm -rf ./target | |
else | |
if [ -f "$PROJ_DIR/pom.xml" ]; then | |
mvn clean install "${ARGS[@]}" | |
rm -rf ./target | |
fi | |
fi | |
cd "$CUR_DIR" | |
fi | |
exit 0; | |
# find -name "*.thrift" -exec thrift --gen java:beans {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment