fastlane 2.61.0.beta.20171004010004 → 2.61.0.beta.20171005010003

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: b7a7e043f1eedd4cf47ba20975c6021e59c0765f
4
- data.tar.gz: 70d601fc05fecc6c051c48edeaa7b1de7afeee0b
3
+ metadata.gz: 236dcb93b58f49a091e10d81c830243a3a9986c2
4
+ data.tar.gz: ffd0f7453af88ffcb6ef3f1a96033eb76143873b
5
5
  SHA512:
6
- metadata.gz: 5f0fff7600451e25117e9502a790b76fea596ac9024cd7b3c897ba336a044b365f7d95f3e14d3eeeabc37f1ba149bee73c22a642dd71d2bb227d354a5d6cfc8d
7
- data.tar.gz: 310e21971e62e865f6e15382bcb89453fc05af797ed07ea4121983195d6290b3a54b3cee1e63b22b94d52cbc95f946420521eab32287b877768d38e6bf51af0d
6
+ metadata.gz: 0af0ced3ca5b72d2906455d241c3310c2ea88902ee26491cab168f5f5a2abb968263f6f303001f8405df5e6b585ead6870c673ea2771903a9079a0f408ea0fd0
7
+ data.tar.gz: ea0fe448d91269674f18392c653452235bee4a200697f65cd8c17e22afdb0a5258b4021897edfd07b1d8c5dfd3fe5f0882196a3128a2ca6ad65793d71523b9a5
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
- VERSION = '2.61.0.beta.20171004010004'.freeze
2
+ VERSION = '2.61.0.beta.20171005010003'.freeze
3
3
  DESCRIPTION = "The easiest way to automate beta deployments and releases for your iOS and Android apps".freeze
4
4
  MINIMUM_XCODE_RELEASE = "7.0".freeze
5
5
  end
@@ -6,6 +6,7 @@ require 'logger'
6
6
  require 'spaceship/babosa_fix'
7
7
  require 'spaceship/helper/net_http_generic_request'
8
8
  require 'spaceship/helper/plist_middleware'
9
+ require 'spaceship/helper/rels_middleware'
9
10
  require 'spaceship/ui'
10
11
  require 'tmpdir'
11
12
  require 'cgi'
@@ -259,6 +260,7 @@ module Spaceship
259
260
  c.response :xml, content_type: /\bxml$/
260
261
  c.response :plist, content_type: /\bplist$/
261
262
  c.use :cookie_jar, jar: @cookie
263
+ c.use FaradayMiddleware::RelsMiddleware
262
264
  c.adapter Faraday.default_adapter
263
265
 
264
266
  if ENV['SPACESHIP_DEBUG']
@@ -556,7 +558,7 @@ module Spaceship
556
558
  @csrf_tokens || {}
557
559
  end
558
560
 
559
- def request(method, url_or_path = nil, params = nil, headers = {}, &block)
561
+ def request(method, url_or_path = nil, params = nil, headers = {}, auto_paginate = false, &block)
560
562
  headers.merge!(csrf_tokens)
561
563
  headers['User-Agent'] = USER_AGENT
562
564
 
@@ -569,7 +571,11 @@ module Spaceship
569
571
  params, headers = encode_params(params, headers)
570
572
  end
571
573
 
572
- response = send_request(method, url_or_path, params, headers, &block)
574
+ response = if auto_paginate
575
+ send_request_auto_paginate(method, url_or_path, params, headers, &block)
576
+ else
577
+ send_request(method, url_or_path, params, headers, &block)
578
+ end
573
579
 
574
580
  log_response(method, url_or_path, response)
575
581
 
@@ -700,6 +706,22 @@ module Spaceship
700
706
  end
701
707
  end
702
708
 
709
+ def send_request_auto_paginate(method, url_or_path, params, headers, &block)
710
+ response = send_request(method, url_or_path, params, headers, &block)
711
+ return response unless should_process_next_rel?(response)
712
+ last_response = response
713
+ while last_response.env.rels[:next]
714
+ last_response = send_request(method, last_response.env.rels[:next], params, headers, &block)
715
+ break unless should_process_next_rel?(last_response)
716
+ response.body['data'].concat(last_response.body['data'])
717
+ end
718
+ response
719
+ end
720
+
721
+ def should_process_next_rel?(response)
722
+ response.body.kind_of?(Hash) && response.body['data'].kind_of?(Array)
723
+ end
724
+
703
725
  def encode_params(params, headers)
704
726
  params = Faraday::Utils::ParamsHash[params].to_query
705
727
  headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }.merge(headers)
@@ -0,0 +1,26 @@
1
+ module Faraday
2
+ class Env
3
+ attr_accessor :rels
4
+ end
5
+ end
6
+
7
+ module FaradayMiddleware
8
+ class RelsMiddleware < Faraday::Middleware
9
+ def initialize(app, options = {})
10
+ @app = app
11
+ @options = options
12
+ end
13
+
14
+ def call(environment)
15
+ @app.call(environment).on_complete do |env|
16
+ links = (env.response_headers["Link"] || "").split(', ').map do |link|
17
+ href, name = link.match(/<(.*?)>; rel="(\w+)"/).captures
18
+
19
+ [name.to_sym, href]
20
+ end
21
+
22
+ env.rels = Hash[*links.flatten]
23
+ end
24
+ end
25
+ end
26
+ end
@@ -30,7 +30,7 @@ module Spaceship::TestFlight
30
30
  def get_builds_for_train(app_id: nil, platform: "ios", train_version: nil, retry_count: 0)
31
31
  assert_required_params(__method__, binding)
32
32
  with_retry(retry_count) do
33
- response = request(:get, "providers/#{team_id}/apps/#{app_id}/platforms/#{platform}/trains/#{train_version}/builds")
33
+ response = request(:get, "providers/#{team_id}/apps/#{app_id}/platforms/#{platform}/trains/#{train_version}/builds", nil, {}, true)
34
34
  handle_response(response)
35
35
  end
36
36
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.61.0.beta.20171004010004
4
+ version: 2.61.0.beta.20171005010003
5
5
  platform: ruby
6
6
  authors:
7
7
  - Felix Krause
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2017-10-04 00:00:00.000000000 Z
18
+ date: 2017-10-05 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: slack-notifier
@@ -1349,6 +1349,7 @@ files:
1349
1349
  - spaceship/lib/spaceship/globals.rb
1350
1350
  - spaceship/lib/spaceship/helper/net_http_generic_request.rb
1351
1351
  - spaceship/lib/spaceship/helper/plist_middleware.rb
1352
+ - spaceship/lib/spaceship/helper/rels_middleware.rb
1352
1353
  - spaceship/lib/spaceship/launcher.rb
1353
1354
  - spaceship/lib/spaceship/playground.rb
1354
1355
  - spaceship/lib/spaceship/portal/app.rb