spaceship 0.0.15 → 0.1.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 +4 -4
- data/lib/assets/languageMapping.json +224 -0
- data/lib/spaceship.rb +20 -63
- data/lib/spaceship/base.rb +71 -14
- data/lib/spaceship/client.rb +9 -274
- data/lib/spaceship/launcher.rb +1 -1
- data/lib/spaceship/portal/app.rb +125 -0
- data/lib/spaceship/portal/certificate.rb +273 -0
- data/lib/spaceship/portal/device.rb +102 -0
- data/lib/spaceship/portal/portal.rb +6 -0
- data/lib/spaceship/portal/portal_base.rb +13 -0
- data/lib/spaceship/portal/portal_client.rb +289 -0
- data/lib/spaceship/portal/provisioning_profile.rb +369 -0
- data/lib/spaceship/portal/spaceship.rb +94 -0
- data/lib/spaceship/{ui → portal/ui}/select_team.rb +0 -0
- data/lib/spaceship/tunes/app_screenshot.rb +28 -0
- data/lib/spaceship/tunes/app_status.rb +63 -0
- data/lib/spaceship/tunes/app_submission.rb +149 -0
- data/lib/spaceship/tunes/app_version.rb +337 -0
- data/lib/spaceship/tunes/application.rb +253 -0
- data/lib/spaceship/tunes/build.rb +128 -0
- data/lib/spaceship/tunes/build_train.rb +79 -0
- data/lib/spaceship/tunes/language_converter.rb +44 -0
- data/lib/spaceship/tunes/language_item.rb +54 -0
- data/lib/spaceship/tunes/processing_build.rb +30 -0
- data/lib/spaceship/tunes/spaceship.rb +26 -0
- data/lib/spaceship/tunes/tester.rb +177 -0
- data/lib/spaceship/tunes/tunes.rb +12 -0
- data/lib/spaceship/tunes/tunes_base.rb +15 -0
- data/lib/spaceship/tunes/tunes_client.rb +360 -0
- data/lib/spaceship/version.rb +1 -1
- metadata +27 -7
- data/lib/spaceship/app.rb +0 -125
- data/lib/spaceship/certificate.rb +0 -271
- data/lib/spaceship/device.rb +0 -100
- data/lib/spaceship/provisioning_profile.rb +0 -367
data/lib/spaceship/device.rb
DELETED
@@ -1,100 +0,0 @@
|
|
1
|
-
module Spaceship
|
2
|
-
# Represents a device from the Apple Developer Portal
|
3
|
-
class Device < Base
|
4
|
-
# @return (String) The ID given from the developer portal. You'll probably not need it.
|
5
|
-
# @example
|
6
|
-
# "XJXGVS46MW"
|
7
|
-
attr_accessor :id
|
8
|
-
|
9
|
-
# @return (String) The name of the device
|
10
|
-
# @example
|
11
|
-
# "Felix Krause's iPhone 6"
|
12
|
-
attr_accessor :name
|
13
|
-
|
14
|
-
# @return (String) The UDID of the device
|
15
|
-
# @example
|
16
|
-
# "4c24a7ee5caaa4847f49aaab2d87483053f53b65"
|
17
|
-
attr_accessor :udid
|
18
|
-
|
19
|
-
# @return (String) The platform of the device. This is probably always "ios"
|
20
|
-
# @example
|
21
|
-
# "ios"
|
22
|
-
attr_accessor :platform
|
23
|
-
|
24
|
-
# @return (String) Status of the device. Probably always "c"
|
25
|
-
# @example
|
26
|
-
# "c"
|
27
|
-
attr_accessor :status
|
28
|
-
|
29
|
-
attr_mapping({
|
30
|
-
'deviceId' => :id,
|
31
|
-
'name' => :name,
|
32
|
-
'deviceNumber' => :udid,
|
33
|
-
'devicePlatform' => :platform,
|
34
|
-
'status' => :status
|
35
|
-
})
|
36
|
-
|
37
|
-
class << self
|
38
|
-
# Create a new object based on a hash.
|
39
|
-
# This is used to create a new object based on the server response.
|
40
|
-
def factory(attrs)
|
41
|
-
self.new(attrs)
|
42
|
-
end
|
43
|
-
|
44
|
-
# @return (Array) Returns all devices registered for this account
|
45
|
-
def all
|
46
|
-
client.devices.map { |device| self.factory(device) }
|
47
|
-
end
|
48
|
-
|
49
|
-
# @return (Device) Find a device based on the ID of the device. *Attention*:
|
50
|
-
# This is *not* the UDID. nil if no device was found.
|
51
|
-
def find(device_id)
|
52
|
-
all.find do |device|
|
53
|
-
device.id == device_id
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
# @return (Device) Find a device based on the UDID of the device. nil if no device was found.
|
58
|
-
def find_by_udid(device_udid)
|
59
|
-
all.find do |device|
|
60
|
-
device.udid == device_udid
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
# @return (Device) Find a device based on its name. nil if no device was found.
|
65
|
-
def find_by_name(device_name)
|
66
|
-
all.find do |device|
|
67
|
-
device.name == device_name
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
# Register a new device to this account
|
72
|
-
# @param name (String) (required): The name of the new device
|
73
|
-
# @param udid (String) (required): The UDID of the new device
|
74
|
-
# @example
|
75
|
-
# Spaceship.device.create!(name: "Felix Krause's iPhone 6", udid: "4c24a7ee5caaa4847f49aaab2d87483053f53b65")
|
76
|
-
# @return (Device): The newly created device
|
77
|
-
def create!(name: nil, udid: nil)
|
78
|
-
# Check whether the user has passed in a UDID and a name
|
79
|
-
unless (udid and name)
|
80
|
-
raise "You cannot create a device without a device_id (UDID) and name"
|
81
|
-
end
|
82
|
-
|
83
|
-
# Find the device by UDID, raise an exception if it already exists
|
84
|
-
if self.find_by_udid(udid)
|
85
|
-
raise "The device UDID '#{udid}' already exists on this team."
|
86
|
-
end
|
87
|
-
|
88
|
-
# Find the device by name, raise an exception if it already exists
|
89
|
-
if self.find_by_name(name)
|
90
|
-
raise "The device name '#{name}' already exists on this team, use different one."
|
91
|
-
end
|
92
|
-
|
93
|
-
device = client.create_device!(name, udid)
|
94
|
-
|
95
|
-
# Update self with the new device
|
96
|
-
self.new(device)
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
@@ -1,367 +0,0 @@
|
|
1
|
-
module Spaceship
|
2
|
-
# Represents a provisioning profile of the Apple Dev Portal
|
3
|
-
class ProvisioningProfile < Base
|
4
|
-
# @return (String) The ID generated by the Dev Portal
|
5
|
-
# You'll probably not really need this value
|
6
|
-
# @example
|
7
|
-
# "2MAY7NPHAA"
|
8
|
-
attr_accessor :id
|
9
|
-
|
10
|
-
# @return (String) The UDID of this provisioning profile
|
11
|
-
# This value is used for example for code signing
|
12
|
-
# It is also contained in the actual profile
|
13
|
-
# @example
|
14
|
-
# "23d7df3b-9767-4e85-a1ea-1df4d8f32fec"
|
15
|
-
attr_accessor :uuid
|
16
|
-
|
17
|
-
# @return (DateTime) The date and time of when the profile
|
18
|
-
# expires.
|
19
|
-
# @example
|
20
|
-
# #<DateTime: 2015-11-25T22:45:50+00:00 ((2457352j,81950s,0n),+0s,2299161j)>
|
21
|
-
attr_accessor :expires
|
22
|
-
|
23
|
-
# @return (String) The profile distribution type. You probably want to
|
24
|
-
# use the class type to detect the profile type instead of this string.
|
25
|
-
# @example AppStore Profile
|
26
|
-
# "store"
|
27
|
-
# @example AdHoc Profile
|
28
|
-
# "adhoc"
|
29
|
-
# @example Development Profile
|
30
|
-
# "limited"
|
31
|
-
attr_accessor :distribution_method
|
32
|
-
|
33
|
-
# @return (String) The name of this profile
|
34
|
-
# @example
|
35
|
-
# "com.krausefx.app AppStore"
|
36
|
-
attr_accessor :name
|
37
|
-
|
38
|
-
# @return (String) The status of this profile
|
39
|
-
# @example Active (profile is fine)
|
40
|
-
# "Active"
|
41
|
-
# @example Expired (time ran out)
|
42
|
-
# "Expired"
|
43
|
-
# @example Invalid (e.g. code signing identity not available any more)
|
44
|
-
# "Invalid"
|
45
|
-
attr_accessor :status
|
46
|
-
|
47
|
-
# @return (String) The type of the profile (development or distribution).
|
48
|
-
# You'll probably not need this value
|
49
|
-
# @example Distribution
|
50
|
-
# "iOS Distribution"
|
51
|
-
# @example Development
|
52
|
-
# "iOS Development"
|
53
|
-
attr_accessor :type
|
54
|
-
|
55
|
-
# @return (String) This will always be "2"
|
56
|
-
# @example
|
57
|
-
# "2"
|
58
|
-
attr_accessor :version
|
59
|
-
|
60
|
-
# @return (String) The supported platform for this profile
|
61
|
-
# @example
|
62
|
-
# "ios"
|
63
|
-
attr_accessor :platform
|
64
|
-
|
65
|
-
# No information about this attribute
|
66
|
-
attr_accessor :managing_app
|
67
|
-
|
68
|
-
# A reference to the app this profile is for.
|
69
|
-
# You can then easily access the value directly
|
70
|
-
# @return (App) The app this profile is for
|
71
|
-
#
|
72
|
-
# @example Example Value
|
73
|
-
# <Spaceship::App
|
74
|
-
# @app_id="2UMR2S6PAA"
|
75
|
-
# @name="App Name"
|
76
|
-
# @platform="ios"
|
77
|
-
# @prefix="5A997XSAAA"
|
78
|
-
# @bundle_id="com.krausefx.app"
|
79
|
-
# @is_wildcard=false
|
80
|
-
# @dev_push_enabled=false
|
81
|
-
# @prod_push_enabled=false>
|
82
|
-
#
|
83
|
-
# @example Usage
|
84
|
-
# profile.app.name
|
85
|
-
attr_accessor :app
|
86
|
-
|
87
|
-
# @return (Array) A list of certificates used for this profile
|
88
|
-
# @example Example Value
|
89
|
-
# [
|
90
|
-
# <Spaceship::Certificate::Production
|
91
|
-
# @status=nil
|
92
|
-
# @id="XC5PH8D4AA"
|
93
|
-
# @name="iOS Distribution"
|
94
|
-
# @created=nil
|
95
|
-
# @expires=#<DateTime: 2015-11-25T22:45:50+00:00 ((2457352j,81950s,0n),+0s,2299161j)>
|
96
|
-
# @owner_type="team"
|
97
|
-
# @owner_name=nil
|
98
|
-
# @owner_id=nil
|
99
|
-
# @type_display_id="R58UK2EWAA">]
|
100
|
-
# ]
|
101
|
-
#
|
102
|
-
# @example Usage
|
103
|
-
# profile.certificates.first.id
|
104
|
-
attr_accessor :certificates
|
105
|
-
|
106
|
-
# @return (Array) A list of devices this profile is enabled for.
|
107
|
-
# This will always be [] for AppStore profiles
|
108
|
-
#
|
109
|
-
# @example Example Value
|
110
|
-
# <Spaceship::Device
|
111
|
-
# @id="WXQ7V239BE"
|
112
|
-
# @name="Grahams iPhone 4s"
|
113
|
-
# @udid="ba0ac7d70f7a14c6fa02ef0e02f4fe9c5178e2f7"
|
114
|
-
# @platform="ios"
|
115
|
-
# @status="c">]
|
116
|
-
#
|
117
|
-
# @example Usage
|
118
|
-
# profile.devices.first.name
|
119
|
-
attr_accessor :devices
|
120
|
-
|
121
|
-
attr_mapping({
|
122
|
-
'provisioningProfileId' => :id,
|
123
|
-
'UUID' => :uuid,
|
124
|
-
'dateExpire' => :expires,
|
125
|
-
'distributionMethod' => :distribution_method,
|
126
|
-
'name' => :name,
|
127
|
-
'status' => :status,
|
128
|
-
'type' => :type,
|
129
|
-
'version' => :version,
|
130
|
-
'proProPlatform' => :platform,
|
131
|
-
'managingApp' => :managing_app,
|
132
|
-
'appId' => :app
|
133
|
-
})
|
134
|
-
|
135
|
-
class << self
|
136
|
-
# @return (String) The profile type used for web requests to the Dev Portal
|
137
|
-
# @example
|
138
|
-
# "limited"
|
139
|
-
# "store"
|
140
|
-
# "adhoc"
|
141
|
-
# "inhouse"
|
142
|
-
def type
|
143
|
-
raise "You cannot create a ProvisioningProfile without a type. Use a subclass."
|
144
|
-
end
|
145
|
-
|
146
|
-
# Create a new object based on a hash.
|
147
|
-
# This is used to create a new object based on the server response.
|
148
|
-
def factory(attrs)
|
149
|
-
# Ad Hoc Profiles look exactly like App Store profiles, but usually include devices
|
150
|
-
attrs['distributionMethod'] = 'adhoc' if attrs['distributionMethod'] == 'store' && attrs['devices'].size > 0
|
151
|
-
# available values of `distributionMethod` at this point: ['adhoc', 'store', 'limited']
|
152
|
-
|
153
|
-
klass = case attrs['distributionMethod']
|
154
|
-
when 'limited'
|
155
|
-
Development
|
156
|
-
when 'store'
|
157
|
-
AppStore
|
158
|
-
when 'adhoc'
|
159
|
-
AdHoc
|
160
|
-
when 'inhouse'
|
161
|
-
InHouse
|
162
|
-
else
|
163
|
-
raise "Can't find class '#{attrs['distributionMethod']}'"
|
164
|
-
end
|
165
|
-
|
166
|
-
attrs['appId'] = App.factory(attrs['appId'])
|
167
|
-
attrs['devices'].map! { |device| Device.factory(device) }
|
168
|
-
attrs['certificates'].map! { |cert| Certificate.factory(cert) }
|
169
|
-
|
170
|
-
klass.client = @client
|
171
|
-
klass.new(attrs)
|
172
|
-
end
|
173
|
-
|
174
|
-
# @return (String) The human readable name of this profile type.
|
175
|
-
# @example
|
176
|
-
# "AppStore"
|
177
|
-
# "AdHoc"
|
178
|
-
# "Development"
|
179
|
-
# "InHouse"
|
180
|
-
def pretty_type
|
181
|
-
name.split('::').last
|
182
|
-
end
|
183
|
-
|
184
|
-
# Create a new provisioning profile
|
185
|
-
# @param name (String): The name of the provisioning profile on the Dev Portal
|
186
|
-
# @param bundle_id (String): The app identifier, this paramter is required
|
187
|
-
# @param certificate (Certificate): The certificate that should be used with this
|
188
|
-
# provisioning profile. You can also pass an array of certificates to this method. This will
|
189
|
-
# only work for development profiles
|
190
|
-
# @param devices (Array) (optional): An array of Device objects that should be used in this profile.
|
191
|
-
# It is recommend to not pass devices as spaceship will automatically add all devices for AdHoc
|
192
|
-
# and Development profiles and add none for AppStore and Enterprise Profiles
|
193
|
-
# @return (ProvisioningProfile): The profile that was just created
|
194
|
-
def create!(name: nil, bundle_id: nil, certificate: nil, devices: [])
|
195
|
-
raise "Missing required parameter 'bundle_id'" if bundle_id.to_s.empty?
|
196
|
-
raise "Missing required parameter 'certificate'. e.g. use `Spaceship::Certificate::Production.all.first`" if certificate.to_s.empty?
|
197
|
-
|
198
|
-
app = Spaceship::App.find(bundle_id)
|
199
|
-
raise "Could not find app with bundle id '#{bundle_id}'" unless app
|
200
|
-
|
201
|
-
# Fill in sensible default values
|
202
|
-
name ||= [bundle_id, self.pretty_type].join(' ')
|
203
|
-
|
204
|
-
devices = [] if self == AppStore # App Store Profiles MUST NOT have devices
|
205
|
-
|
206
|
-
certificate_parameter = certificate.collect { |c| c.id } if certificate.kind_of?Array
|
207
|
-
certificate_parameter ||= [certificate.id]
|
208
|
-
|
209
|
-
# Fix https://github.com/KrauseFx/fastlane/issues/349
|
210
|
-
certificate_parameter = certificate_parameter.first if certificate_parameter.count == 1
|
211
|
-
|
212
|
-
if devices.nil? or devices.count == 0
|
213
|
-
if self == Development or self == AdHoc
|
214
|
-
# For Development and AdHoc we usually want all devices by default
|
215
|
-
devices = Spaceship::Device.all
|
216
|
-
end
|
217
|
-
end
|
218
|
-
|
219
|
-
profile = client.create_provisioning_profile!(name,
|
220
|
-
self.type,
|
221
|
-
app.app_id,
|
222
|
-
certificate_parameter,
|
223
|
-
devices.map {|d| d.id} )
|
224
|
-
self.new(profile)
|
225
|
-
end
|
226
|
-
|
227
|
-
# @return (Array) Returns all profiles registered for this account
|
228
|
-
# If you're calling this from a subclass (like AdHoc), this will
|
229
|
-
# only return the profiles that are of this type
|
230
|
-
def all
|
231
|
-
profiles = client.provisioning_profiles.map do |profile|
|
232
|
-
self.factory(profile)
|
233
|
-
end
|
234
|
-
|
235
|
-
# filter out the profiles managed by xcode
|
236
|
-
profiles.delete_if do |profile|
|
237
|
-
profile.managed_by_xcode?
|
238
|
-
end
|
239
|
-
|
240
|
-
return profiles if self == ProvisioningProfile
|
241
|
-
|
242
|
-
# only return the profiles that match the class
|
243
|
-
profiles.select do |profile|
|
244
|
-
profile.class == self
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
|
-
# @return (Array) Returns an array of provisioning
|
249
|
-
# profiles matching the bundle identifier
|
250
|
-
# Returns [] if no profiles were found
|
251
|
-
# This may also contain invalid or expired profiles
|
252
|
-
def find_by_bundle_id(bundle_id)
|
253
|
-
all.find_all do |profile|
|
254
|
-
profile.app.bundle_id == bundle_id
|
255
|
-
end
|
256
|
-
end
|
257
|
-
|
258
|
-
end
|
259
|
-
|
260
|
-
# Represents a Development profile from the Dev Portal
|
261
|
-
class Development < ProvisioningProfile
|
262
|
-
def self.type
|
263
|
-
'limited'
|
264
|
-
end
|
265
|
-
end
|
266
|
-
|
267
|
-
# Represents an AppStore profile from the Dev Portal
|
268
|
-
class AppStore < ProvisioningProfile
|
269
|
-
def self.type
|
270
|
-
'store'
|
271
|
-
end
|
272
|
-
end
|
273
|
-
|
274
|
-
# Represents an AdHoc profile from the Dev Portal
|
275
|
-
class AdHoc < ProvisioningProfile
|
276
|
-
def self.type
|
277
|
-
'adhoc'
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
# Represents an Enterprise InHouse profile from the Dev Portal
|
282
|
-
class InHouse < ProvisioningProfile
|
283
|
-
def self.type
|
284
|
-
'inhouse'
|
285
|
-
end
|
286
|
-
end
|
287
|
-
|
288
|
-
# Download the current provisioning profile. This will *not* store
|
289
|
-
# the provisioning profile on the file system. Instead this method
|
290
|
-
# will return the content of the profile.
|
291
|
-
# @return (String) The content of the provisioning profile
|
292
|
-
# You'll probably want to store it on the file system
|
293
|
-
# @example
|
294
|
-
# File.write("path.mobileprovision", profile.download)
|
295
|
-
def download
|
296
|
-
client.download_provisioning_profile(self.id)
|
297
|
-
end
|
298
|
-
|
299
|
-
# Delete the provisioning profile
|
300
|
-
def delete!
|
301
|
-
client.delete_provisioning_profile!(self.id)
|
302
|
-
end
|
303
|
-
|
304
|
-
# Repair an existing provisioning profile
|
305
|
-
# alias to update!
|
306
|
-
# @return (ProvisioningProfile) A new provisioning profile, as
|
307
|
-
# the repair method will generate a profile with a new ID
|
308
|
-
def repair!
|
309
|
-
update!
|
310
|
-
end
|
311
|
-
|
312
|
-
# Updates the provisioning profile from the local data
|
313
|
-
# e.g. after you added new devices to the profile
|
314
|
-
# This will also update the code signing identity if necessary
|
315
|
-
# @return (ProvisioningProfile) A new provisioning profile, as
|
316
|
-
# the repair method will generate a profile with a new ID
|
317
|
-
def update!
|
318
|
-
unless certificate_valid?
|
319
|
-
if self.kind_of?Development
|
320
|
-
self.certificates = [Spaceship::Certificate::Development.all.first]
|
321
|
-
elsif self.kind_of?InHouse
|
322
|
-
self.certificates = [Spaceship::Certificate::InHouse.all.first]
|
323
|
-
else
|
324
|
-
self.certificates = [Spaceship::Certificate::Production.all.first]
|
325
|
-
end
|
326
|
-
end
|
327
|
-
|
328
|
-
client.repair_provisioning_profile!(
|
329
|
-
self.id,
|
330
|
-
self.name,
|
331
|
-
self.distribution_method,
|
332
|
-
self.app.app_id,
|
333
|
-
self.certificates.map { |c| c.id },
|
334
|
-
self.devices.map { |d| d.id }
|
335
|
-
)
|
336
|
-
|
337
|
-
# We need to fetch the provisioning profile again, as the ID changes
|
338
|
-
profile = Spaceship::ProvisioningProfile.all.find do |profile|
|
339
|
-
profile.name == self.name # we can use the name as it's valid
|
340
|
-
end
|
341
|
-
|
342
|
-
return profile
|
343
|
-
end
|
344
|
-
|
345
|
-
# Is the certificate of this profile available?
|
346
|
-
# @return (Bool) is the certificate valid?
|
347
|
-
def certificate_valid?
|
348
|
-
return false if (certificates || []).count == 0
|
349
|
-
certificates.each do |c|
|
350
|
-
if Spaceship::Certificate.all.collect { |s| s.id }.include?(c.id)
|
351
|
-
return true
|
352
|
-
end
|
353
|
-
end
|
354
|
-
return false
|
355
|
-
end
|
356
|
-
|
357
|
-
# @return (Bool) Is the current provisioning profile valid?
|
358
|
-
def valid?
|
359
|
-
return (status == 'Active' and certificate_valid?)
|
360
|
-
end
|
361
|
-
|
362
|
-
# @return (Bool) Is this profile managed by Xcode?
|
363
|
-
def managed_by_xcode?
|
364
|
-
managing_app == 'Xcode'
|
365
|
-
end
|
366
|
-
end
|
367
|
-
end
|