spaceship 0.32.4 → 0.33.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c1ed1ed0e0ca3f83e0938bfef281e22c419dda58
4
- data.tar.gz: 671c565c25a2f2f36471ad8a11409a6f2d857067
3
+ metadata.gz: 6527cb5f13885b7110623e37d316ad0b3e24bac3
4
+ data.tar.gz: d0f1215849af1de633648dff9051dce6fd0f61c0
5
5
  SHA512:
6
- metadata.gz: cd6289e6ba47c42d84ed2f6e077f891510b4c03538e3d786a434610755768ef995f34aa87846e5c8a454fc4bb86e267971d3724276f5e0a87dbc45653446bee1
7
- data.tar.gz: cd6b1a3daa56dbc8ab755e8f49ca653c2992988572e586c521e111b98c85d9d4ff11459f98051becb66891a0c4e61fad3a17b59039eb65c51af84a90a5ea23a0
6
+ metadata.gz: 13b7d83d1a90279d13bd8b3eb5a0e08eee363f04c37cfac8bcfc318e7de17a93d24923dea9ce203020b7d37d70b0cf7a9a3f2d53246b1153c97b01a3a6f2e1b4
7
+ data.tar.gz: 28e7c27957dce185f925de0575aa60779f1124dc1d0b060bd41ac7fe4716e5fafad4e040a59ff37d3bc18c4873a1c2d997a46bae7efeed36d9b565d34b2af628
data/README.md CHANGED
@@ -185,19 +185,6 @@ I won't go into too much technical details about the various API endpoints, but
185
185
  - **Profile Magic**: Create and upload code signing requests, all managed by `spaceship`
186
186
  - **Multiple Spaceship**: You can launch multiple `spaceships` with different Apple accounts to do things like syncing the registered devices.
187
187
 
