fastlane 2.157.4 → 2.162.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +80 -80
  3. data/cert/lib/cert/options.rb +28 -1
  4. data/cert/lib/cert/runner.rb +50 -33
  5. data/deliver/lib/deliver/app_screenshot_iterator.rb +4 -4
  6. data/deliver/lib/deliver/options.rb +17 -1
  7. data/deliver/lib/deliver/runner.rb +36 -7
  8. data/deliver/lib/deliver/upload_metadata.rb +37 -6
  9. data/deliver/lib/deliver/upload_price_tier.rb +7 -2
  10. data/deliver/lib/deliver/upload_screenshots.rb +25 -8
  11. data/{pilot/lib/pilot/.manager.rb.swp → fastlane/lib/fastlane/.erb_template_helper.rb.swp} +0 -0
  12. data/fastlane/lib/fastlane/actions/{.ensure_git_status_clean.rb.swp → .git_commit.rb.swp} +0 -0
  13. data/fastlane/lib/fastlane/actions/actions_helper.rb +20 -1
  14. data/fastlane/lib/fastlane/actions/app_store_connect_api_key.rb +6 -1
  15. data/fastlane/lib/fastlane/actions/clean_build_artifacts.rb +1 -0
  16. data/fastlane/lib/fastlane/actions/docs/capture_android_screenshots.md +2 -2
  17. data/fastlane/lib/fastlane/actions/docs/capture_ios_screenshots.md +1 -1
  18. data/fastlane/lib/fastlane/actions/docs/create_app_online.md +1 -1
  19. data/fastlane/lib/fastlane/actions/docs/frame_screenshots.md +3 -2
  20. data/fastlane/lib/fastlane/actions/docs/run_tests.md +2 -2
  21. data/fastlane/lib/fastlane/actions/docs/sync_code_signing.md +3 -3
  22. data/fastlane/lib/fastlane/actions/docs/upload_to_play_store.md +2 -2
  23. data/fastlane/lib/fastlane/actions/docs/upload_to_testflight.md +2 -2
  24. data/fastlane/lib/fastlane/actions/download_dsyms.rb +32 -7
  25. data/fastlane/lib/fastlane/actions/ensure_git_status_clean.rb +13 -2
  26. data/fastlane/lib/fastlane/helper/git_helper.rb +2 -0
  27. data/fastlane/lib/fastlane/swift_fastlane_api_generator.rb +6 -4
  28. data/fastlane/lib/fastlane/swift_fastlane_function.rb +1 -1
  29. data/fastlane/lib/fastlane/version.rb +1 -1
  30. data/fastlane/swift/Actions.swift +2 -1
  31. data/fastlane/swift/Appfile.swift +2 -4
  32. data/fastlane/swift/ArgumentProcessor.swift +2 -6
  33. data/fastlane/swift/ControlCommand.swift +2 -5
  34. data/fastlane/swift/Deliverfile.swift +5 -2
  35. data/fastlane/swift/DeliverfileProtocol.swift +15 -4
  36. data/fastlane/swift/Fastfile.swift +5 -1
  37. data/fastlane/swift/Fastlane.swift +2333 -2240
  38. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.pbxproj +5 -5
  39. data/fastlane/swift/Gymfile.swift +5 -2
  40. data/fastlane/swift/GymfileProtocol.swift +6 -3
  41. data/fastlane/swift/LaneFileProtocol.swift +42 -29
  42. data/fastlane/swift/MainProcess.swift +77 -0
  43. data/fastlane/swift/Matchfile.swift +5 -2
  44. data/fastlane/swift/MatchfileProtocol.swift +21 -6
  45. data/fastlane/swift/Plugins.swift +2 -1
  46. data/fastlane/swift/Precheckfile.swift +5 -2
  47. data/fastlane/swift/PrecheckfileProtocol.swift +18 -3
  48. data/fastlane/swift/RubyCommand.swift +2 -6
  49. data/fastlane/swift/RubyCommandable.swift +2 -6
  50. data/fastlane/swift/Runner.swift +5 -9
  51. data/fastlane/swift/RunnerArgument.swift +2 -6
  52. data/fastlane/swift/Scanfile.swift +5 -2
  53. data/fastlane/swift/ScanfileProtocol.swift +6 -3
  54. data/fastlane/swift/Screengrabfile.swift +5 -2
  55. data/fastlane/swift/ScreengrabfileProtocol.swift +6 -3
  56. data/fastlane/swift/Snapshotfile.swift +5 -2
  57. data/fastlane/swift/SnapshotfileProtocol.swift +6 -3
  58. data/fastlane/swift/SocketClient.swift +3 -7
  59. data/fastlane/swift/SocketClientDelegateProtocol.swift +2 -6
  60. data/fastlane/swift/SocketResponse.swift +2 -6
  61. data/fastlane/swift/formatting/Brewfile.lock.json +18 -10
  62. data/fastlane/swift/main.swift +4 -8
  63. data/fastlane/swift/upgrade_manifest.json +1 -1
  64. data/fastlane_core/lib/fastlane_core/analytics/analytics_session.rb +6 -7
  65. data/fastlane_core/lib/fastlane_core/keychain_importer.rb +2 -2
  66. data/frameit/lib/frameit/editor.rb +1 -0
  67. data/match/lib/match/generator.rb +6 -1
  68. data/match/lib/match/importer.rb +44 -8
  69. data/match/lib/match/migrate.rb +13 -2
  70. data/match/lib/match/nuke.rb +65 -22
  71. data/match/lib/match/options.rb +27 -2
  72. data/match/lib/match/runner.rb +38 -10
  73. data/match/lib/match/spaceship_ensure.rb +27 -21
  74. data/match/lib/match/storage/google_cloud_storage.rb +20 -3
  75. data/match/lib/match/storage/s3_storage.rb +19 -3
  76. data/pilot/lib/pilot/options.rb +2 -2
  77. data/precheck/lib/precheck/options.rb +25 -0
  78. data/precheck/lib/precheck/rule_processor.rb +94 -60
  79. data/precheck/lib/precheck/runner.rb +26 -5
  80. data/sigh/lib/sigh/options.rb +21 -0
  81. data/sigh/lib/sigh/runner.rb +80 -38
  82. data/snapshot/lib/assets/SnapshotHelper.swift +17 -2
  83. data/spaceship/README.md +1 -1
  84. data/spaceship/lib/spaceship/{connect_api/.DS_Store → .DS_Store} +0 -0
  85. data/spaceship/lib/spaceship/client.rb +2 -1
  86. data/spaceship/lib/spaceship/connect_api.rb +1 -0
  87. data/spaceship/lib/spaceship/connect_api/api_client.rb +3 -3
  88. data/spaceship/lib/spaceship/connect_api/client.rb +38 -15
  89. data/{fastlane/lib/fastlane/actions/.update_project_provisioning.rb.swp → spaceship/lib/spaceship/connect_api/models/.app_store_version_submission.rb.swp} +0 -0
  90. data/spaceship/lib/spaceship/connect_api/models/app.rb +17 -9
  91. data/spaceship/lib/spaceship/connect_api/models/app_info.rb +1 -0
  92. data/spaceship/lib/spaceship/connect_api/models/app_screenshot.rb +3 -1
  93. data/spaceship/lib/spaceship/connect_api/models/app_screenshot_set.rb +2 -2
  94. data/spaceship/lib/spaceship/connect_api/models/app_store_version.rb +3 -5
  95. data/spaceship/lib/spaceship/connect_api/models/app_store_version_localization.rb +3 -5
  96. data/spaceship/lib/spaceship/connect_api/models/app_store_version_phased_release.rb +21 -0
  97. data/spaceship/lib/spaceship/connect_api/models/beta_tester.rb +2 -1
  98. data/spaceship/lib/spaceship/connect_api/models/certificate.rb +42 -0
  99. data/spaceship/lib/spaceship/connect_api/models/profile.rb +7 -1
  100. data/spaceship/lib/spaceship/connect_api/models/user_invitation.rb +59 -0
  101. data/spaceship/lib/spaceship/connect_api/provisioning/provisioning.rb +28 -2
  102. data/spaceship/lib/spaceship/connect_api/spaceship.rb +3 -2
  103. data/spaceship/lib/spaceship/connect_api/testflight/testflight.rb +13 -0
  104. data/spaceship/lib/spaceship/connect_api/tunes/tunes.rb +29 -9
  105. data/spaceship/lib/spaceship/connect_api/users/users.rb +40 -0
  106. data/spaceship/lib/spaceship/helper/net_http_generic_request.rb +11 -5
  107. metadata +24 -25
  108. data/fastlane/lib/fastlane/actions/.hockey.rb.swp +0 -0
  109. data/fastlane/lib/fastlane/actions/.slack.rb.swp +0 -0
  110. data/fastlane/swift/FastlaneSwiftRunner/FastlaneSwiftRunner.xcodeproj/project.xcworkspace/xcuserdata/josh.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
