ash-adb 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a52af17e597ab4951d220230dec7c4dbf3816f6
4
- data.tar.gz: 89fa65f1f4b2f8a46955700c8e403dd9a5df1eae
3
+ metadata.gz: 22a7ed9832cafd39a43bffb09b917c6f223707f7
4
+ data.tar.gz: 58564cbdd2b69fdeb1147cf3b135ad09ca02afda
5
5
  SHA512:
6
- metadata.gz: 6968767c4272d4551d17773de0794690a1f7f86da5ec5efbf83f243697f42cdf5083bb577dc45499780fef0f45cf96f5399c231116ea9d04fc4ec51af35162c9
7
- data.tar.gz: 3aaadccb13fad01b2cebb13307b4789d891c8a3ba34381495481e96e30638aaeea425ffb883b0b3586731868ce3aa37f5b91a769a175467f8b3e6a59ff3a2bf4
6
+ metadata.gz: 5eec3444d84910d815e7247d0b5e6da1f88471b750f287b59d93f094289247d12eea6763e29c35cded11d0714d600639c85375bcc2bd94fa766a154484dc20f0
7
+ data.tar.gz: e6823b73f8a2ecc2a10be7dd784456c80e5c3ff045632b0ba703f013a900961f9a97da34ce40f0c14c8a6e7b6b33c2cff13b2c417891169bfc38f4e44846d255
@@ -11,5 +11,6 @@ require 'open3'
11
11
  require "ash/adb/client"
12
12
  require "ash/adb/device"
13
13
  require "ash/adb/package"
14
+ require "ash/adb/file_saver"
14
15
 
15
16
  require "ash/adb/version"
@@ -10,24 +10,24 @@ module Ash::Adb
10
10
  end
11
11
 
12
12
  def generate_bugreport
13
- Ash::Adb::Client.run("adb -s #{@serial_number} shell bugreport")
13
+ Client.run("adb -s #{@serial_number} shell bugreport")
14
14
  end
15
15
 
16
- def save_bugreport(path = "/tmp/bugreport.txt")
16
+ def save_bugreport(path = FileSaver.construct_save_path("bugreport.txt"))
17
17
  File.open(path, 'w') {|f| f.write(generate_bugreport) }
18
18
  end
19
19
 
20
20
  def adb_port_forward(local, remote, remote_protocol="tcp")
21
- Ash::Adb::Client.run("adb -s #{@serial_number} forward tcp:#{local} #{remote_protocol}:#{remote}")
21
+ Client.run("adb -s #{@serial_number} forward tcp:#{local} #{remote_protocol}:#{remote}")
22
22
  end
23
23
 
24
24
  def adb_over_wifi
25
- Ash::Adb::Client.run("adb -s #{@serial_number} tcpip 5555")
25
+ Client.run("adb -s #{@serial_number} tcpip 5555")
26
26
  end
27
27
 
28
28
  def permission_groups
29
29
  adb_command = "adb -s #{@serial_number} shell pm list permission-groups"
30
- raw_pg_output = Ash::Adb::Client.run(adb_command)
30
+ raw_pg_output = Client.run(adb_command)
31
31
  raw_pg_output.split("\r\n").map do |permission_group|
32
32
  permission_group.split(":").last
33
33
  end
@@ -35,7 +35,7 @@ module Ash::Adb
35
35
 
36
36
  def features
37
37
  adb_command = "adb -s #{@serial_number} shell pm list features"
38
- raw_features_output = Ash::Adb::Client.run(adb_command)
38
+ raw_features_output = Client.run(adb_command)
39
39
  raw_features_output.split("\r\n").map do |feature|
40
40
  feature.split(":").last
41
41
  end
@@ -43,18 +43,18 @@ module Ash::Adb
43
43
 
44
44
  def libraries
45
45
  adb_command = "adb -s #{@serial_number} shell pm list libraries"
46
- raw_library_output = Ash::Adb::Client.run(adb_command)
46
+ raw_library_output = Client.run(adb_command)
47
47
  raw_library_output.split("\r\n").map do |library|
48
48
  library.split(":").last
49
49
  end
50
50
  end
51
51
 
52
52
  def parse_device_package_list
53
- Ash::Adb::Client.run("adb -s #{@serial_number} shell pm list packages -f").split("\r\n").map do |package_line|
53
+ Client.run("adb -s #{@serial_number} shell pm list packages -f").split("\r\n").map do |package_line|
54
54
  package_line = package_line.split(":").last.split("=")
55
55
  package_path = package_line.first
56
56
  package_name = package_line.last
57
- Ash::Adb::Package.new(package_path, package_name)
57
+ Package.new(package_path, package_name)
58
58
  end
59
59
  end
60
60
  end
@@ -0,0 +1,12 @@
1
+ module Ash::Adb
2
+ module FileSaver
3
+ @save_directory = "/tmp/"
4
+
5
+ # Some adb commands require a local path to save to. Here, given a
6
+ # filename, a path is constructed based on the directory specified by
7
+ # @save_directory
8
+ def self.construct_save_path(filename)
9
+ File.join(@save_directory, filename)
10
+ end
11
+ end
12
+ end
@@ -1,5 +1,5 @@
1
1
  module Ash
2
2
  module Adb
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
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.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomek Rabczak
@@ -86,6 +86,7 @@ files:
86
86
  - lib/ash/adb.rb
87
87
  - lib/ash/adb/client.rb
88
88
  - lib/ash/adb/device.rb
89
+ - lib/ash/adb/file_saver.rb
89
90
  - lib/ash/adb/package.rb
90
91
  - lib/ash/adb/version.rb
91
92
  homepage: ''