Skip to content
Browse files

Added few project-specific customization scripts. These are invoked from

the bash_profile
  • Loading branch information...
1 parent 4a773f4 commit 09310a55a932b40083c9218c70582ed821bff004 Joseph Khafaji committed Sep 9, 2015
Showing with 82 additions and 0 deletions.
  1. +32 −0 UnixShellScripts/masabi_easily_connect_to_servers.sh
  2. +50 −0 UnixShellScripts/masabi_mpg_build.sh
View
32 UnixShellScripts/masabi_easily_connect_to_servers.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+function localMysql(){
+ mysql -uroot -pr2kogCiKyKq5 $1
+}
+
+function dockerMysql(){
+ mysql -uroot -pr2kogCiKyKq5 -h$(boot2docker ip) -P13306 $1
+}
+
+
+# To quickly tail all tomcat logs
+function logs(){
+ tail -f /usr/local/Cellar/tomcat7/7.0.61/libexec/logs/*.out \
+ /usr/local/Cellar/tomcat7/7.0.61/libexec/logs/*.txt \
+ /var/hosting/tomcatlogs/justride_mpg.log
+}
+
+# run a command against Tomcat docker container
+function _()
+{
+ docker exec $(docker ps | grep $(docker ps | grep masabi/payment-webapp | grep -v db | awk '{print $1}') | awk '{print $1}') "$@"
+}
+
+# run a command against Mysql docker container
+function __()
+{
+ docker exec $(docker ps | grep $(docker ps | grep masabi/payment-webapp-db | awk '{print $1}') | awk '{print $1}') "$@"
+}
+
+function dockerMpgLogs(){
+ _ tail -f /var/hosting/tomcatlogs/justride_mpg.log
+}
View
50 UnixShellScripts/masabi_mpg_build.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# VARIABLES DECLARATION
+MPG_SRC_HOME="/Users/hassanein.khafaji/Projects/masabi/mpg"
+
+function mpgBuild()
+{
+ cd ${MPG_SRC_HOME}
+ mvn clean package --projects com.masabi:justride-payment-webapp --also-make -DskipTests $1
+}
+
+function mpgBuildWithUnitTests()
+{
+ cd ${MPG_SRC_HOME}
+ mvn clean package --projects com.masabi:justride-payment-webapp --also-make $1 -o
+}
+
+function mpgDeploy(){
+ MPG_WAR="${MPG_SRC_HOME}/payment-webapp/target/MPG.war"
+ TOMCAT_WEBAPPS="/usr/local/Cellar/tomcat7/7.0.61/libexec/webapps"
+ CATALINA_SH="/usr/local/Cellar/tomcat7/7.0.61/libexec/bin/catalina.sh"
+
+ # delete the old war and copy the new one.
+ cd ${TOMCAT_WEBAPPS}
+ rm -fr MPG*
+ cp ${MPG_WAR} .
+
+ # restart tomcat
+ ps -ef | grep tomcat | grep -v grep | awk '{print $2}' | xargs kill -9
+ ${CATALINA_SH} start
+}
+
+function mpgRedeploy(){
+ mpgBuild && mpgDeploy
+}
+
+function mpgBuildWithIntegrationTests(){
+ cd ${MPG_SRC_HOME}
+ mvn verify --projects com.masabi:justride-payment-webapp --also-make -P WithDocker $1
+}
+
+function mpgBuildThenRunDocker(){
+ cd ${MPG_SRC_HOME}
+ mvn pre-integration-test --projects com.masabi:justride-payment-webapp --also-make -P WithDocker $1
+}
+
+function mpgBuildThenRunDockerAndRunTests(){
+ cd ${MPG_SRC_HOME}
+ mvn integration-test --projects com.masabi:justride-payment-webapp --also-make $1
+}

0 comments on commit 09310a5

Please sign in to comment.
Something went wrong with that request. Please try again.