Skip to content

Instantly share code, notes, and snippets.

@baxang
Created November 9, 2014 07:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baxang/252842e5914dead5323d to your computer and use it in GitHub Desktop.
Save baxang/252842e5914dead5323d to your computer and use it in GitHub Desktop.
Read Info.plist and get a version number from a packaged iOS app distribution file(.ipa).
desc "Check binary version."
task :get_ver do
require 'rubygems'
require 'zip'
require 'pathname'
require 'cfpropertylist'
Zip::File.open('build/iPhoneOS-8.0-Release/WH.ipa') do |file|
plist = file.get_entry('Payload/WH.app/Info.plist')
content = CFPropertyList::List.new(format: CFPropertyList::List::FORMAT_BINARY, data: plist.get_input_stream.read)
data = CFPropertyList.native_types(content.value)
data.each do |k, v|
puts "#{k} : #{v}"
end
puts "------"
puts data['CFBundleName']
puts data['CFBundleIdentifier']
puts data['CFBundleVersion']
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment