fastlane 2.121.0.beta.20190418200030 → 2.121.0.beta.20190419200010

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
  SHA1:
3
- metadata.gz: d5921bda2deb026e45486f304d713b971c53d5f1
4
- data.tar.gz: 326352516919d952d0bb569d12f5b59a7e5af4eb
3
+ metadata.gz: edd3f9b8c80196c22a0a1762980b3cfbc0e4045b
4
+ data.tar.gz: 628831a51625a69a33984133a42ee34f906ebdd8
5
5
  SHA512:
6
- metadata.gz: e0dff05c7cb386c762725559fc13f8692497754a87964b61af02849c431877aaa485ac668902a850556c40dea2ba319bfb2286bbd0172489cd5f824974f6c757
7
- data.tar.gz: 7cff8a299efbce1eea540fdd09fa2f2b0c8b422e5c01375d98ba232d62e72df5b8873c3bee0d8585c9f291c93b34cf1965a996d2e3eb6bc66dee3842a7ae248c
6
+ metadata.gz: cf720bdcb105744e8fe67b42fcba0fe8606b26e160b8e97ca64b7e9dba31ddcb37c210b9fac25d2162ab9a6a24d3e4a15cd6e8514bdd942136102180bd5ffee8
7
+ data.tar.gz: b86ece9302ceedc4c38f2e3663f4676394f8eb8d072ea0b4b575212e2108dc7cf82798c91867645bfd009b888f058e27cd7bf1eaebb5d70f95ed3be6cb44d1e8
@@ -153,7 +153,7 @@ module Cert
153
153
  # Create a new certificate signing request
154
154
  csr, pkey = Spaceship.certificate.create_certificate_signing_request
155
155
 
156
- # Use the signing request to create a new distribution certificate
156
+ # Use the signing request to create a new (development|distribution) certificate
157
157
  begin
158
158
  certificate = certificate_type.create!(csr: csr)
159
159
  rescue => ex
@@ -178,25 +178,30 @@ module Deliver
178
178
  def self.device_messages
