class Fastlane::Helper::AdbHelper
Attributes
adb_path[RW]
Path to the adb binary
devices[RW]
All available devices
Public Class Methods
new(adb_path: nil)
click to toggle source
# File fastlane/lib/fastlane/helper/adb_helper.rb, line 18 def initialize(adb_path: nil) android_home = ENV['ANDROID_HOME'] || ENV['ANDROID_SDK_ROOT'] || ENV['ANDROID_SDK'] if (adb_path.nil? || adb_path == "adb") && android_home adb_path = File.join(android_home, "platform-tools", "adb") end self.adb_path = adb_path end
Public Instance Methods
device_avalaible?(serial)
click to toggle source
# File fastlane/lib/fastlane/helper/adb_helper.rb, line 33 def device_avalaible?(serial) load_all_devices return devices.map(&:serial).include?(serial) end
load_all_devices()
click to toggle source
# File fastlane/lib/fastlane/helper/adb_helper.rb, line 38 def load_all_devices self.devices = [] command = [adb_path.shellescape, "devices"].join(" ") output = Actions.sh(command, log: false) output.split("\n").each do |line| if (result = line.match(/(.*)\tdevice$/)) self.devices << AdbDevice.new(serial: result[1]) end end self.devices end
trigger(command: nil, serial: nil)
click to toggle source
Run a certain action
# File fastlane/lib/fastlane/helper/adb_helper.rb, line 27 def trigger(command: nil, serial: nil) android_serial = serial != "" ? "ANDROID_SERIAL=#{serial}" : nil command = [android_serial, adb_path.shellescape, command].join(" ").strip Action.sh(command) end