Module: FIR::Publish

Includes:
ThirdNotifierModule
Included in:
Util::ClassMethods
Defined in:
lib/fir/util/publish.rb

Instance Method Summary collapse

Methods included from ThirdNotifierModule

#dingtalk_notifier, #feishu_notifier, #notify_to_thirds, #wxwork_notifier

Instance Method Details

#fetch_app_infoObject



61
62
63
64
65
66
67
68
69
# File 'lib/fir/util/publish.rb', line 61

def fetch_app_info
  logger.info 'Fetch app info from fir.im'

  fir_app_info = get(fir_api[:app_url] + "/#{@app_id}", api_token: @token)
  write_app_info(id: fir_app_info[:id],
                 short: fir_app_info[:short],
                 name: fir_app_info[:name])
  fir_app_info
end

#publish(*args, options) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fir/util/publish.rb', line 14

def publish(*args, options)
  initialize_publish_options(args, options)
  logger_info_publishing_message

  logger.info 'begin to upload ...'
  logger.info "fir-cli version #{FIR::VERSION} (#{RUBY_VERSION} @ #{RUBY_PLATFORM})"
  # 开始上传

  received_app_info = upload_app

  short = received_app_info[:short]
  download_domain = received_app_info[:download_domain]
  release_id = received_app_info[:release_id]

  logger.info 'end upload'

  logger_info_dividing_line

  download_url = build_download_url(download_domain, short, release_id)
  logger.info "Published succeed: #{download_url}"

  qrcode_path = build_qrcode download_url

  notify_to_thirds(download_url, qrcode_path)

  upload_mapping_file_with_publish

  upload_fir_cli_usage_info(received_app_info)

  logger_info_blank_line

  answer = {
    app_id: @app_id,
    short: short,
    release_id: release_id,
    download_url: download_url,
    time: Time.now.strftime("%F %T%:z")
  }

  if options[:save_uploaded_info]
    write_uploaded_info(answer)
  end

  answer

end