fastlane-plugin-firebase_app_distribution 0.2.0.pre.4 → 0.2.2

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: b38b7e0efb3d03f71b9e4476b15304f9ffcddb75cd936acad55f16886222e458
4
- data.tar.gz: '00228e7a41e3d55c4f0271ebbd5bd0aff4a699ec192b8e5e246a7dd271b9b5f3'
3
+ metadata.gz: 752d19a54fda49bb872b2261f6d0e7581ed46ccad397a953982ecc0ee68cbd88
4
+ data.tar.gz: 3f7515214d04448ba4c35968bab899e22c70227c3d88a395675ce5e1642133fc
5
5
  SHA512:
6
- metadata.gz: 64478454789d88e5abdb0b8084e53b6e0d4320315073e59a3a5d789f2a7dde8adb34d79ca102148292977d763148645ad7b15ea2d8caeb21369a8932b9fd4f1e
7
- data.tar.gz: ec77eb9cd77d44ebd4a3f3c6c89a5b3c37f3fc96a2c7bf8fa4ed227cbbca14b5c979583a75d555f2eba25912989d76672e9792eb0fe48cd18b63c56c7fc4b555
6
+ metadata.gz: b27ea27d2828ec061b3e00683107747bf03b488ad06c2168aa41fb6090aa53136a1867bde780a70e7873e7899b580502ae0cc74634f472e48bf729a9211977ac
7
+ data.tar.gz: 5906d0724bcc3159bea048b4657a178774f840ee0c4b516521553c0798b0a5e049c097a73b305db117bdd91ffc4460b6425142742d72738421504e9b75efb7bf
@@ -20,23 +20,14 @@ module Fastlane
20
20
 
21
21
  def self.run(params)
22
22
  params.values # to validate all inputs before looking for the ipa/apk
23
+
24
+ app_id = app_id_from_params(params)
25
+ platform = lane_platform || platform_from_app_id(app_id)
26
+ binary_path = binary_path_from_platform(platform, params[:ipa_path], params[:apk_path])
27
+
23
28
  auth_token = fetch_auth_token(params[:service_credentials_file], params[:firebase_cli_token])
24
- binary_path = params[:ipa_path] || params[:apk_path]
25
- platform = lane_platform || platform_from_path(binary_path)
26
29
  fad_api_client = Client::FirebaseAppDistributionApiClient.new(auth_token, platform)
27
30
 
28
- if params[:app] # Set app_id if it is specified as a parameter
29
- app_id = params[:app]
30
- elsif platform == :ios
31
- archive_path = Actions.lane_context[SharedValues::XCODEBUILD_ARCHIVE]
32
- if archive_path
33
- app_id = get_ios_app_id_from_archive(archive_path)
34
- end
35
- end
36
-
37
- if app_id.nil?
38
- UI.crash!(ErrorMessage::MISSING_APP_ID)
39
- end
40
31
  release_id = fad_api_client.upload(app_id, binary_path, platform.to_s)
41
32
  if release_id.nil?
42
33
  return
@@ -66,20 +57,50 @@ module Fastlane
66
57
  "Release your beta builds with Firebase App Distribution"
67
58
  end
68
59
 
60
+ def self.app_id_from_params(params)
61
+ if params[:app]
62
+ app_id = params[:app]
63
+ elsif xcode_archive_path
64
+ plist_path = params[:googleservice_info_plist_path]
65
+ app_id = get_ios_app_id_from_archive_plist(xcode_archive_path, plist_path)
66
+ end
67
+ if app_id.nil?
68
+ UI.crash!(ErrorMessage::MISSING_APP_ID)
69
+ end
70
+ app_id
71
+ end
72
+
73
+ def self.xcode_archive_path
74
+ # prevents issues on cross-platform build environments where an XCode build happens within
75
+ # the same lane
76
+ return nil if lane_platform == :android
77
+
78
+ Actions.lane_context[SharedValues::XCODEBUILD_ARCHIVE]
79
+ end
80
+
69
81
  def self.lane_platform
70
82
  Actions.lane_context[Actions::SharedValues::PLATFORM_NAME]
71
83
  end
72
84
 
73
- def self.platform_from_path(binary_path)
74
- return nil unless binary_path
75
- case binary_path.split('.').last
76
- when 'ipa'
85
+ def self.platform_from_app_id(app_id)
86
+ if app_id.include?(':ios:')
77
87
  :ios
78
- when 'apk'
88
+ elsif app_id.include?(':android:')
79
89
  :android
80
90
  end
81
91
  end
82
92
 
93
+ def self.binary_path_from_platform(platform, ipa_path, apk_path)
94
+ case platform
95
+ when :ios
96
+ ipa_path
97
+ when :android
98
+ apk_path
99
+ else
100
+ ipa_path || apk_path
101
+ end
102
+ end
103
+
83
104
  def self.available_options
84
105
  if lane_platform == :ios || lane_platform.nil?
85
106
  ipa_path_default = Dir["*.ipa"].sort_by { |x| File.mtime(x) }.last
@@ -100,6 +121,12 @@ module Fastlane
100
121
  verify_block: proc do |value|
