spaceship 0.3.0 → 0.3.1

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: 512289a32dda1675818d359f917054b3f2e1e56e
4
- data.tar.gz: 5ee2c24728b19f4fbff5ccaa23d99fb64dba3773
3
+ metadata.gz: e3078ea19b608c93eb3a24244c21150926510bfb
4
+ data.tar.gz: 4502e39e82ac1214bb99194d6952956fc3311a03
5
5
  SHA512:
6
- metadata.gz: e4772e10092db2176b4b9c0994d247c92a932678433621599a852111bcad0ada3e991ea4599060f6bc4489f2bdf36a7f1bfac46192b6db8c1b30b7b49f0af409
7
- data.tar.gz: a89358c7f17c498d33a20335a2d4becd8f16b5a5a192ee7467bc44c2b316b6377b48631dcc4d374639f26fc5829880e28f2ed371f8e1a0af0b04042e1de09f81
6
+ metadata.gz: c5c4a1641ab4dfe03f514debd2dc0a49cd6edd0502b5c4a1fde97ee6c043c40a5609a31f6d1c847044586b1160e9f0b930178a71ac74d42ba91f7d8d91392452
7
+ data.tar.gz: 308b92f3e5225fbb8ad6ebed31a665ef7719211cb16cd83c1d4890f802168273bcab987090ddd485880d2e90f71c74e5076391ab3fe5e3535d28a2b2f304e44f
data/README.md CHANGED
@@ -13,7 +13,10 @@
13
13
  <a href="https://github.com/KrauseFx/sigh">sigh</a> &bull;
14
14
  <a href="https://github.com/KrauseFx/produce">produce</a> &bull;
15
15
  <a href="https://github.com/KrauseFx/cert">cert</a> &bull;
16
- <a href="https://github.com/KrauseFx/codes">codes</a>
16
+ <a href="https://github.com/KrauseFx/codes">codes</a> &bull;
17
+ <b>spaceship</b> &bull;
18
+ <a href="https://github.com/fastlane/pilot">pilot</a> &bull;
19
+ <a href="https://github.com/fastlane/boarding">boarding</a>
17
20
  </p>
18
21
  -------
19
22
 
