fastlane-plugin-firebase_app_distribution 0.2.6.pre.1 → 0.2.7.pre.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d129a8d78fc5bca84c4e7484dbe02436ee9cd4ef9e9005bec4e1646401b9b143
4
- data.tar.gz: 1677a9d201117796c171ed8a0a9472b69bc8b763bdd5492e3a3fd8f3dae19d84
3
+ metadata.gz: 0dd23e1de2dae2e5f5850fa7414c6a932928af90781cd56485da7c2d4370a5a8
4
+ data.tar.gz: 5abfd7e129b05ab490891897b929630722d1bcd56ea63116fd79039e0dba5280
5
5
  SHA512:
6
- metadata.gz: 1c6e3502a696a1d759f838028812a526745e6d11fe678e26a829ead65fd8114b4244565695d338b1d60ef34cb1129b70948e87c8d297c72334abc46e9bbc20ec
7
- data.tar.gz: 47504b8df8a313b588aea6c5fa8b7d8cebc5d7ea66117c0025b73f53e6f529bbc443e395c66baa357248c81b864ed81f5cfe46cd957c42c92d03e63e16cbc89a
6
+ metadata.gz: cf0143e56cc2372aa3e8d42ad67da516d8e87ab4aca60df3ecb2fc940226b905e53e4d3c0c68092bd72f5ec0b7bbc02511e6ad7a7b4065dca2a80c18146d18fb
7
+ data.tar.gz: ed1a2489b9aead9cad18f11354c120f36706f18893899ece435b494d78ddf51f3db0885210b26b1a9be3becdfe5f0ec078879b9f5eb8a931bf3edd8293bd8c16
@@ -0,0 +1,97 @@
1
+ require 'fastlane/action'
2
+ require 'open3'
3
+ require 'shellwords'
4
+ require 'googleauth'
5
+ require_relative '../helper/firebase_app_distribution_helper'
6
+ require_relative '../helper/firebase_app_distribution_error_message'
7
+ require_relative '../client/firebase_app_distribution_api_client'
8
+ require_relative '../helper/firebase_app_distribution_auth_client'
9
+
10
+ module Fastlane
11
+ module Actions
12
+ class FirebaseAppDistributionGetUdidsAction < Action
13
+ extend Auth::FirebaseAppDistributionAuthClient
14
+ extend Helper::FirebaseAppDistributionHelper
15
+
16
+ def self.run(params)
17
+ auth_token = fetch_auth_token(params[:service_credentials_file], params[:firebase_cli_token])
18
+ fad_api_client = Client::FirebaseAppDistributionApiClient.new(auth_token, params[:debug])
19
+
20
+ app_id = params[:app]
21
+ udids = fad_api_client.get_udids(app_id)
22
+
23
+ if udids.empty?
24
+ UI.important("App Distribution fetched 0 tester UDIDs. Nothing written to output file.")
25
+ else
26
+ write_udids_to_file(udids, params[:output_file])
27
+ UI.success("🎉 App Distribution tester UDIDs written to: #{params[:output_file]}")
28
+ end
29
+ end
30
+
31
+ def self.write_udids_to_file(udids, output_file)
32
+ File.open(output_file, 'w') do |f|
33
+ f.write("Device ID\tDevice Name\tDevice Platform\n")
34
+ udids.each do |tester_udid|
35
+ f.write("#{tester_udid[:udid]}\t#{tester_udid[:name]}\t#{tester_udid[:platform]}\n")
36
+ end
37
+ end
38
+ end
39
+
40
+ def self.description
41
+ "Download the UDIDs of your Firebase App Distribution testers"
42
+ end
43
+
44
+ def self.authors
45
+ ["Lee Kellogg"]
46
+ end
47
+
48
+ # supports markdown.
49
+ def self.details
50
+ "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."
51
+ end
52
+
53
+ def self.available_options
54
+ [
55
+ FastlaneCore::ConfigItem.new(key: :app,
56
+ env_name: "FIREBASEAPPDISTRO_APP",
57
+ description: "Your app's Firebase App ID. You can find the App ID in the Firebase console, on the General Settings page",
58
+ optional: false,
59
+ type: String),
60
+ FastlaneCore::ConfigItem.new(key: :output_file,
61
+ env_name: "FIREBASEAPPDISTRO_OUTPUT_FILE",
62
+ description: "The path to the file where the tester UDIDs will be written",
63
+ optional: false,
64
+ type: String),
65
+ FastlaneCore::ConfigItem.new(key: :firebase_cli_token,
66
+ description: "Auth token for firebase cli",
67
+ optional: true,
68
+ type: String),
69
+ FastlaneCore::ConfigItem.new(key: :service_credentials_file,
70
+ description: "Path to Google service account json",
71
+ optional: true,
72
+ type: String),
73
+ FastlaneCore::ConfigItem.new(key: :debug,
74
+ description: "Print verbose debug output",
75
+ optional: true,
76
+ default_value: false,
77
+ is_string: false)
78
+ ]
79
+ end
80
+
81
+ def self.is_supported?(platform)
82
+ [:ios].include?(platform)
83
+ end
84
+
85
+ def self.example_code
86
+ [
87
+ <<-CODE
88
+ firebase_app_distribution_get_udids(
89
+ app: "1:1234567890:ios:0a1b2c3d4e5f67890",
90
+ output_file: "tester_udids.txt",
91
+ )
92
+ CODE
93
+ ]
94
+ end
95
+ end
96
+ end
97
+ end
@@ -180,6 +180,23 @@ module Fastlane
180
180
  return UploadStatusResponse.new(response.body)
