spaceship 0.0.11 → 0.0.13

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: 8dc7b91de80dd5badc3d1612ad9dfd494b1db1aa
4
- data.tar.gz: faac4d4e1259cf8b81edf986c51d634bd1a7f6a3
3
+ metadata.gz: f295467cde461ab9cefe3b50cc952df41d5a0abc
4
+ data.tar.gz: ec652e7d8b65534e5d445dce8077a54c28346c20
5
5
  SHA512:
6
- metadata.gz: 295af3b802b19aed2e746fb9347b964bb61fc6699d0f38103826a7e5e0a680f7b5fee33044c26ab1f340d3f0b36f70b901c77d52e604165e1fe47e99a35158bd
7
- data.tar.gz: b1e23998008b5e91e9bbf8f62756923ce65344073e145a979ee7050fbeccc9b810a0417a169875c36f80dfa5a13abf4437c55fbe43a41a2e9a4a207a5c50b0db
6
+ metadata.gz: 5a6af1ef32c660719ffe85ede0299f16eb1d9c5b2760d9404c4525c3ef6305078b6467156ec53f9965e3deafc833590c8456fddba301d4cc47fbbfcb0816dd89
7
+ data.tar.gz: d9c953aa6db8c66109405da514a2fe3187e73afda5867d2bc8ff4ee428de6ca7a337baa4adbbd073573dc66524ea1559625511ea21674884dd02a95456aca8b9
data/README.md CHANGED
@@ -221,7 +221,8 @@ File.write("NewProfile.mobileprovision", profile.download)
221
221
  ```ruby
222
222
  # Select all 'Invalid' or 'Expired' provisioning profiles
223
223
  broken_profiles = Spaceship.provisioning_profile.all.find_all do |profile|
224
- (profile.status == "Invalid" or profile.status == "Expired")
224
+ # the below could be replaced with `!profile.valid?`, which takes longer but also verifies the code signing identity
225
+ (profile.status == "Invalid" or profile.status == "Expired")
225
226
  end
226
227
 
227
228
  # Iterate over all broken profiles and repair them
@@ -229,8 +230,8 @@ broken_profiles.each do |profile|
229
230
  profile.repair! # yes, that's all you need to repair a profile
230
231
  end
231
232
 
232
- # or to make the same thing, just more Ruby like:
233
- Spaceship.provisioning_profile.all.find_all { |p| %w[Invalid Expired].include?p.status}.map(&:repair!)
233
+ # or to do the same thing, just more Ruby like
234
+ Spaceship.provisioning_profile.all.find_all { |p| !p.valid? }.map(&:repair!)
234
235
  ```
235
236
 
236
237
  ## Devices
data/lib/spaceship/app.rb CHANGED
@@ -30,12 +30,27 @@ module Spaceship
30
30
  # @return (Bool) Is this app a wildcard app (e.g. com.krausefx.*)
31
31
  attr_accessor :is_wildcard
32
32
 
33
+ # @return (Hash) Feature details
34
+ attr_accessor :features
35
+
36
+ # @return (Array) List of enabled features
37
+ attr_accessor :enabled_features
38
+
33
39
  # @return (Bool) Development Push Enabled?
34
40
  attr_accessor :dev_push_enabled
35
41
 
36
42
  # @return (Bool) Production Push Enabled?
37
43
  attr_accessor :prod_push_enabled
38
44
 
45
+ # @return (Fixnum) Number of associated app groups
46
+ attr_accessor :app_groups_count
47
+
48
+ # @return (Fixnum) Number of associated cloud containers
49
+ attr_accessor :cloud_containers_count
50
+
51
+ # @return (Fixnum) Number of associated identifiers
52
+ attr_accessor :identifiers_count
53
+
39
54
  attr_mapping(
40
55
  'appIdId' => :app_id,
41
56
  'name' => :name,
@@ -43,8 +58,14 @@ module Spaceship
43
58
  'prefix' => :prefix,
44
59
  'identifier' => :bundle_id,
45
60
  'isWildCard' => :is_wildcard,
61
+ 'features' => :features,
62
+ 'enabledFeatures' => :enabled_features,
46
63
  'isDevPushEnabled' => :dev_push_enabled,
47
- 'isProdPushEnabled' => :prod_push_enabled
64
+ 'isProdPushEnabled' => :prod_push_enabled,
65
+ 'associatedApplicationGroupsCount' => :app_groups_count,
66
+ 'associatedCloudContainersCount' => :cloud_containers_count,
67
+ 'associatedIdentifiersCount' => :identifiers_count
68
+
48
69
  )
49
70
 
50
71
  class << self
@@ -92,5 +113,13 @@ module Spaceship
92
113
  client.delete_app!(app_id)
93
114
  self
94
115
  end
