Class: Pilot::BuildManager

Inherits:
Manager
  • Object
show all
Defined in:
lib/pilot/build_manager.rb

Instance Attribute Summary

Attributes inherited from Manager

#config

Instance Method Summary collapse

Methods inherited from Manager

#app, #fetch_app_id, #fetch_app_identifier, #login, #start

Instance Method Details

#list(options) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/pilot/build_manager.rb', line 35

def list(options)
  start(options)
  if config[:apple_id].to_s.length == 0 and config[:app_identifier].to_s.length == 0
    config[:app_identifier] = ask("App Identifier: ")
  end

  builds = app.all_processing_builds + app.builds
  # sort by upload_date
  builds.sort! {|a, b| a.upload_date <=> b.upload_date }
  rows = builds.collect { |build| describe_build(build) }

  puts Terminal::Table.new(
    title: "#{app.name} Builds".green,
    headings: ["Version #", "Build #", "Testing", "Installs", "Sessions"],
    rows: rows
  )
end

#upload(options) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/pilot/build_manager.rb', line 3

def upload(options)
  start(options)

  raise "No ipa file given".red unless config[:ipa]

  Helper.log.info "Ready to upload new build to TestFlight (App: #{app.apple_id})...".green

  plist = FastlaneCore::IpaFileAnalyser.fetch_info_plist_file(config[:ipa]) || {}
  platform = plist["DTPlatformName"]
  platform = "ios" if platform == "iphoneos" # via https://github.com/fastlane/spaceship/issues/247
  package_path = FastlaneCore::IpaUploadPackageBuilder.new.generate(app_id: app.apple_id,
                                                                  ipa_path: config[:ipa],
                                                              package_path: "/tmp",
                                                                  platform: platform)

  transporter = FastlaneCore::ItunesTransporter.new(options[:username])
  result = transporter.upload(app.apple_id, package_path)

  if result
    Helper.log.info "Successfully uploaded the new binary to iTunes Connect"

    unless config[:skip_submission]
      uploaded_build = wait_for_processing_build
      distribute_build(uploaded_build, options)

      Helper.log.info "Successfully distributed build to beta testers 🚀"
    end
  else
    raise "Error uploading ipa file, more information see above".red
  end
end