ohmyzsh/custom/totvs.zsh

125 lines
2.5 KiB
Bash
Raw Normal View History

2012-11-21 17:29:09 +00:00
#
# Just some utilities for use in ecm development.
#
setopt rmstarsilent
HOME="/home/carlos"
ECM_WS="$HOME/totvs/ws"
ECM_JBOSS="$HOME/Public/ecm/JBoss-7.1.1"
ECM_PORT="8080"
VOLDEMORT=$ECM_WS/voldemort
ECM=$ECM_WS/ecm
INSTALLER="n"
DRY_CLEAN="n"
2012-11-21 17:29:09 +00:00
# fuckin aliases
alias ecmu=ecmup
alias ecmb=ecmbuild
alias ecmc=ecmclean
alias ecms=ecmstart
alias ecmo=ecmstop
2012-11-21 18:01:28 +00:00
alias ecmi=ecminstall
alias ecmri=ecmruninstall
2012-11-21 18:01:28 +00:00
alias ecm=ecmfull
2012-11-22 16:20:53 +00:00
alias e='MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=512m -DskipTests=true" ecm'
2012-11-21 17:29:09 +00:00
# update ecm
ecmup() {
echo "update all the things!"
cd $VOLDEMORT && svn up
cd $ECM && svn up
}
# build it!
ecmbuild() {
2012-11-21 18:01:28 +00:00
echo "build? no problem sir..."
2012-11-22 11:20:31 +00:00
cd $VOLDEMORT && mvncie && \
cd $VOLDEMORT/social-ecm && \
cd $VOLDEMORT/wcm && mvncie && \
cd $ECM/wecmpackage && mvncie && \
cd $VOLDEMORT/ecm && mvncie && \
2012-11-21 18:01:28 +00:00
ecminstall
}
# gen installer or cp wars...
ecminstall() {
case $@ in
-*i*)
INSTALLER=y
;;
esac
if [[ "$INSTALLER" == "y" ]]; then
echo "generating installer..."
cd $VOLDEMORT/ecm/installer
mvnci -am -Drun=installer -DLinux64=true -DappServer=jboss
else
2012-11-21 18:20:43 +00:00
echo "cpying wars..."
cd $VOLDEMORT/ecm/build && mvnci && \
2012-11-22 11:20:31 +00:00
cd $VOLDEMORT/wcm/build && mvnci && \
cd $VOLDEMORT/social-ecm/build && mvnci
fi
2012-11-21 17:29:09 +00:00
}
# clean jboss trash folders
ecmclean() {
echo "cleaning jboss shit"
case $@ in
-*d*)
DRY_CLEAN="y"
;;
esac
if [[ "$DRY_CLEAN" == "y" ]]; then
rm -rf $ECM_JBOSS/standalone/deployments/*.{failed,deployed,dodeploy,deploying}
else
rm -rf $ECM_JBOSS/standalone/deployments/*
fi
rm -rf $ECM_JBOSS/standalone/{log,tmp,data}
rm -rf $ECM_JBOSS/solr/zoo_data
2012-11-21 17:29:09 +00:00
}
# start jboss server
ecmstart() {
2012-11-21 18:01:28 +00:00
# why shall I start server if i just gen a installer?
if [[ "$INSTALLER" == "y" ]]; then
ecmruninstall
else
2012-11-21 18:01:28 +00:00
echo "starting jboss"
2012-11-21 18:35:31 +00:00
cd $ECM_JBOSS/bin
JAVA_OPTS="-Xmx2048m -XX:MaxPermSize=512m -DzkRun -Dbootstrap_conf=true" ./standalone.sh
2012-11-21 18:01:28 +00:00
fi
2012-11-21 17:29:09 +00:00
}
ecmruninstall() {
echo "ok, lets install this crap :)"
cd $VOLDEMORT/ecm/installer/izpack/target
if [[ -f ECM-Linux64.zip ]]; then
mkdir -p /tmp/ecmi
rm -rf /tmp/ecmi/*
unzip ECM-Linux64 -d /tmp/ecmi/
cd /tmp/ecmi/
chmod a+x ECM-Installer-64.sh
./ECM-Installer-64.sh
else
echo "uhoh, installer doesnt exist ($VOLDEMORT/ecm/installer/izpack/target/ECM-Linux64.zip)"
fi
}
2012-11-21 17:29:09 +00:00
# stop jboss (usually on 8080)
ecmstop() {
echo "kill jboss (or whatever you are running on 8080"
fuser -k $ECM_PORT/tcp
}
# do all the things
2012-11-21 18:01:28 +00:00
ecmfull() {
2012-11-21 17:29:09 +00:00
echo "serious business here. let's have a coffee.."
ecmstop
ecmclean
2012-11-21 17:35:28 +00:00
ecmup
ecmbuild && ecmstart
2012-11-21 17:29:09 +00:00
}