Class: FastlaneCore::IpaFileAnalyser
- Inherits:
-
Object
- Object
- FastlaneCore::IpaFileAnalyser
- Defined in:
- lib/fastlane_core/ipa_file_analyser.rb
Class Method Summary collapse
-
.fetch_app_identifier(path) ⇒ Object
Fetches the app identifier (e.g. com.facebook.Facebook) from the given ipa file.
-
.fetch_app_version(path) ⇒ Object
Fetches the app version from the given ipa file.
- .fetch_info_plist_file(path) ⇒ Object
Class Method Details
.fetch_app_identifier(path) ⇒ Object
Fetches the app identifier (e.g. com.facebook.Facebook) from the given ipa file.
6 7 8 9 10 |
# File 'lib/fastlane_core/ipa_file_analyser.rb', line 6 def self.fetch_app_identifier(path) plist = self.fetch_info_plist_file(path) return plist['CFBundleIdentifier'] if plist return nil end |
.fetch_app_version(path) ⇒ Object
Fetches the app version from the given ipa file.
13 14 15 16 17 |
# File 'lib/fastlane_core/ipa_file_analyser.rb', line 13 def self.fetch_app_version(path) plist = self.fetch_info_plist_file(path) return plist['CFBundleShortVersionString'] if plist return nil end |
.fetch_info_plist_file(path) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/fastlane_core/ipa_file_analyser.rb', line 19 def self.fetch_info_plist_file(path) Zip::File.open(path) do |zipfile| zipfile.each do |file| next unless file.name.include? '.plist' and !['.bundle', '.framework'].any? { |a| file.name.include? a } # We can not be completely sure, that's the correct plist file, so we have to try begin # The XML file has to be properly unpacked first tmp_path = "/tmp/deploytmp.plist" File.write(tmp_path, zipfile.read(file)) system("plutil -convert xml1 #{tmp_path}") result = Plist.parse_xml(tmp_path) File.delete(tmp_path) if result['CFBundleIdentifier'] or result['CFBundleVersion'] return result end rescue # We don't really care, look for another XML file end end end nil end |