./lib/shenzhen/plugins/itunesconnect.rb in shenzhen-0.13.2 vs ./lib/shenzhen/plugins/itunesconnect.rb in shenzhen-0.14.0
- old
+ new
@@ -28,31 +28,33 @@
FileUtils.mkdir_p("Package.itmsp")
FileUtils.copy_entry(@ipa, "Package.itmsp/#{@filename}")
File.write("Package.itmsp/metadata.xml", metadata(@apple_id, checksum, size))
- case transport
- when /(error)|(fail)/i
- say_error "An error occurred when trying to upload the build to iTunesConnect.\nRun with --verbose for more info." and abort
- end
+ raise if /(error)|(fail)/i === transport
+ rescue
+ say_error "An error occurred when trying to upload the build to iTunesConnect.\nRun with --verbose for more info." and abort
ensure
FileUtils.rm_rf("Package.itmsp", :secure => true)
end
end
private
def transport
xcode = `xcode-select --print-path`.strip
tool = File.join(File.dirname(xcode), "Applications/Application Loader.app/Contents/MacOS/itms/bin/iTMSTransporter").gsub(/\s/, '\ ')
+ tool = File.join(File.dirname(xcode), "Applications/Application Loader.app/Contents/itms/bin/iTMSTransporter").gsub(/\s/, '\ ') if !File.exist?(tool)
args = [tool, "-m upload", "-f Package.itmsp", "-u #{Shellwords.escape(@account)}", "-p #{Shellwords.escape(@password)}"]
command = args.join(' ')
puts "#{command}" if $verbose
output = `#{command} 2> /dev/null`
puts output.chomp if $verbose
+
+ raise "Failed to upload package to iTunes Connect" unless $?.exitstatus == 0
output
end
def metadata(apple_id, checksum, size)