Class: FWToolkit::Ota

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/fwtoolkit/cli/ota.rb

Instance Method Summary collapse

Methods included from Thor::Actions

#run, #run!, #run_base, #template_directory

Instance Method Details

#sign(project_root) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/fwtoolkit/cli/ota.rb', line 41

def sign(project_root)
  invoke FWToolkit::Xcode, 'build', [project_root], :clean => true, :archive => true, :type => 'testing', :sdk => 'iphoneos'
  Projectfile.load! project_root

  if options[:sign]
    XcodeBuild.create_ipa xcarchive_path, ipa_path, Projectfile.dev_id, Projectfile.provisioning_profile
  else
    XcodeBuild.create_ipa xcarchive_path, ipa_path
  end

  say_status :created, "IPA at: #{ipa_path} signed with developer id: #{dev_id}", :green
end

#upload(project_root) ⇒ Object

Raises:

  • (Thor::Error)


59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/fwtoolkit/cli/ota.rb', line 59

def upload(project_root)
  if options[:sign]
    invoke('sign')
  else
    invoke FWToolkit::Xcode, 'build', [project_root], :clean => true, :archive => true, :type => 'testing', :sdk => 'iphoneos'
  end

  Projectfile.load! project_root

  raise Thor::Error, "Unable to find the xcarchive file at path: #{ipa}" unless File.exists?(ipa_path)
  raise Thor::Error, "Unable to find the dSYM file at path: #{dsym}" unless File.exists?(dsym_path)

  uploader = FWToolkit::OTA::HockeyappClient.new(Config.hockeyapp_api_token, Projectfile.app_token)

  begin
    uploader.upload_build ipa_path, dsym_path
  rescue StandardError => e
    say_status :error, "Error uploading to hockeyapp: #{e.message}", :red
  end

  say_status :upload, "Uploaded a new version to Hockeyapp", :green
end