Class: Fastlane::Helper::AppInstaller
- Inherits:
-
Object
- Object
- Fastlane::Helper::AppInstaller
- Defined in:
- lib/fastlane/plugin/devicelab_bot/helper/devicelab_bot_helper.rb
Instance Method Summary collapse
- #callGetLogs(buildId) ⇒ Object
- #callInstallApp ⇒ Object
- #checkLogs ⇒ Object
- #displayLog(log) ⇒ Object
-
#initialize(deviceLabBaseUrl, appName) ⇒ AppInstaller
constructor
A new instance of AppInstaller.
- #install ⇒ Object
Constructor Details
#initialize(deviceLabBaseUrl, appName) ⇒ AppInstaller
Returns a new instance of AppInstaller.
4 5 6 7 8 |
# File 'lib/fastlane/plugin/devicelab_bot/helper/devicelab_bot_helper.rb', line 4 def initialize(deviceLabBaseUrl, appName) @appName = appName @deviceLabBaseUrl = deviceLabBaseUrl @logsCount = 0 end |
Instance Method Details
#callGetLogs(buildId) ⇒ Object
16 17 18 |
# 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 ⇒ Object
10 11 12 13 14 |
# File 'lib/fastlane/plugin/devicelab_bot/helper/devicelab_bot_helper.rb', line 10 def callInstallApp() RestClient.get("#{@deviceLabBaseUrl}/install", {params: { 'appName': @appName, }}) end |
#checkLogs ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# 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) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# 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. log end |
#install ⇒ Object
46 47 48 49 50 51 52 53 54 |
# 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 |