179
179
  return {
180
180
  ScreenSize::IOS_65_MESSAGES => [
181
- [1242, 2688]
181
+ [1242, 2688],
182
+ [2688, 1242]
182
183
  ],
183
184
  ScreenSize::IOS_61_MESSAGES => [
184
- [828, 1792]
185
+ [828, 1792],
186
+ [1792, 828]
185
187
  ],
186
188
  ScreenSize::IOS_58_MESSAGES => [
187
- [1125, 2436]
189
+ [1125, 2436],
190
+ [2436, 1125]
188
191
  ],
189
192
  ScreenSize::IOS_55_MESSAGES => [
190
- [1080, 1920],
191
- [1242, 2208]
193
+ [1242, 2208],
194
+ [2208, 1242]
192
195
  ],
193
196
  ScreenSize::IOS_47_MESSAGES => [
194
- [750, 1334]
197
+ [750, 1334],
198
+ [1334, 750]
195
199
  ],
196
200
  ScreenSize::IOS_40_MESSAGES => [
197
- [640, 1136],
198
201
  [640, 1096],
199
- [1136, 600] # landscape status bar is smaller
202
+ [640, 1136],
203
+ [1136, 600],
204
+ [1136, 640]
200
205
  ],
201
206
  ScreenSize::IOS_IPAD_MESSAGES => [
202
207
  [1024, 748],
@@ -212,7 +217,7 @@ module Deliver
212
217
  [1668, 2224],
213
218
  [2224, 1668]
214
219
  ],
215
- ScreenSize::IOS_IPAD_11 => [
220
+ ScreenSize::IOS_IPAD_11_MESSAGES => [
216
221
  [1668, 2388],
217
222
  [2388, 1668]
218
223
  ],
@@ -227,30 +232,36 @@ module Deliver
227
232
  def self.devices
228
233
  return {
229
234
  ScreenSize::IOS_65 => [
230
- [1242, 2688]
235
+ [1242, 2688],
236
+ [2688, 1242]
231
237
  ],
232
238
  ScreenSize::IOS_61 => [
233
- [828, 1792]
239
+ [828, 1792],
240
+ [1792, 828]
234
241
  ],
235
242
  ScreenSize::IOS_58 => [
236
- [1125, 2436]
243
+ [1125, 2436],
244
+ [2436, 1125]
237
245
  ],
238
246
  ScreenSize::IOS_55 => [
239
- [1080, 1920],
240
- [1242, 2208]
247
+ [1242, 2208],
248
+ [2208, 1242]
241
249
  ],
242
250
  ScreenSize::IOS_47 => [
243
- [750, 1334]
251
+ [750, 1334],
252
+ [1334, 750]
244
253
  ],
245
254
  ScreenSize::IOS_40 => [
246
- [640, 1136],
247
255
  [640, 1096],
248
- [1136, 600] # landscape without status bar
256
+ [640, 1136],
257
+ [1136, 600],
258
+ [1136, 640]
249
259
  ],
250
260
  ScreenSize::IOS_35 => [
251
- [640, 960],
252
261
  [640, 920],
253
- [960, 600] # landscape without status bar
262
+ [640, 960],
263
+ [960, 600],
264
+ [960, 640]
254
265
  ],
255
266
  ScreenSize::IOS_IPAD => [ # 9.7 inch
256
267
  [1024, 748],
@@ -298,28 +309,12 @@ module Deliver
298
309
 
299
310
  UI.user_error!("Could not find or parse file at path '#{path}'") if size.nil? || size.count == 0
300
311
 
301
- # Walk up two directories and test if we need to handle a platform that doesn't support landscape
302
- path_component = Pathname.new(path).each_filename.to_a[-3]
303
- if path_component.eql?("appleTV")
304
- skip_landscape = true
305
- end
306
-
307
312
  # iMessage screenshots have same resolution as app screenshots so we need to distinguish them
313
+ path_component = Pathname.new(path).each_filename.to_a[-3]
308
314
  devices = path_component.eql?("iMessage") ? self.device_messages : self.devices
309
315
 
310
- devices.each do |device_type, array|
311
- array.each do |resolution|
312
- if skip_landscape
313
- if size[0] == (resolution[0]) && size[1] == (resolution[1]) # portrait
314
- return device_type
315
- end
316
- else
317
- if (size[0] == (resolution[0]) && size[1] == (resolution[1])) || # portrait
318
- (size[1] == (resolution[0]) && size[0] == (resolution[1])) # landscape
319
- return device_type
320
- end
321
- end
322
- end
316
+ devices.each do |screen_size, resolutions|
317
+ return screen_size if resolutions.include?(size)
323
318
  end
324
319
 
325
320
  UI.user_error!("Unsupported screen size #{size} for path '#{path}'")
@@ -21,7 +21,7 @@ module Fastlane
21
21
  def self.get_build_number(params)
22
22
  UI.message("Login to App Store Connect (#{params[:username]})")
23
23
  Spaceship::Tunes.login(params[:username])
24
- Spaceship::Tunes.select_team
24
+ Spaceship::Tunes.select_team(team_id: params[:team_id], team_name: params[:team_name])
25
25
  UI.message("Login successful")
26
26
 
27
27
  app = Spaceship::Tunes::Application.find(params[:app_identifier])
@@ -79,10 +79,7 @@ module Fastlane
79
79
  is_string: false, # as we also allow integers, which we convert to strings anyway
80
80
  code_gen_sensitive: true,
81
81
  default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_id),
82
- default_value_dynamic: true,
83
- verify_block: proc do |value|
84
- ENV["FASTLANE_ITC_TEAM_ID"] = value.to_s
85
- end),
82
+ default_value_dynamic: true),
86
83
  FastlaneCore::ConfigItem.new(key: :team_name,
87
84
  short_option: "-e",
88
85
  env_name: "LATEST_TESTFLIGHT_BUILD_NUMBER_TEAM_NAME",
@@ -90,10 +87,7 @@ module Fastlane
90
87
  optional: true,
91
88
  code_gen_sensitive: true,
92
89
  default_value: CredentialsManager::AppfileConfig.try_fetch_value(:itc_team_name),
93
- default_value_dynamic: true,
94
- verify_block: proc do |value|
95
- ENV["FASTLANE_ITC_TEAM_NAME"] = value.to_s
96
- end)
90
+ default_value_dynamic: true)
97
91
  ]
