fastlane 2.112.0.beta.20181216200018 → 2.112.0.beta.20181217200025

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: 8589634ba5507345799416a1e8ccd4a291a6e5ee
4
- data.tar.gz: fd9d891edd1377436edb624d8038683c0f488e96
3
+ metadata.gz: a2babe236d0e507ad2badf3fee491a8a84ba4c29
4
+ data.tar.gz: 40f597b30544013f6fc6b2560f85e1ad87935f90
5
5
  SHA512:
6
- metadata.gz: 98ebb5688724ab2c2eaa7af6ed66fb83cccc6c48d298a3f2659d44589fe040d0e949d72402c10af4710d3d9f2153fa1f8815e3bd59d0954b574180da27536155
7
- data.tar.gz: 9ba1aed33a03196b8852b4227fe7605f71945fc560d1d7aa25920ad4c456aff1c61a0a24e12078e0634a8383a8cf962fd4bfed6fdc724021c8aae19330829559
6
+ metadata.gz: 8373b7f1581f6ed32237b90d13b1368ee9b8f4e59eb403e941fe2ee3ffe5ef0200ca0024c72ae50ccdb89d310e32e8648916c714235a0e15421c46e1a1b7b3d3
7
+ data.tar.gz: df62c4dee1e2a5a75b5281d686877374aebc9199e9925c713bbec5ba612b46ad5241eddde90a9ccf9833a6a2da2bfbc42d2944e21055d2e3dc2983d2ac5a4a98
@@ -9,7 +9,8 @@ module Deliver
9
9
 
10
10
  def run(options, screenshots)
11
11
  begin
12
- fastlane_path = FastlaneCore::FastlaneFolder.path
12
+ # Use fastlane folder or default to current directory
13
+ fastlane_path = FastlaneCore::FastlaneFolder.path || "."
13
14
  html_path = self.render(options, screenshots, fastlane_path)
14
15
  rescue => ex
15
16
  UI.error(ex.inspect)
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
- VERSION = '2.112.0.beta.20181216200018'.freeze
2
+ VERSION = '2.112.0.beta.20181217200025'.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
  RUBOCOP_REQUIREMENT = '0.49.1'.freeze
@@ -12,6 +12,7 @@ require_relative 'spaceship/portal/spaceship'
12
12
  require_relative 'spaceship/tunes/tunes'
13
13
  require_relative 'spaceship/tunes/spaceship'
14
14
  require_relative 'spaceship/test_flight'
15
+ require_relative 'spaceship/connect_api'
15
16
 
16
17
  require_relative 'spaceship/module'
17
18
 