@@ -165,6 +165,8 @@ open class Snapshot: NSObject {
165
165
  }
166
166
 
167
167
  let screenshot = XCUIScreen.main.screenshot()
168
+ let image = XCUIDevice.shared.orientation.isLandscape ? fixLandscapeOrientation(image: screenshot.image) : screenshot.image
169
+
168
170
  guard var simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return }
169
171
 
170
172
  do {
@@ -174,7 +176,7 @@ open class Snapshot: NSObject {
174
176
  simulator = regex.stringByReplacingMatches(in: simulator, range: range, withTemplate: "")
175
177
 
176
178
  let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png")
177
- try screenshot.pngRepresentation.write(to: path)
179
+ try image.pngData()?.write(to: path, options: .atomic)
178
180
  } catch let error {
179
181
  NSLog("Problem writing screenshot: \(name) to \(screenshotsDir)/\(simulator)-\(name).png")
180
182
  NSLog(error.localizedDescription)
@@ -182,6 +184,19 @@ open class Snapshot: NSObject {
182
184
  #endif
183
185
  }
184
186
 
187
+ class func fixLandscapeOrientation(image: UIImage) -> UIImage {
188
+ if #available(iOS 10.0, *) {
189
+ let format = UIGraphicsImageRendererFormat()
190
+ format.scale = image.scale
191
+ let renderer = UIGraphicsImageRenderer(size: image.size, format: format)
192
+ return renderer.image { context in
193
+ image.draw(in: CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height))
194
+ }
195
+ } else {
196
+ return image
197
+ }
198
+ }
199
+
185
200
  class func waitForLoadingIndicatorToDisappear(within timeout: TimeInterval) {
186
201
  #if os(tvOS)
187
202
  return
@@ -279,4 +294,4 @@ private extension CGFloat {
279
294
 
280
295
  // Please don't remove the lines below
281
296
  // They are used to detect outdated configuration files
282
- // SnapshotHelperVersion [1.23]
297
+ // SnapshotHelperVersion [1.24]
@@ -167,7 +167,7 @@ _spaceship_ uses all those API points to offer this seamless experience.
167
167
  _spaceship_ does a lot of magic to get everything working so neatly:
168
168
 
169
169
  - **Sensible Defaults**: You only have to provide the mandatory information (e.g. new provisioning profiles contain all devices by default)
170
- - **Local Validation**: When pushing changes back to the Apple Dev Portal _spaceship_ will make sure only valid data is sent to Apple (e.g. automatic repairing of provisioning profiles)
170
+ - **Local Validation**: When pushing changes back to the Apple Developer Portal _spaceship_ will make sure only valid data is sent to Apple (e.g. automatic repairing of provisioning profiles)
171
171
  - **Various request/response types**: When working with the different API endpoints, _spaceship_ has to deal with `JSON`, `XML`, `txt`, `plist` and sometimes even `HTML` responses and requests.
172
172
  - **Automatic Pagination**: Even if you have thousands of apps, profiles or certificates, _spaceship_ **can** handle your scale. It was heavily tested by first using _spaceship_ to create hundreds of profiles and then accessing them using _spaceship_.
173
173
  - **Session, Cookie and CSRF token**: All the security aspects are handled by _spaceship_.
@@ -196,7 +196,7 @@ module Spaceship
196
196
  self.new(cookie: another_client.instance_variable_get(:@cookie), current_team_id: another_client.team_id)
197
197
  end
198
198
 
199
- def initialize(cookie: nil, current_team_id: nil, timeout: nil)
199
+ def initialize(cookie: nil, current_team_id: nil, csrf_tokens: nil, timeout: nil)
200
200
  options = {
201
201
  request: {
202
202
  timeout: (ENV["SPACESHIP_TIMEOUT"] || timeout || 300).to_i,
@@ -204,6 +204,7 @@ module Spaceship
204
204
  }
205
205
  }
206
206
  @current_team_id = current_team_id
207
+ @csrf_tokens = csrf_tokens
207
208
  @cookie = cookie || HTTP::CookieJar.new
208
209
 
209
210
  @client = Faraday.new(self.class.hostname, options) do |c|
@@ -15,6 +15,7 @@ require 'spaceship/connect_api/models/device'
15
15
  require 'spaceship/connect_api/models/profile'
16
16
 
17
17
  require 'spaceship/connect_api/models/user'
18
+ require 'spaceship/connect_api/models/user_invitation'
18
19
 
19
20
  require 'spaceship/connect_api/models/app'
20
21
  require 'spaceship/connect_api/models/beta_app_localization'
@@ -17,7 +17,7 @@ module Spaceship
17
17
  #####################################################
18
18
 
19
19
  # Instantiates a client with cookie session or a JWT token.
20
- def initialize(cookie: nil, current_team_id: nil, token: nil, another_client: nil)
20
+ def initialize(cookie: nil, current_team_id: nil, token: nil, csrf_tokens: nil, another_client: nil)
21
21
  params_count = [cookie, token, another_client].compact.size
22
22
  if params_count != 1
23
23
  raise "Must initialize with one of :cookie, :token, or :another_client"
@@ -25,10 +25,10 @@ module Spaceship
25
25
 
26
26
  if token.nil?
27
27
  if another_client.nil?
28
- super(cookie: cookie, current_team_id: current_team_id, timeout: 1200)
28
+ super(cookie: cookie, current_team_id: current_team_id, csrf_tokens: csrf_tokens, timeout: 1200)
29
29
  return
30
30
  end
31
- super(cookie: another_client.instance_variable_get(:@cookie), current_team_id: another_client.team_id)
31
+ super(cookie: another_client.instance_variable_get(:@cookie), current_team_id: another_client.team_id, csrf_tokens: another_client.csrf_tokens)
32
32
  else
33
33
  options = {
34
34
  request: {
@@ -43,25 +43,28 @@ module Spaceship
43
43
  # @param portal_team_id (String) (optional): The Spaceship::Portal team id
44
44
  # @param tunes_team_id (String) (optional): The Spaceship::Tunes team id
45
45
  # @param team_name (String) (optional): The team name
46
+ # @param skip_select_team (Boolean) (optional): Whether to skip automatic selection or prompt for team
46
47
  #
47
48
  # @raise InvalidUserCredentialsError: raised if authentication failed
48
49
  #
49
50
  # @return (Spaceship::ConnectAPI::Client) The client the login method was called for
50
- def self.login(user = nil, password = nil, use_portal: true, use_tunes: true, portal_team_id: nil, tunes_team_id: nil, team_name: nil)
51
+ def self.login(user = nil, password = nil, use_portal: true, use_tunes: true, portal_team_id: nil, tunes_team_id: nil, team_name: nil, skip_select_team: false)
51
52
  portal_client = Spaceship::Portal.login(user, password) if use_portal
52
53
  tunes_client = Spaceship::Tunes.login(user, password) if use_tunes
53
54
 
54
- # Check if environment variables are set for Spaceship::Portal or Spaceship::Tunes to select team
55
- portal_team_id ||= ENV['FASTLANE_TEAM_ID']
56
- portal_team_name = team_name || ENV['FASTLANE_TEAM_NAME']
57
- tunes_team_id ||= ENV['FASTLANE_ITC_TEAM_ID']
58
- tunes_team_name = team_name || ENV['FASTLANE_ITC_TEAM_NAME']
59
-
60
- # The clients will prompt for a team selection if:
61
- # 1. client exists
62
- # 2. team_id and team_name are nil and user belongs to multiple teams
63
- portal_client.select_team(team_id: portal_team_id, team_name: portal_team_name) if portal_client
64
- tunes_client.select_team(team_id: tunes_team_id, team_name: tunes_team_name) if tunes_client
55
+ unless skip_select_team
56
+ # Check if environment variables are set for Spaceship::Portal or Spaceship::Tunes to select team
57
+ portal_team_id ||= ENV['FASTLANE_TEAM_ID']
58
+ portal_team_name = team_name || ENV['FASTLANE_TEAM_NAME']
59
+ tunes_team_id ||= ENV['FASTLANE_ITC_TEAM_ID']
60
+ tunes_team_name = team_name || ENV['FASTLANE_ITC_TEAM_NAME']
61
+
62
+ # The clients will prompt for a team selection if:
63
+ # 1. client exists
64
+ # 2. team_id and team_name are nil and user belongs to multiple teams
65
+ portal_client.select_team(team_id: portal_team_id, team_name: portal_team_name) if portal_client
66
+ tunes_client.select_team(team_id: tunes_team_id, team_name: tunes_team_name) if tunes_client
67
+ end
65
68
 
66
69
  return ConnectAPI::Client.new(tunes_client: tunes_client, portal_client: portal_client)
67
70
  end
@@ -94,8 +97,18 @@ module Spaceship
94
97
  end
95
98
 
96
99
  def portal_team_id
97
- return nil if @portal_client.nil?
98
- return @portal_client.team_id
100
+ if token
101
+ message = [
102
+ "Cannot determine portal team id via the App Store Connect API (yet)",
103
+ "Look to see if you can get the portal team id from somewhere else",
104
+ "View more info in the docs at https://docs.fastlane.tools/app-store-connect-api/"
105
+ ]
106
+ raise message.join('. ')
107
+ elsif @portal_client
108
+ return @portal_client.team_id
109
+ else
110
+ raise "No App Store Connect API token or Portal Client set"
111
+ end
99
112
  end
100
113
 
101
114
  def tunes_team_id
@@ -103,6 +116,16 @@ module Spaceship
103
116
  return @tunes_client.team_id
104
117
  end
105
118
 
119
+ def portal_teams
120
+ return nil if @portal_client.nil?
121
+ return @portal_client.teams
122
+ end
123
+
124
+ def tunes_teams
125
+ return nil if @tunes_client.nil?
126
+ return @tunes_client.teams
127
+ end
128
+
106
129
  def in_house?
107
130
  if token
108
131
  if token.in_house.nil?
@@ -113,7 +136,7 @@ module Spaceship
113
136
  "Or set the 'SPACESHIP_CONNECT_API_IN_HOUSE' environment variable to 'true'",
114
137
  "View more info in the docs at https://docs.fastlane.tools/app-store-connect-api/"
115
138
  ]
116
- raise message.join('\n')
139
+ raise message.join('. ')
117
140
  end
118
141
  return !!token.in_house
119
142
  elsif @portal_client
@@ -16,6 +16,7 @@ module Spaceship
16
16
  attr_accessor :available_in_new_territories
17
17
  attr_accessor :content_rights_declaration
18
18
  attr_accessor :app_store_versions
19
+ attr_accessor :prices
19
20
 
20
21
  module ContentRightsDeclaration
21
22
  USES_THIRD_PARTY_CONTENT = "USES_THIRD_PARTY_CONTENT"
@@ -34,9 +35,15 @@ module Spaceship
34
35
 
35
36
  "contentRightsDeclaration" => "content_rights_declaration",
36
37
 
37
- "appStoreVersions" => "app_store_versions"
38
+ "appStoreVersions" => "app_store_versions",
39
+ "prices" => "prices"
38
40
  })
39
41
 
42
+ ESSENTIAL_INCLUDES = [
43
+ "appStoreVersions",
44
+ "prices"
45
+ ].join(",")
46
+
40
47
  def self.type
41
48
  return "apps"
42
49
  end
@@ -45,7 +52,7 @@ module Spaceship
45
52
  # Apps
46
53
  #
47
54
 
48
- def self.all(filter: {}, includes: "appStoreVersions", limit: nil, sort: nil)
55
+ def self.all(filter: {}, includes: ESSENTIAL_INCLUDES, limit: nil, sort: nil)
49
56
  resps = Spaceship::ConnectAPI.get_apps(filter: filter, includes: includes, limit: limit, sort: sort).all_pages
50
57
  return resps.flat_map(&:to_models)
51
58
  end
@@ -84,13 +91,13 @@ module Spaceship
84
91
  def fetch_live_app_info(includes: Spaceship::ConnectAPI::AppInfo::ESSENTIAL_INCLUDES)
85
92
  states = [
86
93
  Spaceship::ConnectAPI::AppInfo::AppStoreState::READY_FOR_SALE,
94
+ Spaceship::ConnectAPI::AppInfo::AppStoreState::PENDING_APPLE_RELEASE,
87
95
  Spaceship::ConnectAPI::AppInfo::AppStoreState::PENDING_DEVELOPER_RELEASE,
88
96
  Spaceship::ConnectAPI::AppInfo::AppStoreState::PROCESSING_FOR_APP_STORE,
89
97
  Spaceship::ConnectAPI::AppInfo::AppStoreState::IN_REVIEW
90
98
  ]
91
99
 
92
- filter = { app: id }
93
- resp = Spaceship::ConnectAPI.get_app_infos(filter: filter, includes: includes)
100
+ resp = Spaceship::ConnectAPI.get_app_infos(app_id: id, includes: includes)
94
101
  return resp.to_models.select do |model|
95
102
  states.include?(model.app_store_state)
96
103
  end.first
@@ -106,8 +113,7 @@ module Spaceship
106
113
  Spaceship::ConnectAPI::AppInfo::AppStoreState::INVALID_BINARY
107
114
  ]
