Improve performance when retrieving xcode version and build number
Improve performance when retrieving xcode version and build number

Benchmark.bm do |x|
  x.report {
    100.times do
      vers = `/usr/libexec/PlistBuddy -c "Print :CFBundleShortVersionString" "#{xcode_dir}/../Info.plist" 2>&1`.strip
      build = `/usr/libexec/PlistBuddy -c "Print :ProductBuildVersion" "#{xcode_dir}/../version.plist" 2>&1`.strip
    end
  }
  x.report {
    100.times do
      txt = `#{locate_binary('xcodebuild')} -version`
      vers = txt.scan(/Xcode\s(.+)/)[0][0]
      build = txt.scan(/(BuildVersion:|Build version)\s(.+)/)[0][1]
    end
  }
end

     user     system      total        real
 0.050000   0.240000   3.080000 (  3.153654)
 0.030000   0.160000   7.230000 (  8.380947)

HipByte/RubyMotion,HipByte/RubyMotion,hboon/RubyMotion,katsuyoshi/RubyMotion,katsuyoshi/RubyMotion,katsuyoshi/RubyMotion,hboon/RubyMotion,katsuyoshi/RubyMotion,hboon/RubyMotion,HipByte/RubyMotion