module Fastlane::Helper::FirebaseAppDistributionHelper

Public Instance Methods

binary_type_from_path(binary_path) click to toggle source
# File lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb, line 7
def binary_type_from_path(binary_path)
  extension = File.extname(binary_path)
  return :APK if extension == '.apk'
  return :AAB if extension == '.aab'
  return :IPA if extension == '.ipa'

  UI.user_error!("Unsupported distribution file format, should be .ipa, .apk or .aab")
end
blank?(value) click to toggle source
# File lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb, line 48
def blank?(value)
  # Taken from https://apidock.com/rails/Object/blank%3F
  value.respond_to?(:empty?) ? value.empty? : !value
end
get_ios_app_id_from_archive_plist(archive_path, plist_path) click to toggle source
# File lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb, line 40
def get_ios_app_id_from_archive_plist(archive_path, plist_path)
  app_path = parse_plist("#{archive_path}/Info.plist")["ApplicationProperties"]["ApplicationPath"]
  UI.shell_error!("can't extract application path from Info.plist at #{archive_path}") if app_path.empty?
  identifier = parse_plist("#{archive_path}/Products/#{app_path}/#{plist_path}")["GOOGLE_APP_ID"]
  UI.shell_error!("can't extract GOOGLE_APP_ID") if identifier.empty?
  return identifier
end
get_value_from_value_or_file(value, path) click to toggle source
# File lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb, line 16
def get_value_from_value_or_file(value, path)
  if (value.nil? || value.empty?) && !path.nil?
    begin
      return File.open(path).read
    rescue Errno::ENOENT
      UI.crash!("#{ErrorMessage::INVALID_PATH}: #{path}")
    end
  end
  value
end
parse_plist(path) click to toggle source
# File lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb, line 36
def parse_plist(path)
  CFPropertyList.native_types(CFPropertyList::List.new(file: path).value)
end
present?(value) click to toggle source
# File lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb, line 53
def present?(value)
  !blank?(value)
end
string_to_array(string) click to toggle source

Returns the array representation of a string with comma seperated values.

Does not work with strings whose individual values have spaces. EX “Hello World” the space will be removed to “HelloWorld”

# File lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb, line 30
def string_to_array(string)
  return nil if string.nil? || string.empty?
  string_array = string.gsub(/\s+/, '').split(",")
  return string_array
end