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::CLIENT_ID, Fastlane::Auth::FirebaseAppDistributionAuthClient::CLIENT_SECRET, Fastlane::Auth::FirebaseAppDistributionAuthClient::REDACTION_CHARACTER, Fastlane::Auth::FirebaseAppDistributionAuthClient::REDACTION_EXPOSED_LENGTH, Fastlane::Auth::FirebaseAppDistributionAuthClient::SCOPE, Fastlane::Auth::FirebaseAppDistributionAuthClient::TOKEN_CREDENTIAL_URI

Class Method Summary collapse

Methods included from Fastlane::Auth::FirebaseAppDistributionAuthClient

get_authorization

Methods included from Helper::FirebaseAppDistributionHelper

app_name_from_app_id, binary_type_from_path, blank?, deep_symbolize_keys, get_ios_app_id_from_archive_plist, get_value_from_value_or_file, group_name, init_client, init_v1_client, init_v1alpha_client, parse_plist, present?, project_name, project_number_from_app_id, string_to_array

Class Method Details

.authorsObject



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

def self.authors
  ["Lee Kellogg"]
end

.available_optionsObject



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb', line 58

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :project_number,
                                 conflicting_options: [:app],
                                 env_name: "FIREBASEAPPDISTRO_PROJECT_NUMBER",
                                 description: "Your Firebase project number. You can find the project number in the Firebase console, on the General Settings page",
                                 type: Integer,
                                 optional: true),
    FastlaneCore::ConfigItem.new(key: :app,
                                 conflicting_options: [:project_number],
                                 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: true,
                                 deprecated: "Use project_number (FIREBASEAPPDISTRO_PROJECT_NUMBER) instead",
                                 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 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



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

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

.detailsObject

supports markdown.



54
55
56
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb', line 54

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



98
99
100
101
102
103
104
105
106
107
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb', line 98

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

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb', line 94

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

.run(params) ⇒ Object



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

def self.run(params)
  client = init_v1alpha_client(params[:service_credentials_file], params[:firebase_cli_token], params[:debug])

  project_number = params[:project_number]
  if blank?(project_number)
    app_id = params[:app]
    if blank?(app_id)
      UI.user_error!("Must specify `project_number`.")
    end
    project_number = project_number_from_app_id(app_id)
  end
  udids = client.get_project_tester_udids(project_name(project_number)).tester_udids

  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



36
37
38
39
40
41
42
43
# File 'lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb', line 36

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