class Fastlane::Helper::EmergeHelper

Public Class Methods

perform_upload(upload_url, upload_id, file_path) click to toggle source
# File lib/fastlane/plugin/emerge/helper/emerge_helper.rb, line 9
def self.perform_upload(upload_url, upload_id, file_path)
  UI.message("Starting upload")
  response = Faraday.put(upload_url) do |req|
    req.headers['Content-Type'] = 'application/zip'
    req.headers['Content-Length'] = "#{File.size(file_path)}"
    req.body = Faraday::UploadIO.new(file_path, 'application/zip')
  end
  case response.status
  when 200
    UI.success("Your app is processing, you can find the results at https://emergetools.com/build/#{upload_id}")
  else
    UI.error("Upload failed")
  end
end