Browse Source

Merge pull request #1395 from caarlos0/master

added some maven love <3
Robby Russell 12 years ago
parent
commit
aaca1c2558
4 changed files with 182 additions and 4 deletions
  1. 0 1
      .gitignore
  2. 124 0
      custom/totvs.zsh
  3. 4 2
      plugins/debian/debian.plugin.zsh
  4. 54 1
      plugins/mvn/mvn.plugin.zsh

+ 0 - 1
.gitignore

@@ -1,7 +1,6 @@
 locals.zsh
 log/.zsh_history
 projects.zsh
-custom/*
 !custom/example
 !custom/example.zsh
 *.swp

+ 124 - 0
custom/totvs.zsh

@@ -0,0 +1,124 @@
+#
+# 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"
+
+# fuckin aliases
+alias ecmu=ecmup
+alias ecmb=ecmbuild
+alias ecmc=ecmclean
+alias ecms=ecmstart
+alias ecmo=ecmstop
+alias ecmi=ecminstall
+alias ecmri=ecmruninstall
+alias ecm=ecmfull
+alias e='MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=512m -DskipTests=true" ecm'  
+
+
+# update ecm
+ecmup() {
+	echo "update all the things!"
+	cd $VOLDEMORT && svn up
+	cd $ECM && svn up
+}
+
+# build it!
+ecmbuild() {
+	echo "build? no problem sir..."
+	cd $VOLDEMORT && mvncie && \
+	cd $VOLDEMORT/social-ecm && \
+	cd $VOLDEMORT/wcm && mvncie && \
+	cd $ECM/wecmpackage && mvncie && \
+	cd $VOLDEMORT/ecm && mvncie && \
+	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
+		echo "cpying wars..."
+    cd $VOLDEMORT/ecm/build && mvnci && \
+		cd $VOLDEMORT/wcm/build && mvnci && \
+    cd $VOLDEMORT/social-ecm/build && mvnci
+	fi
+}
+
+# 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
+}
+
+# start jboss server
+ecmstart() {
+	# why shall I start server if i just gen a installer?
+	if [[ "$INSTALLER" == "y" ]]; then
+		ecmruninstall
+	else
+		echo "starting jboss"
+		cd $ECM_JBOSS/bin
+		JAVA_OPTS="-Xmx2048m -XX:MaxPermSize=512m -DzkRun -Dbootstrap_conf=true" ./standalone.sh
+	fi
+}
+
+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
+}
+
+# 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
+ecmfull() {
+	echo "serious business here. let's have a coffee.."
+	ecmstop
+	ecmclean
+	ecmup
+	ecmbuild && ecmstart
+}
+
+

+ 4 - 2
plugins/debian/debian.plugin.zsh

@@ -61,7 +61,8 @@ if [[ $use_sudo -eq 1 ]]; then
     # Install all .deb files in the current directory.
     # Warning: you will need to put the glob in single quotes if you use:
     # glob_subst
-    alias di='sudo dpkg -i ./*.deb'
+    alias dia='sudo dpkg -i ./*.deb'
+    alias di='sudo dpkg -i'
 
     # Remove ALL kernel images and headers EXCEPT the one in use
     alias kclean='sudo aptitude remove -P ?and(~i~nlinux-(ima|hea) \
@@ -100,7 +101,8 @@ else
 
     # Install all .deb files in the current directory
     # Assumes glob_subst is off
-    alias di='su -lc "dpkg -i ./*.deb" root'
+    alias dia='su -lc "dpkg -i ./*.deb" root'
+    alias di='su -lc "dpkg -i" root'
 
     # Remove ALL kernel images and headers EXCEPT the one in use
     alias kclean='su -lc '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) \

+ 54 - 1
plugins/mvn/mvn.plugin.zsh

@@ -1,6 +1,59 @@
+# mvn-color based on https://gist.github.com/1027800
+export BOLD=`tput bold`
+export UNDERLINE_ON=`tput smul`
+export UNDERLINE_OFF=`tput rmul`
+export TEXT_BLACK=`tput setaf 0`
+export TEXT_RED=`tput setaf 1`
+export TEXT_GREEN=`tput setaf 2`
+export TEXT_YELLOW=`tput setaf 3`
+export TEXT_BLUE=`tput setaf 4`
+export TEXT_MAGENTA=`tput setaf 5`
+export TEXT_CYAN=`tput setaf 6`
+export TEXT_WHITE=`tput setaf 7`
+export BACKGROUND_BLACK=`tput setab 0`
+export BACKGROUND_RED=`tput setab 1`
+export BACKGROUND_GREEN=`tput setab 2`
+export BACKGROUND_YELLOW=`tput setab 3`
+export BACKGROUND_BLUE=`tput setab 4`
+export BACKGROUND_MAGENTA=`tput setab 5`
+export BACKGROUND_CYAN=`tput setab 6`
+export BACKGROUND_WHITE=`tput setab 7`
+export RESET_FORMATTING=`tput sgr0`
+
+ 
+# Wrapper function for Maven's mvn command.
+mvn-color()
+{
+  # Filter mvn output using sed
+  mvn $@ | sed -e "s/\(\[INFO\]\ \-.*\)/${TEXT_BLUE}${BOLD}\1/g" \
+               -e "s/\(\[INFO\]\ \[.*\)/${RESET_FORMATTING}${BOLD}\1${RESET_FORMATTING}/g" \
+               -e "s/\(\[INFO\]\ BUILD SUCCESSFUL\)/${BOLD}${TEXT_GREEN}\1${RESET_FORMATTING}/g" \
+               -e "s/\(\[WARNING\].*\)/${BOLD}${TEXT_YELLOW}\1${RESET_FORMATTING}/g" \
+               -e "s/\(\[ERROR\].*\)/${BOLD}${TEXT_RED}\1${RESET_FORMATTING}/g" \
+               -e "s/Tests run: \([^,]*\), Failures: \([^,]*\), Errors: \([^,]*\), Skipped: \([^,]*\)/${BOLD}${TEXT_GREEN}Tests run: \1${RESET_FORMATTING}, Failures: ${BOLD}${TEXT_RED}\2${RESET_FORMATTING}, Errors: ${BOLD}${TEXT_RED}\3${RESET_FORMATTING}, Skipped: ${BOLD}${TEXT_YELLOW}\4${RESET_FORMATTING}/g"
+ 
+  # Make sure formatting is reset
+  echo -ne ${RESET_FORMATTING}
+}
+ 
+# Override the mvn command with the colorized one.
+#alias mvn="mvn-color"
+
+# aliases
+alias mvncie='mvn clean install eclipse:eclipse'
+alias mvnci='mvn clean install'
+alias mvne='mvn eclipse:eclipse'
+alias mvnce='mvn clean eclipse:clean eclipse:eclipse'
+alias mvnd='mvn deploy'
+alias mvnp='mvn package'
+alias mvnc='mvn clean'
+alias mvncom='mvn compile'
+alias mvnt='mvn test'
+alias mvnag='mvn archetype:generate'
+
 function listMavenCompletions { 
 	 reply=(
 		cli:execute cli:execute-phase archetype:generate generate-sources compile clean install test test-compile deploy package cobertura:cobertura jetty:run gwt:run gwt:debug -DskipTests -Dmaven.test.skip=true -DarchetypeCatalog=http://tapestry.formos.com/maven-snapshot-repository -Dtest= `if [ -d ./src ] ; then find ./src -type f | grep -v svn | sed 's?.*/\([^/]*\)\..*?-Dtest=\1?' ; fi`); 
 }
 
-compctl -K listMavenCompletions mvn
+compctl -K listMavenCompletions mvn