totvs.zsh 2.52 KB
Newer Older
Carlos Alexandro Becker's avatar
Carlos Alexandro Becker committed
1
2
3
4
5
6
7
8
9
10
11
12
13
#
# 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"
14
DRY_CLEAN="n"
Carlos Alexandro Becker's avatar
Carlos Alexandro Becker committed
15
16
17
18
19
20
21

# fuckin aliases
alias ecmu=ecmup
alias ecmb=ecmbuild
alias ecmc=ecmclean
alias ecms=ecmstart
alias ecmo=ecmstop
22
alias ecmi=ecminstall
23
alias ecmri=ecmruninstall
24
alias ecm=ecmfull
Carlos Alexandro Becker's avatar
e alias    
Carlos Alexandro Becker committed
25
26
alias e='MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=512m -DskipTests=true" ecm'  

Carlos Alexandro Becker's avatar
Carlos Alexandro Becker committed
27
28
29
30
31
32
33
34
35
36

# update ecm
ecmup() {
	echo "update all the things!"
	cd $VOLDEMORT && svn up
	cd $ECM && svn up
}

# build it!
ecmbuild() {
37
	echo "build? no problem sir..."
38
39
40
41
42
	cd $VOLDEMORT && mvncie && \
	cd $VOLDEMORT/social-ecm && \
	cd $VOLDEMORT/wcm && mvncie && \
	cd $ECM/wecmpackage && mvncie && \
	cd $VOLDEMORT/ecm && mvncie && \
43
44
45
46
47
	ecminstall
}

# gen installer or cp wars...
ecminstall() {
48
49
50
51
52
53
54
55
56
57
	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
Carlos Alexandro Becker's avatar
go    
Carlos Alexandro Becker committed
58
		echo "cpying wars..."
59
    cd $VOLDEMORT/ecm/build && mvnci && \
60
		cd $VOLDEMORT/wcm/build && mvnci && \
61
62
    cd $VOLDEMORT/social-ecm/build && mvnci
	fi
Carlos Alexandro Becker's avatar
Carlos Alexandro Becker committed
63
64
65
66
67
}

# clean jboss trash folders
ecmclean() {
	echo "cleaning jboss shit"
68
69
70
71
72
73
74
75
76
77
78
79
	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
Carlos Alexandro Becker's avatar
Carlos Alexandro Becker committed
80
81
82
83
}

# start jboss server
ecmstart() {
84
	# why shall I start server if i just gen a installer?
85
86
87
	if [[ "$INSTALLER" == "y" ]]; then
		ecmruninstall
	else
88
		echo "starting jboss"
89
90
		cd $ECM_JBOSS/bin
		JAVA_OPTS="-Xmx2048m -XX:MaxPermSize=512m -DzkRun -Dbootstrap_conf=true" ./standalone.sh
91
	fi
Carlos Alexandro Becker's avatar
Carlos Alexandro Becker committed
92
93
}

94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
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
}

Carlos Alexandro Becker's avatar
Carlos Alexandro Becker committed
109
110
111
112
113
114
115
# 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
116
ecmfull() {
Carlos Alexandro Becker's avatar
Carlos Alexandro Becker committed
117
118
119
	echo "serious business here. let's have a coffee.."
	ecmstop
	ecmclean
Carlos Alexandro Becker's avatar
oops    
Carlos Alexandro Becker committed
120
121
	ecmup
	ecmbuild && ecmstart
Carlos Alexandro Becker's avatar
Carlos Alexandro Becker committed
122
123
124
}