File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -710,11 +710,10 @@ def install_components
710710 `touch #{ cache_dir } com.apple.dt.Xcode.InstallCheckCache_#{ osx_build_version } _#{ tools_version } `
711711 end
712712
713- # This method might take a few ms, this could be improved by implementing https://github.com/KrauseFx/xcode-install/issues/273
714713 def fetch_version
715- output = `DEVELOPER_DIR='' " #{ @path } /Contents/Developer/usr/bin/xcodebuild" - version`
714+ output = `/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" " #{ @path } /Contents/version.plist" `
716715 return '0.0' if output . nil? || output . empty? # ¯\_(ツ)_/¯
717- output . split ( "\n " ) . first . split ( ' ' ) [ 1 ]
716+ output . sub ( "\n " , '' )
718717 end
719718
720719 def verify_integrity
Original file line number Diff line number Diff line change @@ -5,13 +5,13 @@ module XcodeInstall
55
66 describe InstalledXcode do
77 it 'finds the current Xcode version with whitespace chars' do
8- InstalledXcode . any_instance . expects ( :` ) . with ( "DEVELOPER_DIR='' \" #{ xcode_path } /Contents/Developer/usr/bin/xcodebuild \" -version " ) . returns ( "Xcode 6.3.1\n Build version 6D1002" )
8+ InstalledXcode . any_instance . expects ( :` ) . with ( "/usr/libexec/PlistBuddy -c \" Print :CFBundleShortVersionString \" \" #{ xcode_path } /Contents/version.plist \" " ) . returns ( ' 6.3.1' )
99 installed = InstalledXcode . new ( xcode_path )
1010 installed . version . should == '6.3.1'
1111 end
1212
1313 it 'is robust against broken Xcode installations' do
14- InstalledXcode . any_instance . expects ( :` ) . with ( "DEVELOPER_DIR='' \" #{ xcode_path } /Contents/Developer/usr/bin/xcodebuild \" -version " ) . returns ( nil )
14+ InstalledXcode . any_instance . expects ( :` ) . with ( "/usr/libexec/PlistBuddy -c \" Print :CFBundleShortVersionString \" \" #{ xcode_path } /Contents/version.plist \" " ) . returns ( nil )
1515 installed = InstalledXcode . new ( xcode_path )
1616 installed . version . should == '0.0'
1717 end
You can’t perform that action at this time.
0 commit comments