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_platform(path) ⇒ Object
Fetches the app platform 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.
7 8 9 10 11 |
# File 'lib/fastlane_core/ipa_file_analyser.rb', line 7 def self.fetch_app_identifier(path) plist = self.fetch_info_plist_file(path) return plist['CFBundleIdentifier'] if plist return nil end |
.fetch_app_platform(path) ⇒ Object
Fetches the app platform from the given ipa file.
21 22 23 24 25 26 27 |
# File 'lib/fastlane_core/ipa_file_analyser.rb', line 21 def self.fetch_app_platform(path) plist = self.fetch_info_plist_file(path) platform = "ios" platform = plist['DTPlatformName'] if plist platform = "ios" if platform == "iphoneos" # via https://github.com/fastlane/spaceship/issues/247 return platform end |
.fetch_app_version(path) ⇒ Object
Fetches the app version from the given ipa file.
14 15 16 17 18 |
# File 'lib/fastlane_core/ipa_file_analyser.rb', line 14 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
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/fastlane_core/ipa_file_analyser.rb', line 29 def self.fetch_info_plist_file(path) Zip::File.open(path) do |zipfile| file = zipfile.glob('**/Payload/*.app/Info.plist').first return nil unless file # 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 nil end |