PGYER / fastlane-plugin-pgyer

Distribute app to pgyer beta testing service with fastlane!
http://www.pgyer.com
MIT License
62 stars 30 forks source link

pyger上传成功后,如何获取下载地址? #20

Closed deankwankkk closed 2 years ago

deankwankkk commented 2 years ago

通过插件,上传到pyger平台成功后,如何获取pyger的下载地址?

jicheng1014 commented 2 years ago

老哥 你可以在 Fastfile 里使用 ruby 语法的 pgyer 返回 BuildInfo 的信息 你可以 puts 出来

如果你不熟悉ruby 语法, 也可以用命令行捕捉 fastlane 的输出 grep 'Upload success. Visit this URL to see:'

deankwankkk commented 2 years ago

老哥 你可以在 Fastfile 里使用 ruby 语法的 pgyer 返回 BuildInfo 的信息 你可以 puts 出来

如果你不熟悉ruby 语法, 也可以用命令行捕捉 fastlane 的输出 grep 'Upload success. Visit this URL to see:'

的确不熟悉ruby,谢谢大神

jifang commented 1 year ago

FYI

... ...
    temp_file = 'builds/pgy_output.log'
    UtilHelper.redirect_stdout_to_file(temp_file) {
      pgyer(api_key: "api_key")
    }
    File.readlines(temp_file).each do |line|
      if line.include? "Upload success. BuildInfo is"
        match = line.match(/(\{.*\})/)
        map = JSON.parse match[1].gsub('=>', ':')
        puts(map)
      end
    end
... ...
class UtilHelper
  # Redirects standard output and standard error to a file
  # (currently only way we know how to capture fastlane ui messages)
  def self.redirect_stdout_to_file(filename)
    original_stdout = $stdout.clone
    original_stderr = $stderr.clone
    $stderr.reopen File.new(filename, 'w')
    $stdout.reopen File.new(filename, 'w')
    yield
  ensure
    $stdout.reopen original_stdout
    $stderr.reopen original_stderr
  end
end