188
- # Credits
189
-
190
- The initial release was sponsored by [ZeroPush](https://zeropush.com).
191
-
192
- `spaceship` was developed by
193
- - [@KrauseFx](https://twitter.com/KrauseFx).
194
- - [@snatchev](https://twitter.com/snatchev/)
195
- - [@mathcarignani](https://twitter.com/mathcarignani/)
196
-
197
- [Open full list of contributors](https://github.com/fastlane/spaceship/graphs/contributors).
198
-
199
- ##### [Like this tool? Be the first to know about updates and new fastlane tools](https://tinyletter.com/krausefx)
200
-
201
188
  # Code of Conduct
202
189
  Help us keep `fastlane` open and inclusive. Please read and follow our [Code of Conduct](https://github.com/fastlane/fastlane/blob/master/CODE_OF_CONDUCT.md).
203
190
 
data/bin/spaceauth ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env ruby
2
+ $LOAD_PATH.push File.expand_path("../../lib", __FILE__)
3
+ require "colored"
4
+
5
+ # First we have to check if the user has `pry` installed
6
+ # We don't want to add pry as a spaceship dependency, as
7
+ # it shouldn't really be added to production systems
8
+
9
+ require "spaceship"
10
+ require "credentials_manager"
11
+
12
+ username = ARGV[1] if ARGV[0] == '-u'
13
+ username ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
14
+ username ||= ask("Username: ")
15
+
16
+ begin
17
+ puts "Logging into to iTunes Connect (#{username})..."
18
+ Spaceship::Tunes.login(username)
19
+ puts "Successfully logged in to iTunes Connect".green
20
+ puts ""
21
+ rescue
22
+ puts "Could not login to iTunes Connect...".red
23
+ end
24
+
25
+ itc_cookie_content = Spaceship::Tunes.client.store_cookie
26
+
27
+ # The only value we actually need is the "DES5c148586daa451e55afb017aa62418f91" cookie
28
+ # We're not sure if the key changes
29
+ #
30
+ # Example:
31
+ # name: DES5c148586daa451e55afb017aa62418f91
32
+ # value: HSARMTKNSRVTWFlaF/ek8asaa9lymMA0dN8JQ6pY7B3F5kdqTxJvMT19EVEFX8EQudB/uNwBHOHzaa30KYTU/eCP/UF7vGTgxs6PAnlVWKscWssOVHfP2IKWUPaa4Dn+I6ilA7eAFQsiaaVT
33
+
34
+ require 'yaml'
35
+ cookies = YAML.load(itc_cookie_content)
36
+
37
+ # We remove all the un-needed cookies
38
+ cookies.delete_if do |current|
39
+ ['aa', 'X-SESS', 'site', 'acn01', 'myacinfo', 'itctx', 'wosid', 'woinst', 'NSC_17ofu-jud-jud-mc'].include?(current.name)
40
+ end
41
+
42
+ yaml = cookies.to_yaml.gsub("\n", "\\n")
43
+
44
+ puts "---"
45
+ puts ""
46
+ puts "Pass the following via the FASTLANE_SESSION environment variable:"
47
+ puts yaml.cyan.underline
48
+ puts ""
49
+ puts ""
50
+ puts "Example:"
51
+ puts "export FASTLANE_SESSION='#{yaml}'".cyan.underline
@@ -331,6 +331,9 @@ module Spaceship
331
331
  File.write(itc_service_key_path, @service_key)
332
332
 
333
333
  return @service_key
334
+ rescue => ex
335
+ puts ex.to_s
336
+ raise AppleTimeoutError.new, "Could not receive latest API key from iTunes Connect, this might be a server issue."
334
337
  end
335
338
 
336
339
  #####################################################
@@ -152,22 +152,12 @@ module Spaceship
152
152
  # Create a new object based on a hash.
153
153
  # This is used to create a new object based on the server response.
154
154
  def factory(attrs)
155
- # Ad Hoc Profiles look exactly like App Store profiles, but usually include devices
156
- profile_details = client.provisioning_profile_details(provisioning_profile_id: attrs["provisioningProfileId"])
157
-
158
- # The only difference between App Store and Ad Hoc provisioniong profile is the devices that are attached
159
- if attrs['distributionMethod'] == 'store' && (profile_details['devices'] || []).size > 0
160
- attrs['distributionMethod'] = 'adhoc'
161
- end
162
155
  # available values of `distributionMethod` at this point: ['adhoc', 'store', 'limited']
163
-
164
156
  klass = case attrs['distributionMethod']
165
157
  when 'limited'
166
158
  Development
167
159
  when 'store'
168
160
  AppStore
169
- when 'adhoc'
170
- AdHoc
171
161
  when 'inhouse'
172
162
  InHouse
173
163
  else
@@ -180,23 +170,6 @@ module Spaceship
180
170
  klass.client = @client
181
171
  obj = klass.new(attrs)
182
172
 
183
- # Set the response of the details request, in case we want to access it later on
184
- obj.profile_details = profile_details
185
-
186
- # Since 15th September 2016 certificates and devices are hidden behind another request
187
- # see https://github.com/fastlane/fastlane/issues/6137 for more information
188
- # That's why we set it here
189
-
190
- # Parse all the devices from the details request
191
- obj.devices = (profile_details["devices"] || []).collect do |device|
192
- Device.set_client(client).factory(device)
193
- end
194
-
195
- # Parse all the certificates from the details request
196
- obj.certificates = (profile_details["certificates"] || []).collect do |cert|
197
- Certificate.set_client(client).factory(cert)
198
- end
199
-
200
173
  return obj
201
174
  end
202
175
 
@@ -279,9 +252,20 @@ module Spaceship
279
252
 
280
253
  return profiles if self == ProvisioningProfile
281
254
 
255
+ # To distinguish between AppStore and AdHoc profiles, we need to send
256
+ # a details request (see `fetch_details`). This is an expensive operation
257
+ # which we can't do for every single provisioning profile
258
+ # Instead we'll treat App Store profiles the same way as Ad Hoc profiles
259
+ # Spaceship::ProvisioningProfile::AdHoc.all will return the same array as
260
+ # Spaceship::ProvisioningProfile::AppStore.all, containing only AppStore
261
+ # profiles. To determine if it's an Ad Hoc profile, you can use the
262
+ # is_adhoc? method on the profile.
263
+ klass = self
264
+ klass = AppStore if self == AdHoc
265
+
282
266
  # only return the profiles that match the class
283
- profiles.select do |profile|
284
- profile.class == self
267
+ return profiles.select do |profile|
268
+ profile.class == klass
285
269
  end
286
270
  end
287
271
 
@@ -354,6 +338,9 @@ module Spaceship
354
338
  # @return (ProvisioningProfile) A new provisioning profile, as
355
339
  # the repair method will generate a profile with a new ID
356
340
  def update!
341
+ # sigh handles more specific filtering and validation steps that make this logic OK
342
+ #
343
+ # This is the minimum protection needed for people using spaceship directly
357
344
  unless certificate_valid?
358
345
  if mac?
359
346
  if self.kind_of? Development
@@ -405,8 +392,9 @@ module Spaceship
405
392
  end
406
393
 
407
394
  # @return (Bool) Is the current provisioning profile valid?
395
+ # To also verify the certificate call certificate_valid?
408
396
  def valid?
409
- return (status == 'Active' and certificate_valid?)
397
+ return status == 'Active'
410
398
  end
411
399
 
412
400
  # @return (Bool) Is this profile managed by Xcode?
@@ -418,6 +406,42 @@ module Spaceship
418
406
  def mac?
419
407
  platform == 'mac'
420
408
  end
409
+
410
+ def devices
411
+ fetch_details
412
+
413
+ @devices = (self.profile_details["devices"] || []).collect do |device|
414
+ Device.set_client(client).factory(device)
415
+ end if (@devices || []).empty?
416
+
417
+ @devices
418
+ end
419
+
420
+ def certificates
421
+ fetch_details
422
+
423
+ @certificates = (profile_details["certificates"] || []).collect do |cert|
424
+ Certificate.set_client(client).factory(cert)
425
+ end if (@certificates || []).empty?
426
+
427
+ return @certificates
428
+ end
429
+
430
+ # @return (Bool) Is this current provisioning profile adhoc?
431
+ # AppStore and AdHoc profiles are the same except that AdHoc has devices
432
+ def is_adhoc?
433
+ return false unless self.kind_of?(AppStore) || self.kind_of?(AdHoc)
434
+
435
+ return devices.count > 0
436
+ end
437
+
438
+ private
439
+
440
+ def fetch_details
441
+ # Since 15th September 2016 certificates and devices are hidden behind another request
442
+ # see https://github.com/fastlane/fastlane/issues/6137 for more information
443
+ self.profile_details ||= client.provisioning_profile_details(provisioning_profile_id: self.id)
444
+ end
421
445
  end
422
446
  end
423
447
  end
@@ -1,4 +1,4 @@
1
1
  module Spaceship
2
- VERSION = "0.32.4".freeze
2
+ VERSION = "0.33.0".freeze
3
3
  DESCRIPTION = "Ruby library to access the Apple Dev Center and iTunes Connect".freeze
4
4
  end
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.32.4
4
+ version: 0.33.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-09-16 00:00:00.000000000 Z
12
+ date: 2016-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: credentials_manager
@@ -310,12 +310,14 @@ email:
310
310
  - spaceship@krausefx.com
311
311
  - stefan@natchev.com
312
312
  executables:
313
+ - spaceauth
313
314
  - spaceship
314
315
  extensions: []
315
316
  extra_rdoc_files: []
316
317
  files:
317
318
  - LICENSE
318
319
  - README.md
320
+ - bin/spaceauth
319
321
  - bin/spaceship
320
322
  - lib/assets/languageMapping.json
321
323
  - lib/assets/languageMappingReadable.json