Class: Mysigner::Export::Exporter

Inherits:
Object
  • Object
show all
Defined in:
lib/mysigner/export/exporter.rb

Defined Under Namespace

Classes: ExportError

Instance Method Summary collapse

Constructor Details

#initialize(archive_path, output_dir: nil) ⇒ Exporter

Returns a new instance of Exporter.



12
13
14
15
16
17
# File 'lib/mysigner/export/exporter.rb', line 12

def initialize(archive_path, output_dir: nil)
  @archive_path = File.expand_path(archive_path)
  @output_dir = output_dir || File.dirname(@archive_path)

  validate_archive!
end

Instance Method Details

#export!(method: :appstore, team_id: nil, signing_style: 'automatic') ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/mysigner/export/exporter.rb', line 19

def export!(method: :appstore, team_id: nil, signing_style: 'automatic')
  say_exporting(method)

  # Generate export options plist
  options_plist = generate_export_options(method, team_id, signing_style)

  begin
    # Run xcodebuild -exportArchive
    success = execute_export(options_plist)

    raise ExportError, 'Export failed. Check output above for errors.' unless success

    # Find the generated .ipa file
    ipa_path = find_ipa_file

    raise ExportError, "Export reported success but .ipa file not found in: #{@output_dir}" unless ipa_path

    ipa_path
  ensure
    # Clean up temp plist
    File.delete(options_plist) if options_plist && File.exist?(options_plist)
  end
end