Class: Deliver::Testflight

Inherits:
Object
  • Object
show all
Defined in:
lib/deliver/testflight.rb

Class Method Summary collapse

Class Method Details

.upload!(ipa_path, app_id, skip_deploy) ⇒ Object

Uploads a new build to Apple TestFlight

Parameters:

  • ipa_path (String)

    a path to the IPA to upload

  • app_id (String)

    optional, the app ID

  • skip_deploy (boolean)

    Should the submission be skipped?



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/deliver/testflight.rb', line 8

def self.upload!(ipa_path, app_id, skip_deploy)
  ItunesTransporter.hide_transporter_output

  app_identifier = IpaFileAnalyser.fetch_app_identifier(ipa_path)
  app_identifier ||= ask("Could not automatically find the app identifier, please enter the app's bundle identifier: ")
  app_id ||= (Deliver::ItunesSearchApi.fetch_by_identifier(app_identifier)['trackId'] rescue nil)
  app_id ||= ask("Could not automatically find the app ID, please enter it here (e.g. 956814360): ")
  strategy = (skip_deploy ? Deliver::IPA_UPLOAD_STRATEGY_JUST_UPLOAD : Deliver::IPA_UPLOAD_STRATEGY_BETA_BUILD)

  Helper.log.info "Ready to upload new build to TestFlight (#{app_identifier} - #{app_id})".green

  # Got everything to replaoy
  app = App.new(app_identifier: app_identifier, apple_id: app_id)
  ipa = IpaUploader.new(app, '/tmp/', ipa_path, strategy)
  result = ipa.upload!
  raise "Error distributing new beta version!".red unless result == true
end