Class: FIR::AliUploader

Inherits:
AppUploader show all
Defined in:
lib/fir/util/ali_uploader.rb

Constant Summary

Constants included from Config

Config::API_YML_PATH, Config::APP_FILE_TYPE, Config::APP_INFO_PATH, Config::CONFIG_PATH, Config::XCODE_WRAPPER_PATH

Instance Attribute Summary

Attributes inherited from AppUploader

#app_info, #options, #uploading_info, #user_info

Instance Method Summary collapse

Methods inherited from AppUploader

#initialize, #upload

Methods included from Config

#bughd_api, #config, #current_token, #fir_api, #reload_config, #write_app_info, #write_config

Constructor Details

This class inherits a constructor from FIR::AppUploader

Instance Method Details

#upload_binaryObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/fir/util/ali_uploader.rb', line 27

def upload_binary
  try_to_action 'upload binary ...' do
    binary_url = uploading_info[:cert][:binary][:upload_url]
    binary_info = uploading_binary_info

    logger.debug "binary_url = #{binary_url}, binary_info = #{binary_info}"
    headers = uploading_info[:cert][:binary][:custom_headers]
    headers_copy = {
      'CONTENT-DISPOSITION' => headers[:"CONTENT-DISPOSITION"],
      'Content-Type' => headers[:"content-type"],
      'date' => headers[:date],
      'x-oss-date' => headers[:"x-oss-date"],
      'authorization' => headers[:authorization]
    }

    logger.debug headers_copy
    put_file(binary_url, binary_info, headers_copy)
    callback_to_api(callback_url, callback_binary_information)
  end
rescue StandardError => e
  logger.error "binary upload to ali fail, #{e.message}"
  exit 1
end

#upload_iconObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fir/util/ali_uploader.rb', line 8

def upload_icon
  if skip_update_icon?
    logger.info 'skip update icon...'
    return
  end
  try_to_action('upload icon') do
    # 拿到 icon 的授权
    icon_url = uploading_info[:cert][:icon][:upload_url]
    icon_info = uploading_icon_info

    logger.debug "icon_url = #{icon_url}, icon_info = #{icon_info}"
    put_file(icon_url, uploading_icon_info, uploading_info[:cert][:icon][:custom_headers])
    callback_to_api(callback_url, callback_icon_information)
  end
rescue StandardError => e
  # ignore icon error
  logger.info "ignore icon upload error #{e.message}"
end