116
+
117
+ # Fetch a specific App ID details based on the bundle_id
118
+ # @return (App) The app you're looking for. This is nil if the app can't be found.
119
+ def details
120
+ app = client.details_for_app(self)
121
+ self.class.factory(app)
122
+ end
123
+
95
124
  end
96
125
  end
@@ -2,11 +2,11 @@ require 'openssl'
2
2
 
3
3
  module Spaceship
4
4
  # Represents a certificate from the Apple Developer Portal.
5
- #
5
+ #
6
6
  # This can either be a code signing identity or a push profile
7
7
  class Certificate < Base
8
8
  # @return (String) The ID given from the developer portal. You'll probably not need it.
9
- # @example
9
+ # @example
10
10
  # "P577TH3PAA"
11
11
  attr_accessor :id
12
12
 
@@ -18,23 +18,23 @@ module Spaceship
18
18
  attr_accessor :name
19
19
 
20
20
  # @return (String) Status of the certificate
21
- # @example
21
+ # @example
22
22
  # "Issued"
23
23
  attr_accessor :status
24
24
 
25
25
  # @return (Date) The date and time when the certificate was created
26
- # @example
26
+ # @example
27
27
  # 2015-04-01 21:24:00 UTC
28
28
  attr_accessor :created
29
29
 
30
30
  # @return (Date) The date and time when the certificate will expire
31
- # @example
31
+ # @example
32
32
  # 2016-04-01 21:24:00 UTC
33
33
  attr_accessor :expires
34
-
34
+
35
35
  # @return (String) The owner type that defines if it's a push profile
36
36
  # or a code signing identity
37
- #
37
+ #
38
38
  # @example Code Signing Identity
39
39
  # "team"
40
40
  # @example Push Certificate
@@ -42,21 +42,21 @@ module Spaceship
42
42
  attr_accessor :owner_type
43
43
 
44
44
  # @return (String) The name of the owner
45
- #
45
+ #
46
46
  # @example Code Signing Identity (usually the company name)
47
47
  # "SunApps Gmbh"
48
48
  # @example Push Certificate (the name of your App ID)
49
49
  # "Awesome App"
50
50
  attr_accessor :owner_name
51
51
 
52
- # @return (String) The ID of the owner, that can be used to
52
+ # @return (String) The ID of the owner, that can be used to
53
53
  # fetch more information
54
54
  # @example
55
55
  # "75B83SPLAA"
56
56
  attr_accessor :owner_id
57
57
 
58
58
  # Indicates the type of this certificate
59
- # which is automatically used to determine the class of
59
+ # which is automatically used to determine the class of
60
60
  # the certificate. Available values listed in CERTIFICATE_TYPE_IDS
61
61
  # @return (String) The type of the certificate
62
62
  # @example Production Certificate
@@ -131,12 +131,12 @@ module Spaceship
131
131
 
132
132
  #class methods
133
133
  class << self
134
- # Create a new code signing request that can be used to
134
+ # Create a new code signing request that can be used to
135
135
  # generate a new certificate
136
136
  # @example
137
137
  # Create a new certificate signing request
138
138
  # csr, pkey = Spaceship.certificate.create_certificate_signing_request
139
- #
139
+ #
140
140
  # # Use the signing request to create a new distribution certificate
141
141
  # Spaceship.certificate.production.create!(csr: csr)
142
142
  def create_certificate_signing_request
@@ -205,7 +205,7 @@ module Spaceship
205
205
  end
206
206
  end
207
207
 
208
- # @return (Certificate) Find a certificate based on the ID of the certificate.
208
+ # @return (Certificate) Find a certificate based on the ID of the certificate.
209
209
  def find(certificate_id)
210
210
  all.find do |c|
211
211
  c.id == certificate_id
@@ -213,15 +213,15 @@ module Spaceship
213
213
  end
214
214
 
215
215
  # Generate a new certificate based on a code certificate signing request
216
- # @param csr (required): The certificate signing request to use. Get one using
216
+ # @param csr (OpenSSL::X509::Request) (required): The certificate signing request to use. Get one using
217
217
  # `create_certificate_signing_request`
218
218
  # @param bundle_id (String) (optional): The app identifier this certificate is for.
219
219
  # This value is only needed if you create a push profile. For normal code signing
220
220
  # certificates, you must only pass a certificate signing request.
221
- # @example
221
+ # @example
222
222
  # # Create a new certificate signing request
223
223
  # csr, pkey = Spaceship::Certificate.create_certificate_signing_request
224
- #
224
+ #
225
225
  # # Use the signing request to create a new distribution certificate
226
226
  # Spaceship::Certificate::Production.create!(csr: csr)
227
227
  # @return (Device): The newly created device
@@ -235,6 +235,9 @@ module Spaceship
235
235
  app_id = app.app_id
236
236
  end
237
237
 
