Method: FastlaneCore::IpaFileAnalyser.fetch_info_plist_file

Defined in:
fastlane_core/lib/fastlane_core/ipa_file_analyser.rb

.fetch_info_plist_file(path) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'fastlane_core/lib/fastlane_core/ipa_file_analyser.rb', line 39

def self.fetch_info_plist_file(path)
  UI.user_error!("Could not find file at path '#{path}'") unless File.exist?(path)
  plist_data = self.fetch_info_plist_with_rubyzip(path)
  if plist_data.nil?
    # Xcode produces invalid zip files for IPAs larger than 4GB. RubyZip
    # can't read them, but the unzip command is able to work around this.
    plist_data = self.fetch_info_plist_with_unzip(path)
  end
  return nil if plist_data.nil?

  # Creates a temporary directory with a unique name tagged with 'fastlane'
  # The directory is deleted automatically at the end of the block
  Dir.mktmpdir("fastlane") do |tmp|
    # The XML file has to be properly unpacked first
    tmp_path = File.join(tmp, "Info.plist")
    File.open(tmp_path, 'wb') do |output|
      output.write(plist_data)
    end
    result = CFPropertyList.native_types(CFPropertyList::List.new(file: tmp_path).value)

    if result['CFBundleIdentifier'] || result['CFBundleVersion']
      return result
    end
  end

  return nil
end