@@ -0,0 +1,2 @@
1
+ require 'spaceship/connect_api/client'
2
+ require 'spaceship/connect_api/base'
@@ -0,0 +1,39 @@
1
+ require_relative '../base'
2
+ require_relative '../tunes/tunes_client'
3
+
4
+ module Spaceship
5
+ module ConnectAPI
6
+ class Base < Spaceship::Base
7
+ def self.client
8
+ # Verify there is a client that can be used
9
+ if Spaceship::Tunes.client
10
+ # Initialize new client if new or if team changed
11
+ if @client.nil? || @client.team_id != Spaceship::Tunes.client.team_id
12
+ @client = Client.client_with_authorization_from(Spaceship::Tunes.client)
13
+ end
14
+ end
15
+
16
+ # Need to handle not having a client but this shouldn't ever happen
17
+ raise "Please login using `Spaceship::Tunes.login('user', 'password')`" unless @client
18
+
19
+ @client
20
+ end
21
+
22
+ ##
23
+ # Have subclasses inherit the client from their superclass
24
+ #
25
+ # Essentially, we are making a class-inheritable-accessor as described here:
26
+ # https://apidock.com/rails/v4.2.7/Class/class_attribute
27
+ def self.inherited(subclass)
28
+ this_class = self
29
+ subclass.define_singleton_method(:client) do
30
+ this_class.client
31
+ end
32
+ end
33
+
34
+ def to_json
35
+ raw_data.to_json
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,141 @@
1
+ require_relative '../client'
2
+
3
+ module Spaceship
4
+ module ConnectAPI
5
+ class Client < Spaceship::Client
6
+ ##
7
+ # Spaceship HTTP client for the App Store Connect API.
8
+ #
9
+ # This client is solely responsible for the making HTTP requests and
10
+ # parsing their responses. Parameters should be either named parameters, or
11
+ # for large request data bodies, pass in anything that can resond to
12
+ # `to_json`.
13
+ #
14
+ # Each request method should validate the required parameters. A required parameter is one that would result in 400-range response if it is not supplied.
15
+ # Each request method should make only one request. For more high-level logic, put code in the data models.
16
+
17
+ def self.hostname
18
+ 'https://appstoreconnect.apple.com/iris/v1/'
19
+ end
20
+
21
+ def build_url(path: nil, filter: nil, includes: nil, limit: nil, sort: nil)
22
+ filters = filter.keys.map do |key|
23
+ "&filter[#{key}]=#{filter[key]}"
24
+ end.join("")
25
+ return "#{path}?&include=#{includes}&limit=#{limit}&sort=#{sort}#{filters}"
26
+ end
27
+
28
+ def get_builds(filter: {}, includes: "buildBetaDetail,betaBuildMetrics", limit: 10, sort: "uploadedDate")
29
+ assert_required_params(__method__, binding)
30
+
31
+ # GET
32
+ # https://appstoreconnect.apple.com/iris/v1/builds
33
+ url = build_url(path: "builds", filter: filter, includes: includes, limit: limit, sort: sort)
34
+
35
+ response = request(:get, url)
36
+ handle_response(response)
37
+ end
38
+
39
+ def post_for_testflight_review(build_id: nil)
40
+ assert_required_params(__method__, binding)
41
+
42
+ # POST
43
+ # https://appstoreconnect.apple.com/iris/v1/betaAppReviewSubmissions
44
+ #
45
+ # {"data":{"type":"betaAppReviewSubmissions","relationships":{"build":{"data":{"type":"builds","id":"6f90f04a-3b48-4d4a-9bbd-9475c294a579"}}}}}
46
+
47
+ body = {
48
+ data: {
49
+ type: "betaAppReviewSubmissions",
50
+ relationships: {
51
+ build: {
52
+ data: {
53
+ type: "builds",
54
+ id: build_id
55
+ }
56
+ }
57
+ }
58
+ }
59
+ }
60
+
61
+ response = request(:post) do |req|
62
+ req.url("betaAppReviewSubmissions")
63
+ req.body = body.to_json
64
+ req.headers['Content-Type'] = 'application/json'
65
+ end
66
+ handle_response(response)
67
+ end
68
+
69
+ protected
70
+
71
+ def handle_response(response)
72
+ if (200...300).cover?(response.status) && (response.body.nil? || response.body.empty?)
73
+ return
74
+ end
75
+
76
+ raise InternalServerError, "Server error got #{response.status}" if (500...600).cover?(response.status)
77
+
78
+ unless response.body.kind_of?(Hash)
79
+ raise UnexpectedResponse, response.body
80
+ end
81
+
82
+ raise UnexpectedResponse, response.body['error'] if response.body['error']
83
+
84
+ raise UnexpectedResponse, handle_errors(response) if response.body['errors']
85
+
86
+ raise UnexpectedResponse, "Temporary App Store Connect error: #{response.body}" if response.body['statusCode'] == 'ERROR'
87
+
88
+ return response.body['data'] if response.body['data']
89
+
90
+ return response.body
91
+ end
92
+
93
+ def handle_errors(response)
94
+ # Example error format
95
+ # {
96
+ # "errors" : [ {
97
+ # "id" : "ce8c391e-f858-411b-a14b-5aa26e0915f2",
98
+ # "status" : "400",
99
+ # "code" : "PARAMETER_ERROR.INVALID",
100
+ # "title" : "A parameter has an invalid value",
101
+ # "detail" : "'uploadedDate3' is not a valid field name",
102
+ # "source" : {
103
+ # "parameter" : "sort"
104
+ # }
105
+ # } ]
106
+ # }
107
+
108
+ return response.body['errors'].map do |error|
109
+ "#{error['title']} - #{error['detail']}"
110
+ end.join(" ")
111
+ end
112
+
113
+ private
114
+
115
+ # used to assert all of the named parameters are supplied values
116
+ #
117
+ # @raises NameError if the values are nil
118
+ def assert_required_params(method_name, binding)
119
+ parameter_names = method(method_name).parameters.map { |_, v| v }
120
+ parameter_names.each do |name|
121
+ if local_variable_get(binding, name).nil?
122
+ raise NameError, "`#{name}' is a required parameter"
123
+ end
124
+ end
125
+ end
126
+
127
+ def local_variable_get(binding, name)
128
+ if binding.respond_to?(:local_variable_get)
129
+ binding.local_variable_get(name)
130
+ else
131
+ binding.eval(name.to_s)
132
+ end
133
+ end
134
+
135
+ def provider_id
136
+ return team_id if self.provider.nil?
137
+ self.provider.provider_id
138
+ end
139
+ end
140
+ end
141
+ end
@@ -6,6 +6,8 @@ require_relative 'export_compliance'
6
6
  require_relative 'beta_review_info'