238
+ # ensure csr is a OpenSSL::X509::Request
239
+ csr = OpenSSL::X509::Request.new(csr) if csr.is_a?(String)
240
+
238
241
  # if this succeeds, we need to save the .cer and the private key in keychain access or wherever they go in linux
239
242
  response = client.create_certificate!(type, csr.to_pem, app_id)
240
243
  # munge the response to make it work for the factory
@@ -260,7 +263,7 @@ module Spaceship
260
263
  client.revoke_certificate!(id, type_display_id)
261
264
  end
262
265
 
263
- # @return (Bool): Is this certificate a push profile for apps?
266
+ # @return (Bool): Is this certificate a push profile for apps?
264
267
  def is_push?
265
268
  self.kind_of?PushCertificate
266
269
  end
@@ -30,15 +30,15 @@ module Spaceship
30
30
  # Authenticates with Apple's web services. This method has to be called once
31
31
  # to generate a valid session. The session will automatically be used from then
32
32
  # on.
33
- #
33
+ #
34
34
  # This method will automatically use the username from the Appfile (if available)
35
35
  # and fetch the password from the Keychain (if available)
36
- #
36
+ #
37
37
  # @param user (String) (optional): The username (usually the email address)
38
38
  # @param password (String) (optional): The password
39
- #
39
+ #
40
40
  # @raise InvalidUserCredentialsError: raised if authentication failed
41
- #
41
+ #
42
42
  # @return (Spaceship::Client) The client the login method was called for
43
43
  def self.login(user = nil, password = nil)
44
44
  instance = self.new
@@ -138,15 +138,15 @@ module Spaceship
138
138
  # Authenticates with Apple's web services. This method has to be called once
139
139
  # to generate a valid session. The session will automatically be used from then
140
140
  # on.
141
- #
141
+ #
142
142
  # This method will automatically use the username from the Appfile (if available)
143
143
  # and fetch the password from the Keychain (if available)
144
- #
144
+ #
145
145
  # @param user (String) (optional): The username (usually the email address)
146
146
  # @param password (String) (optional): The password
147
- #
147
+ #
148
148
  # @raise InvalidUserCredentialsError: raised if authentication failed
149
- #
149
+ #
150
150
  # @return (Spaceship::Client) The client the login method was called for
151
151
  def login(user = nil, password = nil)
152
152
  if user.to_s.empty? or password.to_s.empty?
@@ -175,7 +175,7 @@ module Spaceship
175
175
  end
176
176
  end
177
177
 
178
- # @return (Bool) Do we have a valid session?
178
+ # @return (Bool) Do we have a valid session?
179
179
  def session?
180
180
  !!@cookie
181
181
  end
@@ -236,6 +236,14 @@ module Spaceship
236
236
  end
237
237
  end
238
238
 
239
+ def details_for_app(app)
240
+ r = request(:post, 'account/ios/identifiers/getAppIdDetail.action', {
241
+ teamId: team_id,
242
+ appIdId: app.app_id
243
+ })
244
+ parse_response(r, 'appId')
245
+ end
246
+
239
247
  def create_app!(type, name, bundle_id)
240
248
  ident_params = case type.to_sym
241
249
  when :explicit
@@ -419,7 +427,7 @@ module Spaceship
419
427
  end
420
428
  end
421
429
  end
422
-
430
+
423
431
  # memoize the last csrf tokens from responses
424
432
  def csrf_tokens
425
433
  @csrf_tokens || {}
@@ -468,7 +476,7 @@ module Spaceship
468
476
 
469
477
  return @client.send(method, url_or_path, params, headers, &block)
470
478
 
471
- rescue Faraday::Error::TimeoutError => ex # New Farday version: Faraday::TimeoutError => ex
479
+ rescue Faraday::Error::TimeoutError => ex # New Faraday version: Faraday::TimeoutError => ex
472
480
  unless (tries -= 1).zero?
473
481
  sleep 3
474
482
  retry
@@ -241,6 +241,7 @@ module Spaceship
241
241
  # @return (Array) Returns an array of provisioning
242
242
  # profiles matching the bundle identifier
243
243
  # Returns [] if no profiles were found
244
+ # This may also contain invalid or expired profiles
244
245
  def find_by_bundle_id(bundle_id)
245
246
  all.find_all do |profile|
246
247
  profile.app.bundle_id == bundle_id
@@ -348,7 +349,7 @@ module Spaceship
348
349
 
349
350
  # @return (Bool) Is the current provisioning profile valid?
350
351
  def valid?
351
- return status == 'Active'
352
+ return (status == 'Active' and certificate_valid?)
352
353
  end
353
354
 
354
355
  # @return (Bool) Is this profile managed by Xcode?
@@ -1,3 +1,3 @@
1
1
  module Spaceship
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.13"
3
3
  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.0.11
4
+ version: 0.0.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Natchev
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-16 00:00:00.000000000 Z
12
+ date: 2015-06-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: credentials_manager