101
122
  UI.user_error!("firebase_app_distribution: Couldn't find ipa file at path '#{value}'") unless File.exist?(value)
102
123
  end),
124
+ FastlaneCore::ConfigItem.new(key: :googleservice_info_plist_path,
125
+ env_name: "GOOGLESERVICE_INFO_PLIST_PATH",
126
+ description: "Path to your GoogleService-Info.plist file, relative to the root of your Xcode project",
127
+ default_value: "GoogleService-Info.plist",
128
+ optional: true,
129
+ type: String),
103
130
  # Android Specific
104
131
  FastlaneCore::ConfigItem.new(key: :apk_path,
105
132
  env_name: "FIREBASEAPPDISTRO_APK_PATH",
@@ -89,7 +89,7 @@ module Fastlane
89
89
  if binary_path.nil? || !File.exist?(binary_path)
90
90
  UI.crash!("#{ErrorMessage.binary_not_found(@binary_type)}: #{binary_path}")
91
91
  end
92
- binary_hash = Digest::SHA256.hexdigest(File.open(binary_path).read)
92
+ binary_hash = Digest::SHA256.hexdigest(read_binary(binary_path))
93
93
 
94
94
  begin
95
95
  response = connection.get(v1_apps_url(app_id)) do |request|
@@ -114,7 +114,7 @@ module Fastlane
114
114
  #
115
115
  # Throws a user_error if an invalid app id is passed in, or if the binary file does not exist
116
116
  def upload_binary(app_id, binary_path, platform)
117
- connection.post(binary_upload_url(app_id), File.open(binary_path).read) do |request|
117
+ connection.post(binary_upload_url(app_id), read_binary(binary_path)) do |request|
118
118
  request.headers["Authorization"] = "Bearer " + @auth_token
119
119
  request.headers["X-APP-DISTRO-API-CLIENT-ID"] = "fastlane"
120
120
  request.headers["X-APP-DISTRO-API-CLIENT-TYPE"] = platform
@@ -223,6 +223,11 @@ module Fastlane
223
223
  conn.adapter(Faraday.default_adapter)
224
224
  end
225
225
  end
226
+
227
+ def read_binary(path)
228
+ # File must be read in binary mode to work on Windows
229
+ File.open(path, 'rb').read
230
+ end
226
231
  end
227
232
  end
228
233
  end
@@ -28,10 +28,10 @@ module Fastlane
28
28
  CFPropertyList.native_types(CFPropertyList::List.new(file: path).value)
29
29
  end
30
30
 
31
- def get_ios_app_id_from_archive(path)
32
- app_path = parse_plist("#{path}/Info.plist")["ApplicationProperties"]["ApplicationPath"]
33
- UI.shell_error!("can't extract application path from Info.plist at #{path}") if app_path.empty?
34
- identifier = parse_plist("#{path}/Products/#{app_path}/GoogleService-Info.plist")["GOOGLE_APP_ID"]
31
+ def get_ios_app_id_from_archive_plist(archive_path, plist_path)
32
+ app_path = parse_plist("#{archive_path}/Info.plist")["ApplicationProperties"]["ApplicationPath"]
33
+ UI.shell_error!("can't extract application path from Info.plist at #{archive_path}") if app_path.empty?
34
+ identifier = parse_plist("#{archive_path}/Products/#{app_path}/#{plist_path}")["GOOGLE_APP_ID"]
35
35
  UI.shell_error!("can't extract GOOGLE_APP_ID") if identifier.empty?
36
36
  return identifier
37
37
  end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module FirebaseAppDistribution
3
- VERSION = "0.2.0.pre.4"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,16 +1,16 @@
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.0.pre.4
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Natchev
8
8
  - Manny Jimenez
9
9
  - Alonso Salas Infante
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-09-01 00:00:00.000000000 Z
13
+ date: 2020-09-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: pry
@@ -138,7 +138,7 @@ dependencies:
138
138
  - - ">="
139
139
  - !ruby/object:Gem::Version
140
140
  version: 2.127.1
141
- description:
141
+ description:
142
142
  email:
143
143
  - snatchev@google.com
144
144
  - mannyjimenez@google.com
@@ -162,7 +162,7 @@ homepage: https://github.com/fastlane/fastlane-plugin-firebase_app_distribution
162
162
  licenses:
163
163
  - MIT
164
164
  metadata: {}
165
- post_install_message:
165
+ post_install_message:
166
166
  rdoc_options: []
167
167
  require_paths:
168
168
  - lib
@@ -173,12 +173,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
173
173
  version: '0'
174
174
  required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  requirements:
176
- - - ">"
176
+ - - ">="
177
177
  - !ruby/object:Gem::Version
178
- version: 1.3.1
178
+ version: '0'
179
179
  requirements: []
180
- rubygems_version: 3.1.2
181
- signing_key:
180
+ rubygems_version: 3.1.4
181
+ signing_key:
182
182
  specification_version: 4
183
183
  summary: Release your beta builds to Firebase App Distribution. https://firebase.google.com/docs/app-distribution
184
184
  test_files: []