98
92
  end
99
93
 
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
- VERSION = '2.121.0.beta.20190418200030'.freeze
2
+ VERSION = '2.121.0.beta.20190419200010'.freeze
3
3
  DESCRIPTION = "The easiest way to automate beta deployments and releases for your iOS and Android apps".freeze
4
4
  MINIMUM_XCODE_RELEASE = "7.0".freeze
5
5
  RUBOCOP_REQUIREMENT = '0.49.1'.freeze
@@ -18,13 +18,15 @@ module Spaceship
18
18
  Spaceship::Tunes.login(@username)
19
19
  puts("Successfully logged in to App Store Connect".green)
20
20
  puts("")
21
- rescue
21
+ rescue => ex
22
22
  puts("Could not login to App Store Connect".red)
23
23
  puts("Please check your credentials and try again.".yellow)
24
24
  puts("This could be an issue with App Store Connect,".yellow)
25
25
  puts("Please try unsetting the FASTLANE_SESSION environment variable".yellow)
26
26
  puts("(if it is set) and re-run `fastlane spaceauth`".yellow)
27
- raise "Problem connecting to App Store Connect"
27
+ puts("")
28
+ puts("Execption type: #{ex.class}")
29
+ raise ex
28
30
  end
29
31
 
30
32
  itc_cookie_content = Spaceship::Tunes.client.store_cookie
@@ -44,7 +46,7 @@ module Spaceship
44
46
 
45
47
  # We remove all the un-needed cookies
46
48
  cookies.select! do |cookie|
47
- cookie.name.start_with?("myacinfo") || cookie.name == 'dqsid'
49
+ cookie.name.start_with?("myacinfo") || cookie.name == "dqsid" || cookie.name.start_with?("DES")
48
50
  end
49
51
 
50
52
  yaml = cookies.to_yaml.gsub("\n", "\\n")
@@ -123,14 +123,33 @@ module Spaceship
123
123
  code_length = security_code["length"]
124
124
 
125
125
  puts("")
126
- puts("(Input `sms` to escape this prompt and select a trusted phone number to send the code as a text message)")
127
- code_type = 'trusteddevice'
128
- code = ask("Please enter the #{code_length} digit code:")
129
- body = { "securityCode" => { "code" => code.to_s } }.to_json
126
+ env_2fa_sms_default_phone_number = ENV["SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER"]
130
127
 
131
- if code == 'sms'
128
+ if env_2fa_sms_default_phone_number
129
+ raise Tunes::Error.new, "Environment variable SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER is set, but empty." if env_2fa_sms_default_phone_number.empty?
130
+
131
+ puts("Environment variable `SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER` is set, automatically requesting 2FA token via SMS to that number")
132
+ puts("SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER = #{env_2fa_sms_default_phone_number}")
133
+ puts("")
134
+ phone_number = env_2fa_sms_default_phone_number
135
+ phone_id = phone_id_from_number(response.body["trustedPhoneNumbers"], phone_number)
132
136
  code_type = 'phone'
