xcode 948 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env bash
  2. __rvm_detect_xcode_version()
  3. {
  4. \typeset version_file
  5. for version_file in \
  6. /Applications/Xcode.app/Contents/version.plist \
  7. /Developer/Applications/Xcode.app/Contents/version.plist
  8. do
  9. if
  10. [[ -f $version_file ]]
  11. then
  12. if
  13. [[ -x /usr/libexec/PlistBuddy ]]
  14. then
  15. /usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" $version_file
  16. else
  17. __rvm_sed -n '/<key>CFBundleShortVersionString<\/key>/{n; s/^.*>\(.*\)<.*$/\1/; p;}' < $version_file
  18. fi
  19. return 0
  20. fi
  21. done
  22. if
  23. builtin command -v xcodebuild >/dev/null
  24. then
  25. xcodebuild -version | __rvm_sed -n '/Xcode/ {s/Xcode //; p;}'
  26. return 0
  27. fi
  28. return 1
  29. }
  30. __rvm_detect_xcode_version_at_least()
  31. {
  32. \typeset __xcode_version="$(__rvm_detect_xcode_version)"
  33. [[ -n "$__xcode_version" ]] || return 0
  34. __rvm_version_compare "$__xcode_version" -ge "$1" || return $?
  35. true # for OSX
  36. }