Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # [[ -s "/users/gphummer/.gvm/bin/gvm-init.sh" ]] && source "/users/gphummer/.gvm/bin/gvm-init.sh"
- # *******************
- # *******************
- # 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.
- # THIS IS NECESSARY BECAUSE FUNCTIONS CAN'T BE SCOPED INTO APPLE SCRIPT FROM A REGULAR SHELL FILE.
- java_use ()
- {
- export JAVA_HOME=$(/usr/libexec/java_home -v $1);
- export PATH=$JAVA_HOME/bin:$PATH;
- java -version
- }
- # *******************
- # *******************
- function startApps {
- /usr/bin/osascript <<-EOF
- tell application "iTerm"
- activate
- tell the current terminal
- tell the current session
- write text "cd $TICKETFLY_DEV_PATH/DVA"
- write text "java_use 1.7"
- write text "./diva"
- write text "project core"
- write text "liquibase-update"
- write text "project server"
- write text "run"
- end tell
- tell application "System Events" to keystroke "d" using command down
- tell the current session
- delay 0.5
- write text "cd $TICKETFLY_DEV_PATH/INV/inventory"
- write text "java_use 1.6"
- write text "gvm use grails 2.2.3"
- write text "./dev"
- delay 0.5
- end tell
- tell application "System Events" to keystroke "d" using {command down, shift down}
- tell the current session
- delay 0.5
- write text "cd $TICKETFLY_DEV_PATH/USR/account"
- write text "java_use 1.7"
- write text "gvm use grails 2.4.4"
- write text "./dev"
- delay 0.5
- end tell
- tell application "System Events" to keystroke "d" using {command down, shift down}
- tell the current session
- delay 0.5
- write text "cd $TICKETFLY_DEV_PATH/BKS/backstage"
- write text "java_use 1.6"
- write text "gvm use grails 2.2.3"
- write text "./dev"
- delay 0.5
- end tell
- tell application "System Events" to keystroke "d" using {command down, shift down}
- tell the current session
- delay 0.5
- write text "cd $TICKETFLY_DEV_PATH/PUR/purchase"
- write text "java_use 1.6"
- write text "gvm use grails 2.2.3"
- write text "./dev"
- delay 0.5
- end tell
- end tell
- end tell
- EOF
- }
- function resetStartApps {
- /usr/bin/osascript <<-EOF
- tell application "iTerm"
- activate
- tell the current terminal
- tell the current session
- write text "cd $TICKETFLY_DEV_PATH/DVA"
- write text "java_use 1.7"
- write text "./resetdb"
- write text "./diva"
- write text "project core"
- write text "liquibase-update"
- write text "project server"
- write text "run"
- end tell
- set myttyname to the tty of the first session
- tell application "System Events" to keystroke "d" using command down
- tell the last session
- write text "cd $TICKETFLY_DEV_PATH/INV/inventory"
- write text "java_use 1.6"
- write text "gvm use grails 2.2.3"
- write text "./resetdb"
- write text "./dev"
- end tell
- tell application "System Events" to keystroke "d" using {command down, shift down}
- tell the current session
- write text "cd $TICKETFLY_DEV_PATH/USR/account"
- write text "java_use 1.7"
- write text "gvm use grails 2.4.4"
- write text "./resetdb grant hummer gphummer@gmail.com"
- write text "./dev"
- end tell
- tell application "System Events" to keystroke "d" using {command down, shift down}
- tell the current session
- write text "cd $TICKETFLY_DEV_PATH/BKS/backstage"
- write text "java_use 1.6"
- write text "gvm use grails 2.2.3"
- write text "./resetdb"
- write text "./dev"
- end tell
- tell application "System Events" to keystroke "d" using {command down, shift down}
- tell the current session
- write text "cd $TICKETFLY_DEV_PATH/PUR/purchase"
- write text "java_use 1.6"
- write text "gvm use grails 2.2.3"
- write text "./dev"
- end tell
- end tell
- end tell
- EOF
- }
- if [ "$1" == "" ]
- then
- 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."
- 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."
- echo "If you run resetdb, gphummer@gmail.com is the default admin email whose password you need to reset in localhost:8085/account ."
- elif [ "$1" == "startapps" ] && [ "$2" == "resetdb" ]
- then
- if [[ $TICKETFLY_DEV_PATH ]]
- then
- resetStartApps
- else
- 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."
- fi
- elif [ "$1" == "startapps" ]
- then
- startApps
- fi
- # while [ "$1" != "" ]; do
- # case $1 in
- # -h | --help ) usage
- # exit
- # ;;
- # * ) usage
- # esac
- # shift
- # done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement