totvs.zsh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. #
  2. # Just some utilities for use in ecm development.
  3. #
  4. setopt rmstarsilent
  5. HOME="/home/carlos"
  6. ECM_WS="$HOME/totvs/ws"
  7. ECM_JBOSS="$HOME/Public/ecm/JBoss-7.1.1"
  8. ECM_PORT="8080"
  9. VOLDEMORT=$ECM_WS/voldemort
  10. ECM=$ECM_WS/ecm
  11. INSTALLER="n"
  12. DRY_CLEAN="n"
  13. # fuckin aliases
  14. alias ecmu=ecmup
  15. alias ecmb=ecmbuild
  16. alias ecmc=ecmclean
  17. alias ecms=ecmstart
  18. alias ecmo=ecmstop
  19. alias ecmi=ecminstall
  20. alias ecmri=ecmruninstall
  21. alias ecm=ecmfull
  22. alias e='MAVEN_OPTS="-Xmx2048m -XX:MaxPermSize=512m -DskipTests=true" ecm'
  23. # update ecm
  24. ecmup() {
  25. echo "update all the things!"
  26. cd $VOLDEMORT && svn up
  27. cd $ECM && svn up
  28. }
  29. # build it!
  30. ecmbuild() {
  31. echo "build? no problem sir..."
  32. cd $VOLDEMORT && mvncie && \
  33. cd $VOLDEMORT/social-ecm && \
  34. cd $VOLDEMORT/wcm && mvncie && \
  35. cd $ECM/wecmpackage && mvncie && \
  36. cd $VOLDEMORT/ecm && mvncie && \
  37. ecminstall
  38. }
  39. # gen installer or cp wars...
  40. ecminstall() {
  41. case $@ in
  42. -*i*)
  43. INSTALLER=y
  44. ;;
  45. esac
  46. if [[ "$INSTALLER" == "y" ]]; then
  47. echo "generating installer..."
  48. cd $VOLDEMORT/ecm/installer
  49. mvnci -am -Drun=installer -DLinux64=true -DappServer=jboss
  50. else
  51. echo "cpying wars..."
  52. cd $VOLDEMORT/ecm/build && mvnci && \
  53. cd $VOLDEMORT/wcm/build && mvnci && \
  54. cd $VOLDEMORT/social-ecm/build && mvnci
  55. fi
  56. }
  57. # clean jboss trash folders
  58. ecmclean() {
  59. echo "cleaning jboss shit"
  60. case $@ in
  61. -*d*)
  62. DRY_CLEAN="y"
  63. ;;
  64. esac
  65. if [[ "$DRY_CLEAN" == "y" ]]; then
  66. rm -rf $ECM_JBOSS/standalone/deployments/*.{failed,deployed,dodeploy,deploying}
  67. else
  68. rm -rf $ECM_JBOSS/standalone/deployments/*
  69. fi
  70. rm -rf $ECM_JBOSS/standalone/{log,tmp,data}
  71. rm -rf $ECM_JBOSS/solr/zoo_data
  72. }
  73. # start jboss server
  74. ecmstart() {
  75. # why shall I start server if i just gen a installer?
  76. if [[ "$INSTALLER" == "y" ]]; then
  77. ecmruninstall
  78. else
  79. echo "starting jboss"
  80. cd $ECM_JBOSS/bin
  81. JAVA_OPTS="-Xmx2048m -XX:MaxPermSize=512m -DzkRun -Dbootstrap_conf=true" ./standalone.sh
  82. fi
  83. }
  84. ecmruninstall() {
  85. echo "ok, lets install this crap :)"
  86. cd $VOLDEMORT/ecm/installer/izpack/target
  87. if [[ -f ECM-Linux64.zip ]]; then
  88. mkdir -p /tmp/ecmi
  89. rm -rf /tmp/ecmi/*
  90. unzip ECM-Linux64 -d /tmp/ecmi/
  91. cd /tmp/ecmi/
  92. chmod a+x ECM-Installer-64.sh
  93. ./ECM-Installer-64.sh
  94. else
  95. echo "uhoh, installer doesnt exist ($VOLDEMORT/ecm/installer/izpack/target/ECM-Linux64.zip)"
  96. fi
  97. }
  98. # stop jboss (usually on 8080)
  99. ecmstop() {
  100. echo "kill jboss (or whatever you are running on 8080"
  101. fuser -k $ECM_PORT/tcp
  102. }
  103. # do all the things
  104. ecmfull() {
  105. echo "serious business here. let's have a coffee.."
  106. ecmstop
  107. ecmclean
  108. ecmup
  109. ecmbuild && ecmstart
  110. }