Class: Fastlane::Actions::FirebaseAppDistributionGetUdidsAction

Inherits:
Action
  • Object
show all
Extended by:
Fastlane::Auth::FirebaseAppDistributionAuthClient, Helper::FirebaseAppDistributionHelper
Defined in:
lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb

Constant Summary

Constants included from Fastlane::Auth::FirebaseAppDistributionAuthClient

Fastlane::Auth::FirebaseAppDistributionAuthClient::REDACTION_CHARACTER, Fastlane::Auth::FirebaseAppDistributionAuthClient::REDACTION_EXPOSED_LENGTH, Fastlane::Auth::FirebaseAppDistributionAuthClient::TOKEN_CREDENTIAL_URI

Class Method Summary collapse

Methods included from Fastlane::Auth::FirebaseAppDistributionAuthClient

fetch_auth_token

Methods included from Helper::FirebaseAppDistributionHelper

app_name_from_app_id, binary_type_from_path, blank?, get_ios_app_id_from_archive_plist, get_value_from_value_or_file, parse_plist, present?, string_to_array

Class Method Details

.authorsObject



44
45
46
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb', line 44

def self.authors
  ["Lee Kellogg"]
end

.available_optionsObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb', line 53

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :app,
                                 env_name: "FIREBASEAPPDISTRO_APP",
                                 description: "Your app's Firebase App ID. You can find the App ID in the Firebase console, on the General Settings page",
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :output_file,
                                 env_name: "FIREBASEAPPDISTRO_OUTPUT_FILE",
                                 description: "The path to the file where the tester UDIDs will be written",
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :firebase_cli_token,
                                 description: "Auth token generated using 'fastlane run firebase_app_distribution_login', or the Firebase CLI's login:ci command",
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :service_credentials_file,
                                 description: "Path to Google service account json",
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :debug,
                                 description: "Print verbose debug output",
                                 optional: true,
                                 default_value: false,
                                 is_string: false)
  ]
end

.descriptionObject



40
41
42
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb', line 40

def self.description
  "Download the UDIDs of your Firebase App Distribution testers"
end

.detailsObject

supports markdown.



49
50
51
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb', line 49

def self.details
  "Export your testers' device identifiers in a CSV file, so you can add them your provisioning profile. This file can be imported into your Apple developer account using the Register Multiple Devices option. See the [App Distribution docs](https://firebase.google.com/docs/app-distribution/ios/distribute-console#register-tester-devices) for more info."
end

.example_codeObject



85
86
87
88
89
90
91
92
93
94
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb', line 85

def self.example_code
  [
    <<-CODE
      firebase_app_distribution_get_udids(
        app: "<your Firebase app ID>",
        output_file: "tester_udids.txt",
      )
    CODE
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb', line 81

def self.is_supported?(platform)
  [:ios].include?(platform)
end

.run(params) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb', line 16

def self.run(params)
  auth_token = fetch_auth_token(params[:service_credentials_file], params[:firebase_cli_token])
  fad_api_client = Client::FirebaseAppDistributionApiClient.new(auth_token, params[:debug])

  app_id = params[:app]
  udids = fad_api_client.get_udids(app_id)

  if udids.empty?
    UI.important("App Distribution fetched 0 tester UDIDs. Nothing written to output file.")
  else
    write_udids_to_file(udids, params[:output_file])
    UI.success("🎉 App Distribution tester UDIDs written to: #{params[:output_file]}")
  end
end

.write_udids_to_file(udids, output_file) ⇒ Object



31
32
33
34
35
36
37
38
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb', line 31

def self.write_udids_to_file(udids, output_file)
  File.open(output_file, 'w') do |f|
    f.write("Device ID\tDevice Name\tDevice Platform\n")
    udids.each do |tester_udid|
      f.write("#{tester_udid[:udid]}\t#{tester_udid[:name]}\t#{tester_udid[:platform]}\n")
    end
  end
end