181
181
  end
182
182
 
183
+ # Get tester UDIDs
184
+ #
185
+ # args
186
+ # app_id - Firebase App ID
187
+ #
188
+ # Returns a list of hashes containing tester device info
189
+ def get_udids(app_id)
190
+ begin
191
+ response = connection.get(get_udids_url(app_id)) do |request|
192
+ request.headers[AUTHORIZATION] = "Bearer " + @auth_token
193
+ end
194
+ rescue Faraday::ResourceNotFound
195
+ UI.user_error!("#{ErrorMessage::INVALID_APP_ID}: #{app_id}")
196
+ end
197
+ response.body[:testerUdids] || []
198
+ end
199
+
183
200
  private
184
201
 
185
202
  def v1_apps_url(app_id)
@@ -202,6 +219,10 @@ module Fastlane
202
219
  "#{v1_apps_url(app_id)}/upload_status/#{app_token}"
203
220
  end
204
221
 
222
+ def get_udids_url(app_id)
223
+ "#{v1_apps_url(app_id)}/testers:getTesterUdids"
224
+ end
225
+
205
226
  def get_upload_token(project_number, app_id, binary_path)
206
227
  binary_hash = Digest::SHA256.hexdigest(read_binary(binary_path))
207
228
  CGI.escape("projects/#{project_number}/apps/#{app_id}/releases/-/binaries/#{binary_hash}")
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module FirebaseAppDistribution
3
- VERSION = "0.2.6.pre.1"
3
+ VERSION = "0.2.7.pre.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-firebase_app_distribution
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6.pre.1
4
+ version: 0.2.7.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Natchev
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-03-08 00:00:00.000000000 Z
13
+ date: 2021-03-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: pry
@@ -151,6 +151,7 @@ files:
151
151
  - README.md
152
152
  - lib/fastlane/plugin/firebase_app_distribution.rb
153
153
  - lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_action.rb
154
+ - lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_get_udids.rb
154
155
  - lib/fastlane/plugin/firebase_app_distribution/actions/firebase_app_distribution_login.rb
155
156
  - lib/fastlane/plugin/firebase_app_distribution/client/aab_certificate.rb
156
157
  - lib/fastlane/plugin/firebase_app_distribution/client/app.rb
@@ -180,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
181
  - !ruby/object:Gem::Version
181
182
  version: 1.3.1
182
183
  requirements: []
183
- rubygems_version: 3.1.4
184
+ rubygems_version: 3.0.3
184
185
  signing_key:
185
186
  specification_version: 4
186
187
  summary: Release your beta builds to Firebase App Distribution. https://firebase.google.com/docs/app-distribution