Module: XcodedBuild

Defined in:
lib/fwtoolkit/cli/ota.rb

Class Method Summary collapse

Class Method Details

.create_ipa(xcarchive_path, ipa_output, dev_id = nil, provisionin_profile = nil) ⇒ Object

Raises:

  • (Thor::Error)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/fwtoolkit/cli/ota.rb', line 10

def self.create_ipa(xcarchive_path, ipa_output, dev_id=nil, provisionin_profile=nil)
  provisioning_profile = File.expand_path provisioning_profile
  raise Thor::Error, "Unable to locate the provisioning profile: #{provisioning_profile}" unless File.exists?(provisioning_profile)

  app_path = find_unique! xcarchive_path, '*.app'
  raise Thor::Error, "Unable to find any .app file at path: #{xcarchive_path}" unless app_path

  ipa_output = File.expand_path ipa_output

  cmd_line = "xcrun -sdk iphoneos PackageApplication -v #{app_path} -o #{ipa_output}"
  cmd_line += "--sign #{dev_id}" if dev_id
  cmd_line += "--embed #{provisioning_profile}" if provisioning_profile
  run! "xcrun -sdk iphoneos PackageApplication -v #{app_path} -o #{ipa_output}"
end

.find_unique!(root, file) ⇒ Object

Raises:

  • (Thor::Error)


25
26
27
28
29
# File 'lib/fwtoolkit/cli/ota.rb', line 25

def self.find_unique!(root, file)
  files_in_root = Dir["#{root}/**/#{file}"]
  raise Thor::Error, "Found more than one \"#{file}\" at path: #{root}" if apps_in_root.size > 1
  files_in_root.size > 0 ? File.expand_path(files_in_root.first) : nil
end