Sha256: aba3f0fdec4a37e48c0c95796421b67c2d79ca3824f0a56b183887e12d0f9470

Contents?: true

Size: 1.22 KB

Versions: 1

Compression:

Stored size: 1.22 KB

Contents

require 'HTTParty'
require 'clients/mdb_client'

class DeviceDetails


  def get_device_details
    device_names = self.process_android_devices
    android_device_details = find_android_devices(device_names)
    ios_device_details = process_ios_devices
    p "IOS Devices = #{ios_device_details}"
    p "IOS Devices = #{ios_device_details.length}"
    device_details = android_device_details+ios_device_details
    device_details
  end

  def process_android_devices
    devices = `adb devices`
    return MDBClient.new.format_android_devices devices
  end

  def process_ios_devices
    devices = `instruments -s devices | grep 'iPhone'`
    return MDBClient.new.format_ios_devices devices
  end

  def find_android_devices(device_names)
    device_details = []
    device_names.each do |a|
      device_model =  `adb -s #{a['udid']} shell getprop ro.product.model`
      device_os_version =  `adb -s #{a['udid']} shell getprop ro.build.version.release`
      a['deviceName'] = device_model.to_s.rstrip
      a['platformVersion'] = device_os_version.to_s.rstrip
      a["platform"] = "ANDROID"
      device_details.push(a)
    end
    device_details
  end

end

div_details = DeviceDetails.new
details = div_details.get_device_details
p details

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
optimus-runner-0.8.0 lib/optimus-runner/DeviceDetails.rb