133
- body = request_two_factor_code_from_phone(response.body["trustedPhoneNumbers"], code_length)
137
+ body = request_two_factor_code_from_phone(phone_id, phone_number, code_length)
138
+ else
139
+ puts("(Input `sms` to escape this prompt and select a trusted phone number to send the code as a text message)")
140
+ puts("")
141
+ puts("(You can also set the environment variable `SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER` to automate this)")
142
+ puts("(Read more at: https://github.com/fastlane/fastlane/blob/master/spaceship/docs/Authentication.md#auto-select-sms-via-spaceship-2fa-sms-default-phone-number)")
143
+ puts("")
144
+ code_type = 'trusteddevice'
145
+ code = ask_for_2fa_code("Please enter the #{code_length} digit code:")
146
+ body = { "securityCode" => { "code" => code.to_s } }.to_json
147
+
148
+ # User exited by entering `sms` and wants to choose phone number for SMS
149
+ if code == 'sms'
150
+ code_type = 'phone'
151
+ body = request_two_factor_code_from_phone_choose(response.body["trustedPhoneNumbers"], code_length)
152
+ end
134
153
  end
135
154
 
136
155
  puts("Requesting session...")
@@ -172,23 +191,68 @@ module Spaceship
172
191
  return true
173
192
  end
174
193
 
175
- def get_id_for_number(phone_numbers, result)
194
+ # extracted into its own method for testing
195
+ def ask_for_2fa_code(text)
196
+ ask(text)
197
+ end
198
+
199
+ def phone_id_from_number(phone_numbers, phone_number)
200
+ characters_to_remove_from_phone_numbers = ' \-()"'
201
+
202
+ # start with e.g. +49 162 1234585 or +1-123-456-7866
203
+ phone_number = phone_number.tr(characters_to_remove_from_phone_numbers, '')
204
+ # cleaned: +491621234585 or +11234567866
205
+
206
+ phone_numbers.each do |phone|
207
+ # rubocop:disable Style/AsciiComments
208
+ # start with: +49 •••• •••••85 or +1 (•••) •••-••66
209
+ number_with_dialcode_masked = phone['numberWithDialCode'].tr(characters_to_remove_from_phone_numbers, '')
210
+ # cleaned: +49•••••••••85 or +1••••••••66
211
+ # rubocop:enable Style/AsciiComments
212
+
213
+ maskings_count = number_with_dialcode_masked.count('•') # => 9 or 8
214
+ pattern = /^([0-9+]{2,4})([•]{#{maskings_count}})([0-9]{2})$/
215
+ replacement = "\\1([0-9]{#{maskings_count - 1},#{maskings_count}})\\3"
216
+ number_with_dialcode_regex_part = number_with_dialcode_masked.gsub(pattern, replacement)
217
+ # => +49([0-9]{8,9})85 or +1([0-9]{7,8})66
218
+
219
+ backslash = '\\'
220
+ number_with_dialcode_regex_part = backslash + number_with_dialcode_regex_part
221
+ number_with_dialcode_regex = /^#{number_with_dialcode_regex_part}$/
222
+ # => /^\+49([0-9]{8})85$/ or /^\+1([0-9]{7,8})66$/
223
+
224
+ return phone['id'] if phone_number =~ number_with_dialcode_regex
225
+ # +491621234585 matches /^\+49([0-9]{8})85$/
226
+ end
227
+
228
+ # Handle case of phone_number not existing in phone_numbers because ENV var is wrong or matcher is broken
229
+ raise Tunes::Error.new, %(
230
+ Could not find a matching phone number to #{phone_number} in #{phone_numbers}.
231
+ Make sure your environment variable is set to the correct phone number.
232
+ If it is, please open an issue at https://github.com/fastlane/fastlane/issues/new and include this output so we can fix our matcher. Thanks.
233
+ )
234
+ end
235
+
236
+ def phone_id_from_masked_number(phone_numbers, masked_number)
176
237
  phone_numbers.each do |phone|
177
- phone_id = phone['id']
178
- return phone_id if phone['numberWithDialCode'] == result
238
+ return phone['id'] if phone['numberWithDialCode'] == masked_number
179
239
  end
180
240
  end
181
241
 
182
- def request_two_factor_code_from_phone(phone_numbers, code_length)
242
+ def request_two_factor_code_from_phone_choose(phone_numbers, code_length)
183
243
  puts("Please select a trusted phone number to send code to:")
184
244
 
185
245
  available = phone_numbers.collect do |current|
186
246
  current['numberWithDialCode']
187
247
  end
188
- result = choose(*available)
248
+ chosen = choose(*available)
249
+ phone_id = phone_id_from_masked_number(phone_numbers, chosen)
189
250
 
190
- phone_id = get_id_for_number(phone_numbers, result)
251
+ request_two_factor_code_from_phone(phone_id, chosen, code_length)
252
+ end
191
253
 
254
+ # this is used in two places: after choosing a phone number and when a phone number is set via ENV var
255
+ def request_two_factor_code_from_phone(phone_id, phone_number, code_length)
192
256
  # Request code
193
257
  r = request(:put) do |req|
194
258
  req.url("https://idmsa.apple.com/appleauth/auth/verify/phone")
@@ -201,10 +265,11 @@ module Spaceship
201
265
  # since this might be from the Dev Portal, but for 2 step
202
266
  Spaceship::TunesClient.new.handle_itc_response(r.body)
203
267
 
204
- puts("Successfully requested text message")
268
+ puts("Successfully requested text message to #{phone_number}")
269
+
270
+ code = ask_for_2fa_code("Please enter the #{code_length} digit code you received at #{phone_number}:")
205
271
 
206
- code = ask("Please enter the #{code_length} digit code you received at #{result}:")
207
- { "securityCode" => { "code" => code.to_s }, "phoneNumber" => { "id" => phone_id }, "mode" => "sms" }.to_json
272
+ return { "securityCode" => { "code" => code.to_s }, "phoneNumber" => { "id" => phone_id }, "mode" => "sms" }.to_json
208
273
  end
209
274
 
210
275
  def store_session
@@ -13,6 +13,7 @@ require_relative 'spaceship/tunes/tunes'
13
13
  require_relative 'spaceship/tunes/spaceship'
14
14
  require_relative 'spaceship/test_flight'
15
15
  require_relative 'spaceship/connect_api'
16
+ require_relative 'spaceship/spaceauth_runner'
16
17
 
17
18
  require_relative 'spaceship/module'
18
19
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.121.0.beta.20190418200030
4
+ version: 2.121.0.beta.20190419200010
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohki Miki
@@ -27,7 +27,7 @@ authors:
27
27
  autorequire:
28
28
  bindir: bin
29
29
  cert_chain: []
30
- date: 2019-04-18 00:00:00.000000000 Z
30
+ date: 2019-04-19 00:00:00.000000000 Z
31
31
  dependencies:
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: slack-notifier
@@ -1688,24 +1688,24 @@ metadata:
1688
1688
  post_install_message:
1689
1689
  rdoc_options: []
1690
1690
  require_paths:
1691
- - spaceship/lib
1691
+ - match/lib
1692
+ - precheck/lib
1693
+ - pem/lib
1694
+ - deliver/lib
1695
+ - fastlane_core/lib
1692
1696
  - snapshot/lib
1697
+ - cert/lib
1693
1698
  - fastlane/lib
1694
- - credentials_manager/lib
1695
- - frameit/lib
1696
- - supply/lib
1697
1699
  - produce/lib
1698
- - pem/lib
1699
- - cert/lib
1700
- - deliver/lib
1700
+ - supply/lib
1701
1701
  - screengrab/lib
1702
- - pilot/lib
1703
1702
  - sigh/lib
1704
- - precheck/lib
1705
- - gym/lib
1706
- - match/lib
1707
- - fastlane_core/lib
1708
1703
  - scan/lib
1704
+ - spaceship/lib
1705
+ - credentials_manager/lib
1706
+ - pilot/lib
1707
+ - gym/lib
1708
+ - frameit/lib
1709
1709
  required_ruby_version: !ruby/object:Gem::Requirement
1710
1710
  requirements:
1711
1711
  - - ">="