7
7
  require_relative 'build_trains'
8
8
 
9
+ require_relative '../connect_api/base'
10
+
9
11
  module Spaceship
10
12
  module TestFlight
11
13
  class Build < Base
@@ -214,7 +216,11 @@ module Spaceship
214
216
  def submit_for_testflight_review!
215
217
  return if ready_to_test?
216
218
  return if approved?
217
- client.post_for_testflight_review(app_id: app_id, build_id: id, build: self)
219
+
220
+ resp = Spaceship::ConnectAPI::Base.client.get_builds(filter: { expired: false, processingState: "PROCESSING,VALID", version: self.build_version })
221
+ build = resp.first
222
+
223
+ Spaceship::ConnectAPI::Base.client.post_for_testflight_review(build_id: build["id"])
218
224
  end
219
225
 
220
226
  def expire!
@@ -61,17 +61,6 @@ module Spaceship
61
61
  handle_response(response)
62
62
  end
63
63
 
64
- def post_for_testflight_review(app_id: nil, build_id: nil, build: nil)
65
- assert_required_params(__method__, binding)
66
-
67
- response = request(:post) do |req|
68
- req.url("providers/#{team_id}/apps/#{app_id}/builds/#{build_id}/review")
69
- req.body = build.to_json
70
- req.headers['Content-Type'] = 'application/json'
71
- end
72
- handle_response(response)
73
- end
74
-
75
64
  def expire_build(app_id: nil, build_id: nil, build: nil)
76
65
  assert_required_params(__method__, binding)
77
66
 
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.112.0.beta.20181216200018
4
+ version: 2.112.0.beta.20181217200025
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kohki Miki
@@ -27,7 +27,7 @@ authors:
27
27
  autorequire:
28
28
  bindir: bin
29
29
  cert_chain: []
30
- date: 2018-12-16 00:00:00.000000000 Z
30
+ date: 2018-12-17 00:00:00.000000000 Z
31
31
  dependencies:
32
32
  - !ruby/object:Gem::Dependency
33
33
  name: slack-notifier
@@ -1561,6 +1561,9 @@ files:
1561
1561
  - spaceship/lib/spaceship/base.rb
1562
1562
  - spaceship/lib/spaceship/client.rb
1563
1563
  - spaceship/lib/spaceship/commands_generator.rb
1564
+ - spaceship/lib/spaceship/connect_api.rb
1565
+ - spaceship/lib/spaceship/connect_api/base.rb
1566
+ - spaceship/lib/spaceship/connect_api/client.rb
1564
1567
  - spaceship/lib/spaceship/du/du_client.rb
1565
1568
  - spaceship/lib/spaceship/du/upload_file.rb
1566
1569
  - spaceship/lib/spaceship/du/utilities.rb
@@ -1679,24 +1682,24 @@ metadata:
1679
1682
  post_install_message:
1680
1683
  rdoc_options: []
1681
1684
  require_paths:
1685
+ - cert/lib
1686
+ - fastlane/lib
1687
+ - screengrab/lib
1688
+ - fastlane_core/lib
1682
1689
  - match/lib
1683
1690
  - pilot/lib
1684
1691
  - sigh/lib
1692
+ - produce/lib
1693
+ - snapshot/lib
1694
+ - precheck/lib
1695
+ - frameit/lib
1685
1696
  - spaceship/lib
1686
1697
  - scan/lib
1687
- - credentials_manager/lib
1688
- - snapshot/lib
1689
- - produce/lib
1690
- - supply/lib
1691
- - fastlane/lib
1692
- - screengrab/lib
1693
- - cert/lib
1694
- - fastlane_core/lib
1695
1698
  - pem/lib
1696
- - precheck/lib
1697
1699
  - gym/lib
1700
+ - supply/lib
1701
+ - credentials_manager/lib
1698
1702
  - deliver/lib
1699
- - frameit/lib
1700
1703
  required_ruby_version: !ruby/object:Gem::Requirement
1701
1704
  requirements:
1702
1705
  - - ">="