spaceship 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/spaceship.rb +0 -1
- data/lib/spaceship/certificate.rb +1 -3
- data/lib/spaceship/client.rb +58 -12
- data/lib/spaceship/helper/net_http_generic_request.rb +1 -1
- data/lib/spaceship/provisioning_profile.rb +6 -4
- data/lib/spaceship/ui/select_team.rb +1 -1
- data/lib/spaceship/version.rb +1 -1
- metadata +2 -3
- data/lib/spaceship/profile_types.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02178127118d73630e027800cd0c2c759145444c
|
4
|
+
data.tar.gz: d74fd79faf660145dceacfe275b59db20f24067d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 53c9952a624da716a1777b4ec5cff8d4a80c166bf8f2e710f956a231adfc77b2f254025da34473c3fd48a4ffced5ab821412e20e6417be100c3970b28c51c9e1
|
7
|
+
data.tar.gz: 884cc41a088ed45f6e257bd5f9355685cd6c95c1962272d0595ce844047b4dc46e168db0df0b5c05180daf538242ff21e8daeac132155b31d3daf66020c47f94
|
data/README.md
CHANGED
@@ -216,7 +216,7 @@ profile = Spaceship.provisioning_profile.ad_hoc.create!(bundle_id: "com.krausefx
|
|
216
216
|
File.write("NewProfile.mobileprovision", profile.download)
|
217
217
|
```
|
218
218
|
|
219
|
-
### Repair
|
219
|
+
### Repair all broken provisioning profiles
|
220
220
|
|
221
221
|
```ruby
|
222
222
|
# Select all 'Invalid' or 'Expired' provisioning profiles
|
@@ -398,7 +398,7 @@ This project is licensed under the terms of the MIT license. See the LICENSE fil
|
|
398
398
|
# Contributing
|
399
399
|
|
400
400
|
1. Create an issue to start a discussion about your idea
|
401
|
-
2. Fork it (https://github.com/
|
401
|
+
2. Fork it (https://github.com/fastlane/spaceship/fork)
|
402
402
|
3. Create your feature branch (`git checkout -b my-new-feature`)
|
403
403
|
4. Commit your changes (`git commit -am 'Add some feature'`)
|
404
404
|
5. Push to the branch (`git push origin my-new-feature`)
|
data/lib/spaceship.rb
CHANGED
@@ -262,9 +262,7 @@ module Spaceship
|
|
262
262
|
|
263
263
|
# @return (Bool): Is this certificate a push profile for apps?
|
264
264
|
def is_push?
|
265
|
-
|
266
|
-
[Client::ProfileTypes::Push.development, Client::ProfileTypes::Push.production].include?(type_display_id)
|
265
|
+
self.kind_of?PushCertificate
|
267
266
|
end
|
268
|
-
|
269
267
|
end
|
270
268
|
end
|
data/lib/spaceship/client.rb
CHANGED
@@ -5,13 +5,12 @@ require 'spaceship/ui'
|
|
5
5
|
require 'spaceship/helper/plist_middleware'
|
6
6
|
require 'spaceship/helper/net_http_generic_request'
|
7
7
|
|
8
|
-
if ENV[
|
9
|
-
require 'pry' # TODO: Remove
|
8
|
+
if ENV["DEBUG"]
|
10
9
|
require 'openssl'
|
10
|
+
# this has to be on top of this file, since the value can't be changed later
|
11
11
|
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
|
12
12
|
end
|
13
13
|
|
14
|
-
|
15
14
|
module Spaceship
|
16
15
|
class Client
|
17
16
|
PROTOCOL_VERSION = "QH65B2"
|
@@ -23,7 +22,9 @@ module Spaceship
|
|
23
22
|
# /tmp/spaceship.log by default
|
24
23
|
attr_accessor :logger
|
25
24
|
|
25
|
+
# Invalid user credentials were provided
|
26
26
|
class InvalidUserCredentialsError < StandardError; end
|
27
|
+
|
27
28
|
class UnexpectedResponse < StandardError; end
|
28
29
|
|
29
30
|
# Authenticates with Apple's web services. This method has to be called once
|
@@ -56,17 +57,30 @@ module Spaceship
|
|
56
57
|
c.adapter Faraday.default_adapter
|
57
58
|
|
58
59
|
if ENV['DEBUG']
|
59
|
-
# for debugging
|
60
|
+
# for debugging only
|
61
|
+
# This enables tracking of networking requests using Charles Web Proxy
|
60
62
|
c.response :logger
|
61
63
|
c.proxy "https://127.0.0.1:8888"
|
62
64
|
end
|
63
65
|
end
|
64
66
|
end
|
65
67
|
|
68
|
+
# Fetches the latest API Key from the Apple Dev Portal
|
66
69
|
def api_key
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
+
cache_path = "/tmp/spaceship_api_key.txt"
|
71
|
+
cached = File.read(cache_path) rescue nil
|
72
|
+
return cached if cached
|
73
|
+
|
74
|
+
landing_url = "https://developer.apple.com/membercenter/index.action"
|
75
|
+
logger.info("GET: " + landing_url)
|
76
|
+
headers = @client.get(landing_url).headers
|
77
|
+
results = headers['location'].match(/.*appIdKey=(\h+)/)
|
78
|
+
if results.length > 1
|
79
|
+
api_key = results[1]
|
80
|
+
File.write(cache_path, api_key)
|
81
|
+
return api_key
|
82
|
+
else
|
83
|
+
raise "Could not find latest API Key from the Dev Portal"
|
70
84
|
end
|
71
85
|
end
|
72
86
|
|
@@ -78,8 +92,11 @@ module Spaceship
|
|
78
92
|
@logger = Logger.new(STDOUT)
|
79
93
|
else
|
80
94
|
# Log to file by default
|
81
|
-
|
95
|
+
path = "/tmp/spaceship.log"
|
96
|
+
puts "Logging spaceship web requests to '#{path}'"
|
97
|
+
@logger = Logger.new(path)
|
82
98
|
end
|
99
|
+
|
83
100
|
@logger.formatter = proc do |severity, datetime, progname, msg|
|
84
101
|
string = "[#{datetime.strftime('%H:%M:%S')}]: #{msg}\n"
|
85
102
|
end
|
@@ -88,8 +105,11 @@ module Spaceship
|
|
88
105
|
@logger
|
89
106
|
end
|
90
107
|
|
91
|
-
|
108
|
+
#####################################################
|
109
|
+
# @!group Automatic Paging
|
110
|
+
#####################################################
|
92
111
|
|
112
|
+
# The page size we want to request, defaults to 500
|
93
113
|
def page_size
|
94
114
|
@page_size ||= 500
|
95
115
|
end
|
@@ -111,6 +131,10 @@ module Spaceship
|
|
111
131
|
return results
|
112
132
|
end
|
113
133
|
|
134
|
+
#####################################################
|
135
|
+
# @!group Login and Team Selection
|
136
|
+
#####################################################
|
137
|
+
|
114
138
|
# Authenticates with Apple's web services. This method has to be called once
|
115
139
|
# to generate a valid session. The session will automatically be used from then
|
116
140
|
# on.
|
@@ -151,15 +175,18 @@ module Spaceship
|
|
151
175
|
end
|
152
176
|
end
|
153
177
|
|
178
|
+
# @return (Bool) Do we have a valid session?
|
154
179
|
def session?
|
155
180
|
!!@cookie
|
156
181
|
end
|
157
182
|
|
183
|
+
# @return (Array) A list of all available teams
|
158
184
|
def teams
|
159
185
|
r = request(:post, 'account/listTeams.action')
|
160
186
|
parse_response(r, 'teams')
|
161
187
|
end
|
162
188
|
|
189
|
+
# @return (String) The currently selected Team ID
|
163
190
|
def team_id
|
164
191
|
return @current_team_id if @current_team_id
|
165
192
|
|
@@ -169,14 +196,21 @@ module Spaceship
|
|
169
196
|
@current_team_id ||= teams[0]['teamId']
|
170
197
|
end
|
171
198
|
|
199
|
+
# Shows a team selection for the user in the terminal. This should not be
|
200
|
+
# called on CI systems
|
172
201
|
def select_team
|
173
202
|
@current_team_id = self.UI.select_team
|
174
203
|
end
|
175
204
|
|
176
|
-
|
205
|
+
# Set a new team ID which will be used from now on
|
206
|
+
def team_id=(team_id)
|
177
207
|
@current_team_id = team_id
|
178
208
|
end
|
179
209
|
|
210
|
+
#####################################################
|
211
|
+
# @!group Apps
|
212
|
+
#####################################################
|
213
|
+
|
180
214
|
def apps
|
181
215
|
paging do |page_number|
|
182
216
|
r = request(:post, 'account/ios/identifiers/listAppIds.action', {
|
@@ -227,6 +261,10 @@ module Spaceship
|
|
227
261
|
parse_response(r)
|
228
262
|
end
|
229
263
|
|
264
|
+
#####################################################
|
265
|
+
# @!group Devices
|
266
|
+
#####################################################
|
267
|
+
|
230
268
|
def devices
|
231
269
|
paging do |page_number|
|
232
270
|
r = request(:post, 'account/ios/device/listDevices.action', {
|
@@ -252,6 +290,10 @@ module Spaceship
|
|
252
290
|
parse_response(r, 'device')
|
253
291
|
end
|
254
292
|
|
293
|
+
#####################################################
|
294
|
+
# @!group Certificates
|
295
|
+
#####################################################
|
296
|
+
|
255
297
|
def certificates(types)
|
256
298
|
paging do |page_number|
|
257
299
|
r = request(:post, 'account/ios/certificate/listCertRequests.action', {
|
@@ -294,6 +336,10 @@ module Spaceship
|
|
294
336
|
parse_response(r, 'certRequests')
|
295
337
|
end
|
296
338
|
|
339
|
+
#####################################################
|
340
|
+
# @!group Provisioning Profiles
|
341
|
+
#####################################################
|
342
|
+
|
297
343
|
def provisioning_profiles
|
298
344
|
r = request(:post) do |r|
|
299
345
|
r.url "https://developerservices2.apple.com/services/#{PROTOCOL_VERSION}/ios/listProvisioningProfiles.action"
|
@@ -350,7 +396,7 @@ module Spaceship
|
|
350
396
|
end
|
351
397
|
|
352
398
|
private
|
353
|
-
# Is called from `parse_response` to store
|
399
|
+
# Is called from `parse_response` to store the latest csrf_token (if available)
|
354
400
|
def store_csrf_tokens(response)
|
355
401
|
if response and response.headers
|
356
402
|
tokens = response.headers.select { |k, v| %w[csrf csrf_ts].include?(k) }
|
@@ -359,7 +405,7 @@ module Spaceship
|
|
359
405
|
end
|
360
406
|
end
|
361
407
|
end
|
362
|
-
|
408
|
+
|
363
409
|
# memoize the last csrf tokens from responses
|
364
410
|
def csrf_tokens
|
365
411
|
@csrf_tokens || {}
|
@@ -238,9 +238,9 @@ module Spaceship
|
|
238
238
|
end
|
239
239
|
end
|
240
240
|
|
241
|
-
# @return (
|
242
|
-
#
|
243
|
-
#
|
241
|
+
# @return (Array) Returns an array of provisioning
|
242
|
+
# profiles matching the bundle identifier
|
243
|
+
# Returns [] if no profiles were found
|
244
244
|
def find_by_bundle_id(bundle_id)
|
245
245
|
all.find_all do |profile|
|
246
246
|
profile.app.bundle_id == bundle_id
|
@@ -310,8 +310,10 @@ module Spaceship
|
|
310
310
|
unless certificate_valid?
|
311
311
|
if self.kind_of?Development
|
312
312
|
self.certificates = [Spaceship::Certificate::Development.all.first]
|
313
|
+
elsif self.kind_of?InHouse
|
314
|
+
self.certificates = [Spaceship::Certificate::InHouse.all.first]
|
313
315
|
else
|
314
|
-
self.certificates = [Spaceship::Certificate::Production.all.first]
|
316
|
+
self.certificates = [Spaceship::Certificate::Production.all.first]
|
315
317
|
end
|
316
318
|
end
|
317
319
|
|
@@ -66,7 +66,7 @@ module Spaceship
|
|
66
66
|
# Multiple teams, user has to select
|
67
67
|
puts "Multiple teams found, please enter the number of the team you want to use: "
|
68
68
|
teams.each_with_index do |team, i|
|
69
|
-
puts "#{i + 1}) #{team['teamId']} #{team['name']} (#{team['type']})"
|
69
|
+
puts "#{i + 1}) #{team['teamId']} \"#{team['name']}\" (#{team['type']})"
|
70
70
|
end
|
71
71
|
|
72
72
|
selected = ($stdin.gets || '').strip.to_i - 1
|
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.0.
|
4
|
+
version: 0.0.7
|
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-
|
12
|
+
date: 2015-06-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: credentials_manager
|
@@ -213,7 +213,6 @@ files:
|
|
213
213
|
- lib/spaceship/helper/net_http_generic_request.rb
|
214
214
|
- lib/spaceship/helper/plist_middleware.rb
|
215
215
|
- lib/spaceship/launcher.rb
|
216
|
-
- lib/spaceship/profile_types.rb
|
217
216
|
- lib/spaceship/provisioning_profile.rb
|
218
217
|
- lib/spaceship/ui.rb
|
219
218
|
- lib/spaceship/ui/select_team.rb
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module Spaceship
|
2
|
-
# This class contains the codes used for the different types of profiles
|
3
|
-
class Client
|
4
|
-
class ProfileTypes
|
5
|
-
class SigningCertificate
|
6
|
-
def self.development
|
7
|
-
"5QPB9NHCEI"
|
8
|
-
end
|
9
|
-
def self.distribution
|
10
|
-
"R58UK2EWSO"
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
class Push
|
15
|
-
def self.development
|
16
|
-
"BKLRAVXMGM"
|
17
|
-
end
|
18
|
-
def self.production
|
19
|
-
"3BQKVH9I2X"
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.all_profile_types
|
24
|
-
[
|
25
|
-
"5QPB9NHCEI", # Development Code Signing Identity
|
26
|
-
"R58UK2EWSO", # Distribution Code Signing Identity
|
27
|
-
"9RQEK7MSXA", # iOS Distribution certificate signing request
|
28
|
-
"LA30L5BJEU", # MDM CSR certificate signing request
|
29
|
-
"BKLRAVXMGM", # Development Push Certificates
|
30
|
-
"3BQKVH9I2X", # Production Push Certificates
|
31
|
-
"Y3B2F3TYSI", # Pass Type ID pass certificate request
|
32
|
-
"3T2ZP62QW8", # Website Push Id
|
33
|
-
"E5D663CMZW", # Website Push Id
|
34
|
-
"4APLUP237T" # Apple Pay
|
35
|
-
]
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|