install.ios.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. eros_prefix="[\033[34meros\033[0m]"
  3. function error_exit {
  4. echo "--------------------------------------------"
  5. echo -e "\033[31m Error code is $1 \033[0m" 1>&2
  6. echo ""
  7. echo " Code tips: "
  8. echo -e "\033[33m1 -> platforms/ios/WeexEros/ is not existed. \033[0m"
  9. echo -e "\033[33m2 -> cannot remove platforms/ios/WeexEros/WeexiOSSDK, please check file permissions. \033[0m"
  10. echo -e "\033[33m3 -> cannot remove platforms/ios/WeexEros/Benmu-iOS-Library, please check file permissions. \033[0m"
  11. echo -e "\033[33m4 -> failed run: git clone https://github.com/bmfe/WeexiOSSDK.git. \033[0m"
  12. echo -e "\033[33m5 -> failed run: git clone https://github.com/bmfe/Benmu-iOS-Library.git. \033[0m"
  13. echo -e "\033[33m6 -> pod update failed. \033[0m"
  14. echo -e "\033[33m7 -> run open xcode failed, make sure you had install xcode in appStore. \033[0m"
  15. exit 1
  16. }
  17. cd platforms/ios/WeexEros/ || \
  18. error_exit 1
  19. echo -e "$eros_prefix \033[33mtips: make sure xcode had been closed.\033[0m"
  20. echo -e "$eros_prefix Enter ios project"
  21. if [ -e WeexiOSSDK/ ] || [ -e Benmu-iOS-Library/ ]
  22. then
  23. echo -e "$eros_prefix WeexiOSSDK and Benmu-iOS-Library is existed, remove old sdk."
  24. rm -rf WeexiOSSDK/ || error_exit 2
  25. rm -rf Benmu-iOS-Library/ || error_exit 3
  26. else
  27. echo -e "$eros_prefix No WeexiOSSDK and Benmu-iOS-Library, we will start to clone new sdk..."
  28. fi
  29. echo -e "$eros_prefix \033[36mMay spend a lot of time, please wait patiently. \033[0m"
  30. git clone https://github.com/bmfe/WeexiOSSDK.git -q --depth=1 || \
  31. error_exit 4
  32. echo -e "$eros_prefix Weex sdk clone done."
  33. git clone https://github.com/bmfe/Benmu-iOS-Library.git -q --depth=1 || \
  34. error_exit 5
  35. echo -e "$eros_prefix Eros sdk clone done."
  36. echo -e "$eros_prefix Run pod update and show some update detail:"
  37. pod update --no-ansi || error_exit 6
  38. echo ""
  39. echo -e "$eros_prefix \033[32miOS sdk has been installed, enjoy it! \033[0m"
  40. open WeexEros.xcworkspace || error_exit 7