Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2015
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.14 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # [[ -s "/users/gphummer/.gvm/bin/gvm-init.sh" ]] && source "/users/gphummer/.gvm/bin/gvm-init.sh"
  4.  
  5. # *******************
  6. # *******************
  7.  
  8. # COPY java_use (THE BELOW FUNCTION) TO YOUR BASH PROFILE. IT HAS NO FUNCTIONALITY IN THIS SCRIPT AND IS ONLY HERE SO YOU CAN COPY IT.
  9. # THIS IS NECESSARY BECAUSE FUNCTIONS CAN'T BE SCOPED INTO APPLE SCRIPT FROM A REGULAR SHELL FILE.
  10. java_use ()
  11. {
  12. export JAVA_HOME=$(/usr/libexec/java_home -v $1);
  13. export PATH=$JAVA_HOME/bin:$PATH;
  14. java -version
  15. }
  16.  
  17. # *******************
  18. # *******************
  19.  
  20.  
  21. function startApps {
  22. /usr/bin/osascript <<-EOF
  23. tell application "iTerm"
  24. activate
  25. tell the current terminal
  26. tell the current session
  27. write text "cd $TICKETFLY_DEV_PATH/DVA"
  28. write text "java_use 1.7"
  29. write text "./diva"
  30. write text "project core"
  31. write text "liquibase-update"
  32. write text "project server"
  33. write text "run"
  34. end tell
  35. tell application "System Events" to keystroke "d" using command down
  36. tell the current session
  37. delay 0.5
  38. write text "cd $TICKETFLY_DEV_PATH/INV/inventory"
  39. write text "java_use 1.6"
  40. write text "gvm use grails 2.2.3"
  41. write text "./dev"
  42. delay 0.5
  43. end tell
  44. tell application "System Events" to keystroke "d" using {command down, shift down}
  45. tell the current session
  46. delay 0.5
  47. write text "cd $TICKETFLY_DEV_PATH/USR/account"
  48. write text "java_use 1.7"
  49. write text "gvm use grails 2.4.4"
  50. write text "./dev"
  51. delay 0.5
  52. end tell
  53. tell application "System Events" to keystroke "d" using {command down, shift down}
  54. tell the current session
  55. delay 0.5
  56. write text "cd $TICKETFLY_DEV_PATH/BKS/backstage"
  57. write text "java_use 1.6"
  58. write text "gvm use grails 2.2.3"
  59. write text "./dev"
  60. delay 0.5
  61. end tell
  62. tell application "System Events" to keystroke "d" using {command down, shift down}
  63. tell the current session
  64. delay 0.5
  65. write text "cd $TICKETFLY_DEV_PATH/PUR/purchase"
  66. write text "java_use 1.6"
  67. write text "gvm use grails 2.2.3"
  68. write text "./dev"
  69. delay 0.5
  70. end tell
  71. end tell
  72. end tell
  73. EOF
  74. }
  75.  
  76. function resetStartApps {
  77. /usr/bin/osascript <<-EOF
  78. tell application "iTerm"
  79. activate
  80. tell the current terminal
  81. tell the current session
  82. write text "cd $TICKETFLY_DEV_PATH/DVA"
  83. write text "java_use 1.7"
  84. write text "./resetdb"
  85. write text "./diva"
  86. write text "project core"
  87. write text "liquibase-update"
  88. write text "project server"
  89. write text "run"
  90. end tell
  91. set myttyname to the tty of the first session
  92. tell application "System Events" to keystroke "d" using command down
  93. tell the last session
  94. write text "cd $TICKETFLY_DEV_PATH/INV/inventory"
  95. write text "java_use 1.6"
  96. write text "gvm use grails 2.2.3"
  97. write text "./resetdb"
  98. write text "./dev"
  99. end tell
  100. tell application "System Events" to keystroke "d" using {command down, shift down}
  101. tell the current session
  102. write text "cd $TICKETFLY_DEV_PATH/USR/account"
  103. write text "java_use 1.7"
  104. write text "gvm use grails 2.4.4"
  105. write text "./resetdb grant hummer gphummer@gmail.com"
  106. write text "./dev"
  107. end tell
  108. tell application "System Events" to keystroke "d" using {command down, shift down}
  109. tell the current session
  110. write text "cd $TICKETFLY_DEV_PATH/BKS/backstage"
  111. write text "java_use 1.6"
  112. write text "gvm use grails 2.2.3"
  113. write text "./resetdb"
  114. write text "./dev"
  115. end tell
  116. tell application "System Events" to keystroke "d" using {command down, shift down}
  117. tell the current session
  118. write text "cd $TICKETFLY_DEV_PATH/PUR/purchase"
  119. write text "java_use 1.6"
  120. write text "gvm use grails 2.2.3"
  121. write text "./dev"
  122. end tell
  123. end tell
  124. end tell
  125. EOF
  126. }
  127.  
  128. if [ "$1" == "" ]
  129. then
  130. echo "Start the script by passing the argument startapps. If you wish to reset your databases in addition to starting the apps, pass in the second argument resetdb."
  131. echo "Also, make sure that you have the java_use function copied into your bash_profile. You can find it at the top of this script's source code."
  132. echo "If you run resetdb, gphummer@gmail.com is the default admin email whose password you need to reset in localhost:8085/account ."
  133. elif [ "$1" == "startapps" ] && [ "$2" == "resetdb" ]
  134. then
  135. if [[ $TICKETFLY_DEV_PATH ]]
  136. then
  137. resetStartApps
  138. else
  139. echo "You need to set your TICKETFLY_DEV_PATH environment variable so the script knows where to look for your folders. Set it to the base directory that your ticketfly apps are in. Be sure that INV, PUR, DVA, BKS and USR are in that same directory."
  140. fi
  141. elif [ "$1" == "startapps" ]
  142. then
  143. startApps
  144. fi
  145.  
  146.  
  147.  
  148. # while [ "$1" != "" ]; do
  149. # case $1 in
  150. # -h | --help ) usage
  151. # exit
  152. # ;;
  153. # * ) usage
  154.  
  155. # esac
  156. # shift
  157. # done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement