spaceship 0.31.8 → 0.31.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/spaceship/client.rb +7 -6
- data/lib/spaceship/portal/portal_client.rb +38 -22
- data/lib/spaceship/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3007b65bb9eddd5604158b7c809a0e6f05c4e8d6
|
4
|
+
data.tar.gz: 50ade9d99cea43718791fa7f48fa6f2855e91851
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c353f411cbd5de26fa6187889de6ebb47192f1e7a2fd151ebe3232adc4b171288716530ce89c155335b3379a94eeaff9a3cea0b4139bbca16b5a9f47d3b5cac
|
7
|
+
data.tar.gz: 8d05c8f60cfa4b79c21e63f56b7bdac0d8bee1a5d38067aa641491875941207ea311c21bc91dd17e74ffe9c4714dfe7ee673785aa633522e82d29dfe02dbc9db
|
data/lib/spaceship/client.rb
CHANGED
@@ -28,6 +28,8 @@ module Spaceship
|
|
28
28
|
# /tmp/spaceship[time]_[pid].log by default
|
29
29
|
attr_accessor :logger
|
30
30
|
|
31
|
+
attr_accessor :csrf_tokens
|
32
|
+
|
31
33
|
# Base class for errors that want to present their message as
|
32
34
|
# preferred error info for fastlane error handling. See:
|
33
35
|
# fastlane_core/lib/fastlane_core/ui/fastlane_runner.rb
|
@@ -345,11 +347,15 @@ module Spaceship
|
|
345
347
|
raise ex # re-raise the exception
|
346
348
|
end
|
347
349
|
|
350
|
+
# memorize the last csrf tokens from responses
|
351
|
+
def csrf_tokens
|
352
|
+
@csrf_tokens || {}
|
353
|
+
end
|
354
|
+
|
348
355
|
private
|
349
356
|
|
350
357
|
def do_login(user, password)
|
351
358
|
@loggedin = false
|
352
|
-
@requested_csrf_token = nil
|
353
359
|
ret = send_login_request(user, password) # different in subclasses
|
354
360
|
@loggedin = true
|
355
361
|
ret
|
@@ -365,11 +371,6 @@ module Spaceship
|
|
365
371
|
end
|
366
372
|
end
|
367
373
|
|
368
|
-
# memorize the last csrf tokens from responses
|
369
|
-
def csrf_tokens
|
370
|
-
@csrf_tokens || {}
|
371
|
-
end
|
372
|
-
|
373
374
|
def request(method, url_or_path = nil, params = nil, headers = {}, &block)
|
374
375
|
headers.merge!(csrf_tokens)
|
375
376
|
headers['User-Agent'] = USER_AGENT
|
@@ -1,4 +1,5 @@
|
|
1
1
|
module Spaceship
|
2
|
+
# rubocop:disable Metrics/ClassLength
|
2
3
|
class PortalClient < Spaceship::Client
|
3
4
|
#####################################################
|
4
5
|
# @!group Init and Login
|
@@ -129,7 +130,7 @@ module Spaceship
|
|
129
130
|
end
|
130
131
|
|
131
132
|
def update_service_for_app(app, service)
|
132
|
-
ensure_csrf
|
133
|
+
ensure_csrf(Spaceship::App)
|
133
134
|
|
134
135
|
request(:post, service.service_uri, {
|
135
136
|
teamId: team_id,
|
@@ -142,7 +143,7 @@ module Spaceship
|
|
142
143
|
end
|
143
144
|
|
144
145
|
def associate_groups_with_app(app, groups)
|
145
|
-
ensure_csrf
|
146
|
+
ensure_csrf(Spaceship::AppGroup)
|
146
147
|
|
147
148
|
request(:post, 'account/ios/identifiers/assignApplicationGroupToAppId.action', {
|
148
149
|
teamId: team_id,
|
@@ -158,7 +159,7 @@ module Spaceship
|
|
158
159
|
# We moved the ensure_csrf to the top of this method
|
159
160
|
# as we got some users with issues around creating new apps
|
160
161
|
# https://github.com/fastlane/fastlane/issues/5813
|
161
|
-
ensure_csrf
|
162
|
+
ensure_csrf(Spaceship::App)
|
162
163
|
|
163
164
|
ident_params = case type.to_sym
|
164
165
|
when :explicit
|
@@ -188,6 +189,8 @@ module Spaceship
|
|
188
189
|
end
|
189
190
|
|
190
191
|
def delete_app!(app_id, mac: false)
|
192
|
+
ensure_csrf(Spaceship::App)
|
193
|
+
|
191
194
|
r = request(:post, "account/#{platform_slug(mac)}/identifiers/deleteAppId.action", {
|
192
195
|
teamId: team_id,
|
193
196
|
appIdId: app_id
|
@@ -212,7 +215,7 @@ module Spaceship
|
|
212
215
|
end
|
213
216
|
|
214
217
|
def create_app_group!(name, group_id)
|
215
|
-
ensure_csrf
|
218
|
+
ensure_csrf(Spaceship::AppGroup)
|
216
219
|
|
217
220
|
r = request(:post, 'account/ios/identifiers/addApplicationGroup.action', {
|
218
221
|
name: name,
|
@@ -223,7 +226,7 @@ module Spaceship
|
|
223
226
|
end
|
224
227
|
|
225
228
|
def delete_app_group!(app_group_id)
|
226
|
-
ensure_csrf
|
229
|
+
ensure_csrf(Spaceship::AppGroup)
|
227
230
|
|
228
231
|
r = request(:post, 'account/ios/identifiers/deleteApplicationGroup.action', {
|
229
232
|
teamId: team_id,
|
@@ -262,7 +265,7 @@ module Spaceship
|
|
262
265
|
end
|
263
266
|
|
264
267
|
def create_device!(device_name, device_id, mac: false)
|
265
|
-
ensure_csrf
|
268
|
+
ensure_csrf(Spaceship::Device)
|
266
269
|
|
267
270
|
req = request(:post) do |r|
|
268
271
|
r.url "https://developerservices2.apple.com/services/#{PROTOCOL_VERSION}/#{platform_slug(mac)}/addDevice.action"
|
@@ -294,7 +297,7 @@ module Spaceship
|
|
294
297
|
end
|
295
298
|
|
296
299
|
def create_certificate!(type, csr, app_id = nil)
|
297
|
-
ensure_csrf
|
300
|
+
ensure_csrf(Spaceship::Certificate)
|
298
301
|
|
299
302
|
r = request(:post, 'account/ios/certificate/submitCertificateRequest.action', {
|
300
303
|
teamId: team_id,
|
@@ -322,7 +325,7 @@ module Spaceship
|
|
322
325
|
end
|
323
326
|
|
324
327
|
def revoke_certificate!(certificate_id, type, mac: false)
|
325
|
-
ensure_csrf
|
328
|
+
ensure_csrf(Spaceship::Certificate)
|
326
329
|
|
327
330
|
r = request(:post, "account/#{platform_slug(mac)}/certificate/revokeCertificate.action", {
|
328
331
|
teamId: team_id,
|
@@ -350,7 +353,9 @@ module Spaceship
|
|
350
353
|
end
|
351
354
|
|
352
355
|
def create_provisioning_profile!(name, distribution_method, app_id, certificate_ids, device_ids, mac: false, sub_platform: nil)
|
353
|
-
|
356
|
+
# Calling provisioning_profiles uses a different api end point than creating or deleting them so we
|
357
|
+
# use a different entity to gather the csrf token
|
358
|
+
ensure_csrf(Spaceship::App)
|
354
359
|
|
355
360
|
params = {
|
356
361
|
teamId: team_id,
|
@@ -380,7 +385,9 @@ module Spaceship
|
|
380
385
|
end
|
381
386
|
|
382
387
|
def delete_provisioning_profile!(profile_id, mac: false)
|
383
|
-
|
388
|
+
# Calling provisioning_profiles uses a different api end point than creating or deleting them so we
|
389
|
+
# use a different entity to gather the csrf token
|
390
|
+
ensure_csrf(Spaceship::App)
|
384
391
|
|
385
392
|
r = request(:post, "account/#{platform_slug(mac)}/profile/deleteProvisioningProfile.action", {
|
386
393
|
teamId: team_id,
|
@@ -390,7 +397,9 @@ module Spaceship
|
|
390
397
|
end
|
391
398
|
|
392
399
|
def repair_provisioning_profile!(profile_id, name, distribution_method, app_id, certificate_ids, device_ids, mac: false)
|
393
|
-
|
400
|
+
# Calling provisioning_profiles uses a different api end point than creating or deleting them so we
|
401
|
+
# use a different entity to gather the csrf token
|
402
|
+
ensure_csrf(Spaceship::App)
|
394
403
|
|
395
404
|
r = request(:post, "account/#{platform_slug(mac)}/profile/regenProvisioningProfile.action", {
|
396
405
|
teamId: team_id,
|
@@ -407,27 +416,34 @@ module Spaceship
|
|
407
416
|
|
408
417
|
private
|
409
418
|
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
419
|
+
# This is a cache of entity type (App, AppGroup, Certificate, Device) to csrf_tokens
|
420
|
+
def csrf_cache
|
421
|
+
@csrf_cache || {}
|
422
|
+
end
|
423
|
+
|
424
|
+
# Ensures that there are csrf tokens for the appropriate entity type
|
425
|
+
# Relies on store_csrf_tokens to set csrf_tokens to the appropriate value
|
426
|
+
# then stores that in the correct place in cache
|
427
|
+
def ensure_csrf(klass)
|
428
|
+
if csrf_cache[klass]
|
429
|
+
self.csrf_tokens = csrf_cache[klass]
|
430
|
+
return
|
431
|
+
end
|
414
432
|
|
415
|
-
|
416
|
-
# Instead of calling `Certificate::Production.all` we call `App.all`
|
417
|
-
# We've had issues when we only requested certificates, instead of apps, we don't know why
|
418
|
-
# Source: https://github.com/fastlane/fastlane/issues/5827
|
433
|
+
self.csrf_tokens = nil
|
419
434
|
|
420
435
|
# If we directly create a new resource (e.g. app) without querying anything before
|
421
436
|
# we don't have a valid csrf token, that's why we have to do at least one request
|
422
|
-
|
437
|
+
klass.all
|
423
438
|
|
424
439
|
# Update 18th August 2016
|
425
440
|
# For some reason, we have to query the resource twice to actually get a valid csrf_token
|
426
441
|
# I couldn't find out why, the first response does have a valid Set-Cookie header
|
427
442
|
# But it still needs this second request
|
428
|
-
|
443
|
+
klass.all
|
429
444
|
|
430
|
-
|
445
|
+
csrf_cache[klass] = self.csrf_tokens
|
431
446
|
end
|
432
447
|
end
|
448
|
+
# rubocop:enable Metrics/ClassLength
|
433
449
|
end
|
data/lib/spaceship/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spaceship
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.31.
|
4
|
+
version: 0.31.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Krause
|
@@ -391,7 +391,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
391
391
|
version: '0'
|
392
392
|
requirements: []
|
393
393
|
rubyforge_project:
|
394
|
-
rubygems_version: 2.
|
394
|
+
rubygems_version: 2.2.2
|
395
395
|
signing_key:
|
396
396
|
specification_version: 4
|
397
397
|
summary: Ruby library to access the Apple Dev Center and iTunes Connect
|