Module: Fastlane::Helper::FirebaseAppDistributionHelper
- Included in:
- Actions::FirebaseAppDistributionAction, Actions::FirebaseAppDistributionAddTestersAction, Actions::FirebaseAppDistributionGetLatestReleaseAction, Actions::FirebaseAppDistributionGetUdidsAction, Actions::FirebaseAppDistributionRemoveTestersAction, Client::FirebaseAppDistributionApiClient
- Defined in:
- lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb
Instance Method Summary collapse
- #app_name_from_app_id(app_id) ⇒ Object
- #binary_type_from_path(binary_path) ⇒ Object
- #blank?(value) ⇒ Boolean
- #get_ios_app_id_from_archive_plist(archive_path, plist_path) ⇒ Object
- #get_value_from_value_or_file(value, path) ⇒ Object
- #parse_plist(path) ⇒ Object
- #present?(value) ⇒ Boolean
-
#string_to_array(string) ⇒ Object
Returns the array representation of a string with trimmed comma seperated values.
Instance Method Details
#app_name_from_app_id(app_id) ⇒ Object
56 57 58 |
# File 'lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb', line 56 def app_name_from_app_id(app_id) "projects/#{app_id.split(':')[1]}/apps/#{app_id}" end |
#binary_type_from_path(binary_path) ⇒ Object
7 8 9 10 11 12 13 14 |
# 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) ⇒ Boolean
47 48 49 50 |
# File 'lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb', line 47 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) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb', line 39 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) ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# 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) ⇒ Object
35 36 37 |
# File 'lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb', line 35 def parse_plist(path) CFPropertyList.native_types(CFPropertyList::List.new(file: path).value) end |
#present?(value) ⇒ Boolean
52 53 54 |
# File 'lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb', line 52 def present?(value) !blank?(value) end |
#string_to_array(string) ⇒ Object
Returns the array representation of a string with trimmed comma seperated values.
29 30 31 32 33 |
# File 'lib/fastlane/plugin/firebase_app_distribution/helper/firebase_app_distribution_helper.rb', line 29 def string_to_array(string) return nil if string.nil? || string.empty? # Strip string and then strip individual values string.strip.split(",").map(&:strip) end |