Slide 16
Slide 16 text
Extracting metadata from a package
# lib/cfpropertybundle.rb
class CFPropertyBundle
class Error < StandardError; end
def initialize(path)
@path = path
end
def properties
Zip::File.open(@path) do |package|
data = extract_plist_data_from package
{
display_name: data['CFBundleDisplayName'],
identifier: data['CFBundleIdentifier'],
version: data['CFBundleVersion'],
minimum_os_version: data['MinimumOSVersion'],
short_version: data['CFBundleShortVersionString']
}
end
rescue Zip::Error, SystemCallError => e
raise Error, e.message
end
end
The CFPropertyBundle library unzips the
package, parses the information stored in XML
format and returns a Hash with the properties
needed to generate a manifest.
If the package is not a Zip file or the content
doesn’t match the .ipa format, a custom
CFProperty::Error is raised.