class Fastlane::Helper::AppInstaller

Public Class Methods

new(deviceLabBaseUrl, appName) click to toggle source
# File lib/fastlane/plugin/devicelab_bot/helper/devicelab_bot_helper.rb, line 4
def initialize(deviceLabBaseUrl, appName)
  @appName = appName
  @deviceLabBaseUrl = deviceLabBaseUrl
  @logsCount = 0
end

Public Instance Methods

callGetLogs(buildId) click to toggle source
# File lib/fastlane/plugin/devicelab_bot/helper/devicelab_bot_helper.rb, line 16
def callGetLogs(buildId)
  JSON.parse(RestClient.get("#{@deviceLabBaseUrl}/build/#{buildId}").body)
end
callInstallApp() click to toggle source
# File lib/fastlane/plugin/devicelab_bot/helper/devicelab_bot_helper.rb, line 10
def callInstallApp()
  RestClient.get("#{@deviceLabBaseUrl}/install", {params: {
    'appName': @appName,
  }})
end
checkLogs() click to toggle source
# File lib/fastlane/plugin/devicelab_bot/helper/devicelab_bot_helper.rb, line 34
def checkLogs()
  logs = callGetLogs(@buildId)
  (@logsCount..logs.length).each do |logIndex|
    displayLog logs[logIndex]
    if logs[logIndex] == 'Done'
      @logsChecker.shutdown
      return
    end
  end
  @logsCount = logs.length
end
displayLog(log) click to toggle source
# File lib/fastlane/plugin/devicelab_bot/helper/devicelab_bot_helper.rb, line 20
def displayLog(log)
  if log.nil?
    return
  end
  if log.include? 'Done'
    return UI.success log
  end
  if log.downcase().include? 'error'
    return UI.error log
  end

  UI.message log
end
install() click to toggle source
# File lib/fastlane/plugin/devicelab_bot/helper/devicelab_bot_helper.rb, line 46
def install()
  @buildId = callInstallApp()
  checkLogs
  @logsChecker = Rufus::Scheduler.new
  @logsChecker.every '5s' do
    checkLogs
  end
  @logsChecker.join
end