108
115
 
109
- filter = { app: id }
110
- resp = Spaceship::ConnectAPI.get_app_infos(filter: filter, includes: includes)
116
+ resp = Spaceship::ConnectAPI.get_app_infos(app_id: id, includes: includes)
111
117
  return resp.to_models.select do |model|
112
118
  states.include?(model.app_store_state)
113
119
  end.first
@@ -128,8 +134,6 @@ module Spaceship
128
134
  #
129
135
 
130
136
  def fetch_app_prices(filter: {}, includes: "priceTier", limit: nil, sort: nil)
131
- filter ||= {}
132
- filter[:app] = id
133
137
  resp = Spaceship::ConnectAPI.get_app_prices(app_id: id, filter: filter, includes: includes, limit: limit, sort: sort)
134
138
  return resp.to_models
135
139
  end
@@ -142,6 +146,7 @@ module Spaceship
142
146
  platform ||= Spaceship::ConnectAPI::Platform::IOS
143
147
  filter = {
144
148
  appStoreState: [
149
+ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_APPLE_RELEASE,
145
150
  Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE,
146
151
  Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::IN_REVIEW,
147
152
  Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::WAITING_FOR_REVIEW
@@ -233,7 +238,10 @@ module Spaceship
233
238
  def get_pending_release_app_store_version(platform: nil, includes: Spaceship::ConnectAPI::AppStoreVersion::ESSENTIAL_INCLUDES)
234
239
  platform ||= Spaceship::ConnectAPI::Platform::IOS
235
240
  filter = {
236
- appStoreState: Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE,
241
+ appStoreState: [
242
+ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_APPLE_RELEASE,
243
+ Spaceship::ConnectAPI::AppStoreVersion::AppStoreState::PENDING_DEVELOPER_RELEASE
244
+ ].join(','),
237
245
  platform: platform
238
246
  }
239
247
  return get_app_store_versions(filter: filter, includes: includes).first
@@ -20,6 +20,7 @@ module Spaceship
20
20
  READY_FOR_SALE = "READY_FOR_SALE"
21
21
  PROCESSING_FOR_APP_STORE = "PROCESSING_FOR_APP_STORE"
22
22
  PENDING_DEVELOPER_RELEASE = "PENDING_DEVELOPER_RELEASE"
23
+ PENDING_APPLE_RELEASE = "PENDING_APPLE_RELEASE"
23
24
  IN_REVIEW = "IN_REVIEW"
24
25
  WAITING_FOR_REVIEW = "WAITING_FOR_REVIEW"
25
26
  DEVELOPER_REJECTED = "DEVELOPER_REJECTED"
@@ -111,7 +111,9 @@ module Spaceship
111
111
  timeout_minutes = (ENV["SPACESHIP_SCREENSHOT_UPLOAD_TIMEOUT"] || 20).to_i
112
112
 
113
113
  loop do
114
- puts("Waiting for screenshot to appear before uploading...")
114
+ # This error handling needs to be revised since any error occured can reach here.
115
+ # It should handle errors based on what status code is.
116
+ puts("Waiting for screenshots to appear before uploading. This is unlikely to be recovered unless it's 503 error. error=\"#{error}\"")
115
117
  sleep(30)
116
118
 
117
119
  screenshots = Spaceship::ConnectAPI::AppScreenshotSet
@@ -112,8 +112,8 @@ module Spaceship
112
112
  # API
113
113
  #
114
114
 
115
- def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
116
- resp = Spaceship::ConnectAPI.get_app_screenshot_sets(filter: filter, includes: includes, limit: limit, sort: sort)
115
+ def self.all(app_store_version_localization_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
116
+ resp = Spaceship::ConnectAPI.get_app_screenshot_sets(app_store_version_localization_id: app_store_version_localization_id, filter: filter, includes: includes, limit: limit, sort: sort)
117
117
  return resp.to_models
118
118
  end
119
119
 
@@ -26,6 +26,7 @@ module Spaceship
26
26
  READY_FOR_SALE = "READY_FOR_SALE"
27
27
  PROCESSING_FOR_APP_STORE = "PROCESSING_FOR_APP_STORE"
28
28
  PENDING_DEVELOPER_RELEASE = "PENDING_DEVELOPER_RELEASE"
29
+ PENDING_APPLE_RELEASE = "PENDING_APPLE_RELEASE"
29
30
  IN_REVIEW = "IN_REVIEW"
30
31
  WAITING_FOR_REVIEW = "WAITING_FOR_REVIEW"
31
32
  DEVELOPER_REJECTED = "DEVELOPER_REJECTED"
@@ -114,11 +115,8 @@ module Spaceship
114
115
  return resp.to_models.first
115
116
  end
116
117
 
117
- # appScreenshotSets,appPreviewSets
118
- def get_app_store_version_localizations(filter: {}, includes: "appScreenshotSets", limit: nil, sort: nil)
119
- filter ||= {}
120
- filter["appStoreVersion"] = id
121
- return Spaceship::ConnectAPI::AppStoreVersionLocalization.all(filter: filter, includes: includes, limit: limit, sort: sort)
118
+ def get_app_store_version_localizations(filter: {}, includes: nil, limit: nil, sort: nil)
119
+ return Spaceship::ConnectAPI::AppStoreVersionLocalization.all(app_store_version_id: id, filter: filter, includes: includes, limit: limit, sort: sort)
122
120
  end
123
121
 
124
122
  #
@@ -39,8 +39,8 @@ module Spaceship
39
39
  # API
40
40
  #
41
41
 
42
- def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
43
- resp = Spaceship::ConnectAPI.get_app_store_version_localizations(filter: filter, includes: includes, limit: limit, sort: sort)
42
+ def self.all(app_store_version_id: nil, filter: {}, includes: nil, limit: nil, sort: nil)
43
+ resp = Spaceship::ConnectAPI.get_app_store_version_localizations(app_store_version_id: app_store_version_id, filter: filter, includes: includes, limit: limit, sort: sort)
44
44
  return resp.to_models
45
45
  end
46
46
 
@@ -73,9 +73,7 @@ module Spaceship
73
73
  #
74
74
 
75
75
  def get_app_screenshot_sets(filter: {}, includes: "appScreenshots", limit: nil, sort: nil)
76
- filter ||= {}
77
- filter["appStoreVersionLocalization"] = id
78
- return Spaceship::ConnectAPI::AppScreenshotSet.all(filter: filter, includes: includes, limit: limit, sort: sort)
76
+ return Spaceship::ConnectAPI::AppScreenshotSet.all(app_store_version_localization_id: id, filter: filter, includes: includes, limit: limit, sort: sort)
79
77
  end
80
78
 
81
79
  def create_app_screenshot_set(attributes: nil)
@@ -11,6 +11,9 @@ module Spaceship
11
11
 
12
12
  module PhasedReleaseState
13
13
  INACTIVE = "INACTIVE"
14
+ ACTIVE = "ACTIVE"
15
+ PAUSED = "PAUSED"
16
+ COMPLETE = "COMPLETE"
14
17
  end
15
18
 
16
19
  attr_mapping({
@@ -28,9 +31,27 @@ module Spaceship
28
31
  # API
29
32
  #
30
33
 
34
+ def pause
35
+ update(PhasedReleaseState::PAUSED)
36
+ end
37
+
38
+ def resume
39
+ update(PhasedReleaseState::ACTIVE)
40
+ end
41
+
42
+ def complete
43
+ update(PhasedReleaseState::COMPLETE)
44
+ end
45
+
31
46
  def delete!(filter: {}, includes: nil, limit: nil, sort: nil)
32
47
  Spaceship::ConnectAPI.delete_app_store_version_phased_release(app_store_version_phased_release_id: id)
33
48
  end
49
+
50
+ private def update(state)
51
+ Spaceship::ConnectAPI.patch_app_store_version_phased_release(app_store_version_phased_release_id: id, attributes: {
52
+ phasedReleaseState: state
53
+ }).to_models.first
54
+ end
34
55
  end
35
56
  end
36
57
  end
@@ -35,7 +35,8 @@ module Spaceship
35
35
  #
36
36
 
37
37
  def self.all(filter: {}, includes: nil, limit: nil, sort: nil)
38
- return Spaceship::ConnectAPI.get_beta_testers(filter: filter, includes: includes)
38
+ resps = Spaceship::ConnectAPI.get_beta_testers(filter: filter, includes: includes).all_pages
39
+ return resps.flat_map(&:to_models)
39
40
  end
40
41
 
41
42
  def self.find(email: nil, includes: nil)
@@ -1,4 +1,7 @@
1
1
  require_relative '../model'
2
+
3
+ require 'openssl'
4
+
2
5
  module Spaceship
3
6
  class ConnectAPI
4
7
  class Certificate
@@ -6,6 +9,7 @@ module Spaceship
6
9
 
7
10
  attr_accessor :certificate_content
8
11
  attr_accessor :display_name
12
+ attr_accessor :expiration_date
9
13
  attr_accessor :name
10
14
  attr_accessor :platform
11
15
  attr_accessor :serial_number
@@ -47,6 +51,26 @@ module Spaceship
47
51
  Time.parse(expiration_date) > Time.now
48
52
  end
49
53
 
54
+ # Create a new code signing request that can be used to
55
+ # generate a new certificate
56
+ # @example
57
+ # Create a new certificate signing request
58
+ # csr, pkey = Spaceship.certificate.create_certificate_signing_request
59
+ #
60
+ # # Use the signing request to create a new distribution certificate
61
+ # Spaceship.certificate.production.create!(csr: csr)
62
+ def self.create_certificate_signing_request
63
+ key = OpenSSL::PKey::RSA.new(2048)
64
+ csr = OpenSSL::X509::Request.new
65
+ csr.version = 0
66
+ csr.subject = OpenSSL::X509::Name.new([
67
+ ['CN', 'PEM', OpenSSL::ASN1::UTF8STRING]
68
+ ])
69
+ csr.public_key = key.public_key
70
+ csr.sign(key, OpenSSL::Digest::SHA1.new)
71
+ return [csr, key]
72
+ end
73
+
50
74
  #
51
75
  # API
52
76
  #
@@ -55,6 +79,24 @@ module Spaceship
55
79
  resps = Spaceship::ConnectAPI.get_certificates(filter: filter, includes: includes).all_pages
56
80
  return resps.flat_map(&:to_models)
57
81
  end
82
+
83
+ def self.create(certificate_type: nil, csr_content: nil)
84
+ attributes = {
85
+ certificateType: certificate_type,
86
+ csrContent: csr_content
87
+ }
88
+ resp = Spaceship::ConnectAPI.post_certificate(attributes: attributes)
89
+ return resp.to_models.first
90
+ end
91
+
92
+ def self.get(certificate_id: nil, includes: nil)
93
+ resp = Spaceship::ConnectAPI.get_certificate(certificate_id: certificate_id, includes: includes)
94
+ return resp.to_models.first
95
+ end
96
+
97
+ def delete!
98
+ Spaceship::ConnectAPI.delete_certificate(certificate_id: id)
99
+ end
58
100
  end
59
101
  end
60
102
  end