ash-adb 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +14 -1
- data/lib/ash/adb/client.rb +42 -0
- data/lib/ash/adb/device.rb +11 -0
- data/lib/ash/adb/package.rb +5 -0
- data/lib/ash/adb/version.rb +1 -1
- data/lib/ash/adb.rb +8 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 189ce0215b54ce1e81fd908a40ced6ddb63a2f20
|
4
|
+
data.tar.gz: 769770d1547881b0b3ba63c6a7c4d7c48992c039
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ead681b5facab5f685c613fda8ed87d3eb82b6490043cc5aafe2af3b1ad2d0863226ed7d2c6e38b484b1d4a275afdae935616c19776c77e2fcf91fe45b2bc3f
|
7
|
+
data.tar.gz: e903f6f24a6a5e358a1aae40a23e42a62f58dec65347b3c2f94c97ea858227a35079a2a3c4dc4f40e4e621db2ae94f6bd06e36cb54e80dbfdfe4aaf06588655f
|
data/README.md
CHANGED
@@ -22,7 +22,20 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
### Listing Devices
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
client = Ash::Adb::Client.new
|
29
|
+
devices = client.devices
|
30
|
+
|
31
|
+
devices.first.serial_number
|
32
|
+
=> "emulator-5554"
|
33
|
+
```
|
34
|
+
|
35
|
+
### List Packages for a Device
|
36
|
+
|
37
|
+
TODO
|
38
|
+
|
26
39
|
|
27
40
|
## Development
|
28
41
|
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Ash::Adb
|
2
|
+
class Client
|
3
|
+
def devices
|
4
|
+
devices = []
|
5
|
+
|
6
|
+
devices_output = run('adb devices -l')
|
7
|
+
|
8
|
+
# Device output is newline seperated and we also want to drop the first
|
9
|
+
# line which is the "List of devices attached" string
|
10
|
+
device_strings = devices_output.split("\n").drop(1)
|
11
|
+
|
12
|
+
device_strings.each do |device_string|
|
13
|
+
# At this point a qualified device_string might look something like:
|
14
|
+
#
|
15
|
+
# "emulator-5554 device product:sdk_google_phone_x86 model:Android_SDK_built_for_x86 device:generic_x86"
|
16
|
+
#
|
17
|
+
# So we'll want to split this up and parse it accordingly
|
18
|
+
attributes = device_string.split
|
19
|
+
|
20
|
+
# Now attributes might look like:
|
21
|
+
# ["emulator-5554", "device", "product:sdk_google_phone_x86", "model:Android_SDK_built_for_x86", "device:generic_x86"]
|
22
|
+
serial_number = attributes.shift
|
23
|
+
state = attributes.shift
|
24
|
+
qualifiers = attributes
|
25
|
+
|
26
|
+
devices << Device.new(serial_number, state, qualifiers)
|
27
|
+
end
|
28
|
+
|
29
|
+
devices
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def run(cmd)
|
35
|
+
output, errors, status = Open3.capture3(cmd)
|
36
|
+
|
37
|
+
raise "Error running #{ cmd }: #{ errors.inspect }" unless errors.empty?
|
38
|
+
|
39
|
+
return output
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/ash/adb/version.rb
CHANGED
data/lib/ash/adb.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ash-adb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomek Rabczak
|
@@ -84,6 +84,9 @@ files:
|
|
84
84
|
- bin/console
|
85
85
|
- bin/setup
|
86
86
|
- lib/ash/adb.rb
|
87
|
+
- lib/ash/adb/client.rb
|
88
|
+
- lib/ash/adb/device.rb
|
89
|
+
- lib/ash/adb/package.rb
|
87
90
|
- lib/ash/adb/version.rb
|
88
91
|
homepage: ''
|
89
92
|
licenses: []
|