@@ -29,7 +32,7 @@
29
32
  [![Build Status](https://img.shields.io/travis/fastlane/spaceship/master.svg?style=flat)](https://travis-ci.org/fastlane/spaceship)
30
33
 
31
34
 
32
- Get in contact with the developers on Twitter: [@snatchev](https://twitter.com/snatchev/) and [@KrauseFx](https://twitter.com/KrauseFx)
35
+ Get in contact with the developers on Twitter: [@KrauseFx](https://twitter.com/KrauseFx) and [@snatchev](https://twitter.com/snatchev)
33
36
 
34
37
 
35
38
  -------
@@ -47,7 +50,7 @@ Get in contact with the developers on Twitter: [@snatchev](https://twitter.com/s
47
50
 
48
51
  # What's spaceship?
49
52
 
50
- spaceship is a Ruby library that exposes the Apple Developer Center API. It’s super fast, well tested and supports all of the operations you can do via the browser. Scripting your Developer Center workflow has never been easier!
53
+ spaceship is a Ruby library that exposes both the Apple Developer Center and the iTunes Connect API. It’s super fast, well tested and supports all of the operations you can do via the browser. Scripting your Developer Center workflow has never been easier!
51
54
 
52
55
  Up until now, the [fastlane tools](https://fastlane.tools) used web scraping to interact with Apple's web services. With spaceship it is possible to directly access the underlying APIs using a simple HTTP client only.
53
56
 
@@ -57,7 +60,7 @@ spaceship uses a combination of 3 different API endpoints, used by the Apple Dev
57
60
 
58
61
  More details about why spaceship is useful on [spaceship.airforce](https://spaceship.airforce).
59
62
 
60
- > No matter how many apps or profiles you have, spaceship **can** handle your scale.
63
+ > No matter how many apps or certificates you have, spaceship **can** handle your scale.
61
64
 
62
65
  Enough words, here is some code:
63
66
 
@@ -91,256 +94,22 @@ How fast are tools using `spaceship` compared to web scraping?
91
94
 
92
95
  # Usage
93
96
 
94
- To quickly play around with `spaceship` launch `irb` in your terminal and execute `require "spaceship"`.
97
+ ## Apple Developer Portal API
95
98
 
96
- ## Login
99
+ ##### Open [DeveloperPortal.md](docs/DeveloperPortal.md) for code samples
97
100
 
98
- ```ruby
99
- Spaceship.login("felix@krausefx.com", "password")
100
-
101
- Spaceship.select_team # call this method to let the user select a team
102
- ```
103
-
104
- ## Apps
105
-
106
- ```ruby
107
- # Fetch all available apps
108
- all_apps = Spaceship.app.all
101
+ ## iTunes Connect API
109
102
 
110
- # Find a specific app based on the bundle identifier
111
- app = Spaceship.app.find("com.krausefx.app")
103
+ ##### Open [iTunesConnect.md](docs/iTunesConnect.md) for code samples
112
104
 
113
- # Show the names of all your apps
114
- Spaceship.app.all.each do |app|
115
- puts app.name
116
- end
105
+ ### Spaceship in use
117
106
 
118
- # Create a new app
119
- app = Spaceship.app.create!(bundle_id: "com.krausefx.app_name", name: "fastlane App")
120
- ```
121
-
122
- ## Certificates
123
-
124
- ```ruby
125
- # Fetch all available certificates (includes signing and push profiles)
126
- certificates = Spaceship.certificate.all
127
- ```
128
-
129
- ### Code Signing Certificates
130
-
131
- ```ruby
132
- # Production identities
133
- prod_certs = Spaceship.certificate.production.all
134
-
135
- # Development identities
136
- dev_certs = Spaceship.certificate.development.all
137
-
138
- # Download a certificate
139
- cert_content = prod_certs.first.download
140
- ```
141
-
142
- ### Push Certificates
143
- ```ruby
144
- # Production push profiles
145
- prod_push_certs = Spaceship.certificate.production_push.all
146
-
147
- # Development push profiles
148
- dev_push_certs = Spaceship.certificate.development_push.all
149
-
150
- # Download a push profile
151
- cert_content = dev_push_certs.first.download
152
- ```
107
+ Most [fastlane tools](https://fastlane.tools) already use `spaceship`, like `sigh`, `cert`, `produce`, `pilot` and `boarding`.
153
108
 
154
- ### Create a Certificate
155
-
156
- ```ruby
157
- # Create a new certificate signing request
158
- csr, pkey = Spaceship.certificate.create_certificate_signing_request
159
-
160
- # Use the signing request to create a new distribution certificate
161
- Spaceship.certificate.production.create!(csr: csr)
162
-
163
- # Use the signing request to create a new push certificate
164
- Spaceship.certificate.production_push.create!(csr: csr, bundle_id: "com.krausefx.app")
165
- ```
166
-
167
- ## Provisioning Profiles
168
-
169
- ### Receiving profiles
170
-
171
- ```ruby
172
- ##### Finding #####
173
-
174
- # Get all available provisioning profiles
175
- profiles = Spaceship.provisioning_profile.all
176
-
177
- # Get all App Store profiles
178
- profiles_appstore = Spaceship.provisioning_profile.app_store.all
179
-
180
- # Get all AdHoc profiles
181
- profiles_adhoc = Spaceship.provisioning_profile.ad_hoc.all
182
-
183
- # Get all Development profiles
184
- profiles_dev = Spaceship.provisioning_profile.development.all
185
-
186
- # Fetch all profiles for a specific app identifier for the App Store
187
- filtered_profiles = Spaceship.provisioning_profile.app_store.find_by_bundle_id("com.krausefx.app")
188
-
189
- ##### Downloading #####
190
-
191
- # Download a profile
192
- profile_content = profiles.first.download
193
-
194
- # Download a specific profile as file
195
- my_profile = Spaceship.provisioning_profile.app_store.find_by_bundle_id("com.krausefx.app")
196
- File.write("output.mobileprovision", my_profile.download)
197
- ```
198
-
199
- ### Create a Provisioning Profile
200
-
201
- ```ruby
202
- # Choose the certificate to use
203
- cert = Spaceship.certificate.production.all.first
204
-
205
- # Create a new provisioning profile with a default name
206
- # The name of the new profile is "com.krausefx.app AppStore"
207
- profile = Spaceship.provisioning_profile.app_store.create!(bundle_id: "com.krausefx.app",
208
- certificate: cert)
209
-
210
- # AdHoc Profiles will add all devices by default
211
- profile = Spaceship.provisioning_profile.ad_hoc.create!(bundle_id: "com.krausefx.app",
212
- certificate: cert,
213
- name: "Profile Name")
214
-
215
- # Store the new profile on the filesystem
216
- File.write("NewProfile.mobileprovision", profile.download)
217
- ```
218
-
219
- ### Repair all broken provisioning profiles
220
-
221
- ```ruby
222
- # Select all 'Invalid' or 'Expired' provisioning profiles
223
- broken_profiles = Spaceship.provisioning_profile.all.find_all do |profile|
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")
226
- end
227
-
228
- # Iterate over all broken profiles and repair them
229
- broken_profiles.each do |profile|
230
- profile.repair! # yes, that's all you need to repair a profile
231
- end
232
-
233
- # or to do the same thing, just more Ruby like
234
- Spaceship.provisioning_profile.all.find_all { |p| !p.valid? }.map(&:repair!)
235
- ```
236
-
237
- ## Devices
238
-
239
- ```ruby
240
- all_devices = Spaceship.device.all
241
-
242
- # Register a new device
243
- Spaceship.device.create!(name: "Private iPhone 6", udid: "5814abb3...")
244
- ```
245
-
246
- ## Enterprise
247
-
248
- ```ruby
249
- # Use the InHouse class to get all enterprise certificates
250
- cert = Spaceship.certificate.in_house.all.first
251
-
252
- # Create a new InHouse Enterprise distribution profile
253
- profile = Spaceship.provisioning_profile.in_house.create!(bundle_id: "com.krausefx.*",
254
- certificate: cert)
255
-
256
- # List all In-House Provisioning Profiles
257
- profiles = Spaceship.provisioning_profile.in_house.all
258
- ```
259
-
260
- ## Multiple Spaceships
261
-
262
- Sometimes one `spaceship` just isn't enough. That's why this library has its own Spaceship Launcher to launch and use multiple `spaceships` at the same time :rocket:
263
-
264
- ```ruby
265
- # Launch 2 spaceships
266
- spaceship1 = Spaceship::Launcher.new("felix@krausefx.com", "password")
267
- spaceship2 = Spaceship::Launcher.new("stefan@spaceship.airforce", "password")
268
-
269
- # Fetch all registered devices from spaceship1
270
- devices = spaceship1.device.all
271
-
272
- # Iterate over the list of available devices
273
- # and register each device from the first account also on the second one
274
- devices.each do |device|
275
- spaceship2.device.create!(name: device.name, udid: device.udid)
276
- end
277
- ```
278
-
279
- ## More cool things you can do
280
- ```ruby
281
- # Find a profile with a specific name
282
- profile = Spaceship.provisioning_profile.development.all.find { |p| p.name == "Name" }
283
-
284
- # Add all available devices to the profile
285
- profile.devices = Spaceship.device.all
286
-
287
- # Push the changes back to the Apple Developer Portal
288
- profile.update!
289
-
290
- # Get the currently used team_id
291
- Spaceship.client.team_id
292
-
293
- # We generally don't want to be destructive, but you can also delete things
294
- # This method might fail for various reasons, e.g. app is already in the store
295
- app = Spaceship.app.find("com.krausefx.app")
296
- app.delete!
297
- ```
298
-
299
- ## Spaceship in use
300
-
301
- The beta version of [sigh](https://github.com/KrauseFx/sigh) is already using `spaceship` to communicate with Apple's web services. You can see all relevant source code in [runner.rb](https://github.com/KrauseFx/sigh/blob/feature/spaceship/lib/sigh/spaceship/runner.rb).
302
-
303
- ## Full Documentation
109
+ ### Full Documentation
304
110
 
305
111
  The detailed documentation of all available classes is available on [RubyDoc](http://www.rubydoc.info/github/fastlane/spaceship/frames).
306
112
 
307
- ## Example Data
308
-
309
- Some unnecessary information was removed, check out [provisioning_profile.rb](https://github.com/KrauseFx/spaceship/blob/master/lib/spaceship/provisioning_profile.rb) for all available attributes.
310
-
311
- The example data below is a provisioning profile, containing a device, certificate and app.
312
-
313
- ```
314
- #<Spaceship::ProvisioningProfile::AdHoc
315
- @devices=[
316
- #<Spaceship::Device
317
- @id="5YTNZ5A9AA",
318
- @name="Felix iPhone 6",
319
- @udid="39d2cab02642dc2bfdbbff4c0cb0e50c8632faaa"
320
- >, ...],
321
- @certificates=[
322
- #<Spaceship::Certificate::Production
323
- @id="LHNT9C2AAA",
324
- @name="iOS Distribution",
325
- @expires=#<DateTime: 2016-02-10T23:44:20>
326
- ],
327
- @id="72SRVUNAAA",
328
- @uuid="43cda0d6-04a5-4964-89c0-a24b5f258aaa",
329
- @expires=#<DateTime: 2016-02-10T23:44:20>,
330
- @distribution_method="adhoc",
331
- @name="com.krausefx.app AppStore",
332
- @status="Active",
333
- @platform="ios",
334
- @app=#<Spaceship::App
335
- @app_id="2UMR2S6AAA",
336
- @name="App Name",
337
- @platform="ios",
338
- @bundle_id="com.krausefx.app",
339
- @is_wildcard=false>
340
- >
341
- >
342
- ```
343
-
344
113
  # Technical Details
345
114
 
346
115
  ## HTTP Client
@@ -354,7 +123,6 @@ Advantages of `spaceship` (HTTP client) over web scraping:
354
123
  - Great test coverage by stubbing server responses
355
124
  - Resistant against design changes of the Apple Developer Portal
356
125
  - Automatic re-trying of requests in case a timeout occurs
357
- - By stubbing the `spaceship` objects it is possible to also implement tests for tools like [sigh](https://github.com/KrauseFx/sigh)
358
126
 
359
127
  ## API Endpoints
360
128
 
@@ -372,6 +140,11 @@ I won't go into too much technical details about the various API endpoints, but
372
140
  - Repair provisioning profiles
373
141
  - Download provisioning profiles
374
142
  - Team selection
143
+ - `https://itunesconnect.apple.com`:
144
+ - Managing apps
145
+ - Managing beta testers
146
+ - Submitting updates to review
147
+ - Manaing app metadata
375
148
 
376
149
  `spaceship` uses all those API points to offer this seamless experience.
377
150
 
@@ -389,13 +162,22 @@ I won't go into too much technical details about the various API endpoints, but
389
162
 
390
163
  # Credits
391
164
 
392
- This project has been sponsored by [ZeroPush](https://zeropush.com). `spaceship` was developed by [@snatchev](https://twitter.com/snatchev/) and [@KrauseFx](https://twitter.com/KrauseFx).
165
+ The initial release was sponsored by [ZeroPush](https://zeropush.com).
166
+
167
+ `spaceship` was developed by
168
+ - [@KrauseFx](https://twitter.com/KrauseFx).
169
+ - [@snatchev](https://twitter.com/snatchev/)
170
+ - [@mathcarignani](https://twitter.com/mathcarignani/)
171
+
172
+ [Open full list of contributors](https://github.com/fastlane/spaceship/graphs/contributors).
393
173
 
394
174
  ##### [Like this tool? Be the first to know about updates and new fastlane tools](https://tinyletter.com/krausefx)
395
175
 
396
176
  # License
397
177
  This project is licensed under the terms of the MIT license. See the LICENSE file.
398
178
 
179
+ > This project and all fastlane tools are in no way affiliated with Apple Inc. This project is open source under the MIT license, which means you have full access to the source code and can modify it to fit your own needs. All fastlane tools run on your own computer or server, so your credentials or other sensitive information will never leave your own computer. You are responsible for how you use fastlane tools.
180
+
399
181
  # Contributing
400
182
 
401
183
  1. Create an issue to start a discussion about your idea
@@ -184,13 +184,50 @@ module Spaceship
184
184
  @client
185
185
  end
186
186
 
187
+ #####################################################
188
+ # @!group Storing the `attr_accessor`
189
+ #####################################################
190
+
191
+ # From https://stackoverflow.com/questions/2487333/fastest-one-liner-way-to-list-attr-accessors-in-ruby
192
+ # This will store a list of defined attr_accessors to easily access them when inspecting the values
193
+ def self.attr_accessor(*vars)
194
+ @attributes ||= []
195
+ @attributes.concat vars
196
+ super(*vars)
197
+ end
198
+
199
+ def self.attributes
200
+ @attributes ||= []
201
+ par = []
202
+
203
+ par = (self.superclass.attributes || []) unless (self == Base)
204
+
205
+ @attributes + par
206
+ end
207
+
208
+ def attributes
209
+ self.class.attributes
210
+ end
211
+
212
+ #####################################################
213
+ # @!group Inspect related code
214
+ #####################################################
215
+
187
216
  def inspect
188
- inspectables = instance_variables - [:@client]
189
- inspect_vars = inspectables.map do |ivar|
190
- val = instance_variable_get(ivar)
191
- "#{ivar}=#{val.inspect}"
192
- end
193
- "\n#<#{self.class.name}\n\t#{inspect_vars.join("\n\t")}>"
217
+ inspectables = self.attributes
218
+
219
+ value = inspectables.map do |k|
220
+ v = self.send(k).inspect
221
+ v.gsub!("\n", "\n\t") # to align nested elements
222
+
223
+ "\t#{k}=#{v}"
224
+ end.join(", \n")
225
+
226
+ "<#{self.class.name} \n#{value}>"
227
+ end
228
+
229
+ def to_s
230
+ self.inspect
194
231
  end
195
232
  end
196
233
  end
@@ -97,7 +97,7 @@ module Spaceship
97
97
  attr_accessor :review_notes
98
98
 
99
99
  ####
100
- # Localized values:
100
+ # Localized values
101
101
  ####
102
102
 
103
103
  # @return (Array) Raw access the all available languages. You shouldn't use it probbaly
@@ -40,10 +40,6 @@ module Spaceship
40
40
  # nil
41
41
  attr_accessor :app_icon_preview_url
42
42
 
43
- # @return [Array] A list of binaries which are not even yet processing based on the version
44
- # Those builds are usually the ones that are just stuck on iTunes Connect...
45
- attr_accessor :pre_processing_builds
46
-
47
43
  attr_mapping(
48
44
  'adamId' => :apple_id,
49
45
  'name' => :name,
@@ -54,7 +50,7 @@ module Spaceship
54
50
  'issuesCount' => :issues_count,
55
51
  'iconUrl' => :app_icon_preview_url
56
52
  )
57
-
53
+
58
54
  class << self
59
55
  # Create a new object based on a hash.
60
56
  # This is used to create a new object based on the server response.
@@ -162,8 +158,9 @@ module Spaceship
162
158
  Tunes::BuildTrain.all(self, self.apple_id)
163
159
  end
164
160
 
165
- # @return [Array] A list of all pre-processing builds
161
+ # @return [Array]A list of binaries which are not even yet processing based on the version
166
162
  # These are all build that have no information except the upload date
163
+ # Those builds can also be the builds that are stuck on iTC.
167
164
  def pre_processing_builds
168
165
  data = client.build_trains(apple_id) # we need to fetch all trains here to get the builds
169
166
 
@@ -102,7 +102,8 @@ module Spaceship
102
102
  def setup
103
103
  super
104
104
 
105
- @external_testing_enabled = (self.external_expiry_date || 0) > 0
105
+ self.external_expiry_date ||= 0
106
+ @external_testing_enabled = self.external_expiry_date > 0
106
107
  end
107
108
 
108
109
  # This will submit this build for TestFlight beta review
@@ -90,16 +90,14 @@ module Spaceship
90
90
  # @param email (String) (required): The email of the new tester
91
91
  # @param first_name (String) (optional): The first name of the new tester
92
92
  # @param last_name (String) (optional): The last name of the new tester
93
- # @param group (String) (optional): The name of the group this tester should be added to
94
93
  # @example
95
94
  # Spaceship::Tunes::Tester.external.create!(email: "tester@mathiascarignani.com", first_name: "Cary", last_name:"Bennett")
96
95
  # @return (Tester): The newly created tester
97
- def create!(email: nil, first_name: nil, last_name: nil, group: nil)
96
+ def create!(email: nil, first_name: nil, last_name: nil)
98
97
  data = client.create_tester!(tester: self,
99
98
  email: email,
100
99
  first_name: first_name,
101
- last_name: last_name,
102
- group: group)
100
+ last_name: last_name)
103
101
  self.factory(data)
104
102
  end
105
103
 
@@ -126,7 +124,6 @@ module Spaceship
126
124
  # Add all testers to the app received
127
125
  # @param app_id (String) (required): The app id to filter the testers
128
126
  def add_all_to_app!(app_id)
129
- # TODO: Change to not make one request for each tester
130
127
  all.each do |tester|
131
128
  begin
132
129
  tester.add_to_app!(app_id)
@@ -342,8 +342,7 @@ module Spaceship
342
342
  parse_response(r, 'data')['users']
343
343
  end
344
344
 
345
- # @param group (String) an optional group name
346
- def create_tester!(tester: nil, email: nil, first_name: nil, last_name: nil, group: nil)
345
+ def create_tester!(tester: nil, email: nil, first_name: nil, last_name: nil)
347
346
  url = tester.url[:create]
348
347
  raise "Action not provided for this tester type." unless url
349
348
 
@@ -361,15 +360,6 @@ module Spaceship
361
360
  value: true
362
361
  }
363
362
  }
364
-
365
- if group
366
- tester_data[:groups] = [{
367
- id: nil,
368
- name: {
369
- value: group
370
- }
371
- }]
372
- end
373
363
 
374
364
  data = { testers: [tester_data] }
375
365
 
@@ -1,3 +1,3 @@
1
1
  module Spaceship
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
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.3.0
4
+ version: 0.3.1
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-07-20 00:00:00.000000000 Z
12
+ date: 2015-07-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: credentials_manager