Advertisement
Guest User

Untitled

a guest
Apr 1st, 2015
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. PREVIOUS_HEAD=$1
  4. NEW_HEAD=$2
  5. BRANCH_SWITCH=$3
  6.  
  7. if [[ $BRANCH_SWITCH == "1" && $PREVIOUS_HEAD != $NEW_HEAD ]]; then
  8.  
  9. # Kill the simulator.
  10. SIM=`pgrep 'iPhone Simulator'`
  11. if [[ "'$SIM'" != "" ]]; then
  12. osascript -e 'tell application "iPhone Simulator" to quit'
  13. fi
  14.  
  15. XCODE=`pgrep 'Xcode'`
  16. if [[ "'$XCODE'" != "" ]]; then
  17. WORKSPACE=`osascript -e 'tell application "Xcode" to get name of active workspace document' 2> /dev/null`
  18. osascript -e 'tell application "Xcode" to close active workspace document'
  19. fi
  20.  
  21. # Check if pods need to be installed.
  22. diff "Podfile.lock" "Pods/Manifest.lock" > /dev/null 2>&1
  23. if [[ $? != 0 ]]; then
  24. echo "Pods are out of sync. Installing pods..."
  25. pod install
  26. if [[ $? -eq 0 ]]; then
  27. echo "Pods are now up to date."
  28. fi
  29. else
  30. echo "Pods are already up to date."
  31. fi
  32.  
  33. if [[ "$WORKSPACE" == *xcworkspace ]]; then
  34. open $WORKSPACE
  35. fi
  36. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement