Class: AndroidDeploy

Inherits:
Object
  • Object
show all
Defined in:
lib/AndroidDeploy.rb

Instance Method Summary collapse

Constructor Details

#initializeAndroidDeploy

Returns a new instance of AndroidDeploy.



3
4
5
6
# File 'lib/AndroidDeploy.rb', line 3

def initialize
  init = `which adb`
  puts "Missing adb" if init.length < 1
end

Instance Method Details

#connected_devicesObject



8
9
10
11
12
13
14
15
16
# File 'lib/AndroidDeploy.rb', line 8

def connected_devices
  devices = []
  stdout = `adb devices`
  line = stdout.split("\n")
  (1..line.length-1).each do |n|
    devices << line[n].split(" ")[0]
  end
  devices
end

#install_apk(device, filename) ⇒ Object



26
27
28
29
# File 'lib/AndroidDeploy.rb', line 26

def install_apk(device, filename)
    puts "Device Name : #{device}"
    `adb -s #{device} install #{filename}`
end

#install_pkg_all_devices(filename) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/AndroidDeploy.rb', line 18

def install_pkg_all_devices(filename)
  devices = connected_devices
  puts "Installing"
  devices.each do |d|
    install_apk(d, filename)
 end
end