Class: Fastlane::Helper::EmergeHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/emerge/helper/emerge_helper.rb

Class Method Summary collapse

Class Method Details

.perform_upload(upload_url, upload_id, file_path) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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}")
    return upload_id
  else
    UI.error("Upload failed")
  end
  return nil
end