droid_adbs 0.4.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2fc3160c2981807d1678a39683d16661d7349bd2
4
- data.tar.gz: 125713a86cc2765a0b940855425c2c032c710e33
3
+ metadata.gz: c3bde318e91b24a5c4be0d90582ddb5158dfd751
4
+ data.tar.gz: eee500b72c099731ac470d33882bfc68182adce2
5
5
  SHA512:
6
- metadata.gz: be0fad45b241f6371fd915be646f206624cfaca8f5085295a9092af7c6fccf9799c001feeb0547986e7b2a21d44ccdd521ed87ecce5a049de069dc9ee20da9ad
7
- data.tar.gz: 35190176f7850dbf43899a1f447c0d7ce0844f47dfcd7166a167cc29214dbde9df32bf3a18c162f63cfae5c71ce437097a2d8e02769b935b17456948c158da8e
6
+ metadata.gz: bbc09f7d5890a084bdae950241f247b83896a0b524eb52d7f4c8a06e4d7798d5d23002214dce91a2e2517a3c03ae534099077211374f80050642ca43c992a93a
7
+ data.tar.gz: 17bf321d53678e217c4ba662fec8209496b16f284b2a99e188893c29dc3d27da7de2b939a0637a19fda20a0a77ca43ca5c122365d9cbd0c4a934b84d11c310be
@@ -17,7 +17,7 @@ module DroidAdbs
17
17
  # manifest_package_id #=> "io.appium.android.apis"
18
18
  #
19
19
  def manifest_package_id
20
- `apkanalyzer manifest application-id #{@apk_path}`.strip
20
+ `#{command_manifest} application-id #{@apk_path}`.strip
21
21
  end
22
22
 
23
23
  # @param [String] out_path A path to output the result
@@ -25,7 +25,7 @@ module DroidAdbs
25
25
  #
26
26
  #
27
27
  def manifest_print(out_path = './manifest_print.xml')
28
- result = `apkanalyzer manifest print #{@apk_path}`.strip
28
+ result = `#{command_manifest} print #{@apk_path}`.strip
29
29
  File.write out_path, result
30
30
  end
31
31
 
@@ -36,7 +36,7 @@ module DroidAdbs
36
36
  # manifest_version_name #=> "1.0"
37
37
  #
38
38
  def manifest_version_name
39
- `apkanalyzer manifest version-name #{@apk_path}`.strip
39
+ `#{command_manifest} version-name #{@apk_path}`.strip
40
40
  end
41
41
 
42
42
  # @return [String] A number of version code by string
@@ -46,7 +46,7 @@ module DroidAdbs
46
46
  # manifest_version_code #=> "1"
47
47
  #
48
48
  def manifest_version_code
49
- `apkanalyzer manifest version-code #{@apk_path}`.strip
49
+ `#{command_manifest} version-code #{@apk_path}`.strip
50
50
  end
51
51
 
52
52
  # @return [String] A number of min sdk by string
@@ -56,7 +56,7 @@ module DroidAdbs
56
56
  # manifest_min_sdk #=> "16"
57
57
  #
58
58
  def manifest_min_sdk
59
- `apkanalyzer manifest min-sdk #{@apk_path}`.strip
59
+ `#{command_manifest} min-sdk #{@apk_path}`.strip
60
60
  end
61
61
 
62
62
  # @return [String] A number of target sdk by string
@@ -66,7 +66,7 @@ module DroidAdbs
66
66
  # manifest_target_sdk #=> "22"
67
67
  #
68
68
  def manifest_target_sdk
69
- `apkanalyzer manifest target-sdk #{@apk_path}`.strip
69
+ `#{command_manifest} target-sdk #{@apk_path}`.strip
70
70
  end
71
71
 
72
72
  # @return [[String]] A list of permissions
@@ -76,7 +76,7 @@ module DroidAdbs
76
76
  # manifest_permissions #=> ["android.permission.INTERNET", "android.permission.SYSTEM_ALERT_WINDOW", "android.permission.READ_EXTERNAL_STORAGE", "android.permission.WRITE_EXTERNAL_STORAGE", "android.permission.READ_PHONE_STATE"]
77
77
  #
78
78
  def manifest_permissions
79
- `apkanalyzer manifest permissions #{@apk_path}`.strip.split("\n")
79
+ `#{command_manifest} permissions #{@apk_path}`.strip.split("\n")
80
80
  end
81
81
 
82
82
  # @return [Bool] Debuggable or not
@@ -86,7 +86,7 @@ module DroidAdbs
86
86
  # manifest_debuggable #=> true
87
87
  #
88
88
  def manifest_debuggable
89
- result = `apkanalyzer manifest debuggable #{@apk_path}`.strip
89
+ result = `#{command_manifest} debuggable #{@apk_path}`.strip
90
90
  return true if result == "true"
91
91
  false
92
92
  end
@@ -98,13 +98,13 @@ module DroidAdbs
98
98
  # apk_summary #=> ["com.vodqareactnative", "1", "1.0"]
99
99
  #
100
100
  def apk_summary
101
- `apkanalyzer apk summary #{@apk_path}`.strip.split("\t")
101
+ `#{command_apk} summary #{@apk_path}`.strip.split("\t")
102
102
  end
103
103
 
104
104
  # Prints the file size of the APK.
105
105
  # 7_414_686 (byte)
106
106
  def apk_file_size
107
- `apkanalyzer apk file-size #{@apk_path}`.strip
107
+ `#{command_apk} file-size #{@apk_path}`.strip
108
108
  end
109
109
 
110
110
  # Prints an estimate of the download size of the APK.
@@ -114,7 +114,7 @@ module DroidAdbs
114
114
  # apk_download_size #=> 7313000
115
115
  #
116
116
  def apk_download_size
117
- `apkanalyzer apk download-size #{@apk_path}`.strip
117
+ `#{command_apk} download-size #{@apk_path}`.strip
118
118
  end
119
119
 
120
120
  # Prints features used by the APK.
@@ -124,12 +124,12 @@ module DroidAdbs
124
124
  # apk_features #=> "android.hardware.faketouch implied: default feature for all apps"
125
125
  #
126
126
  def apk_features
127
- puts `apkanalyzer apk features #{@apk_path}`.strip
127
+ puts `#{command_apk} features #{@apk_path}`.strip
128
128
  end
129
129
 
130
130
  # Compares the sizes of two APKs.
131
131
  def apk_compare_print(with)
132
- puts `apkanalyzer apk features #{@apk_path} #{with}`.strip
132
+ puts `#{command_apk} features #{@apk_path} #{with}`.strip
133
133
  end
134
134
 
135
135
  # Lists all files in the zip.
@@ -144,29 +144,29 @@ module DroidAdbs
144
144
 
145
145
  # Prints a list of dex files in the APK
146
146
  def dex_list
147
- `apkanalyzer dex list #{@apk_path}`.strip.split("\n")
147
+ `#{command_dex} list #{@apk_path}`.strip.split("\n")
148
148
  end
149
149
 
150
150
  # Prints number of references in dex files
151
151
  def dex_references(options = "")
152
- `apkanalyzer dex references #{options} #{@apk_path}`.strip
152
+ `#{command_dex} references #{options} #{@apk_path}`.strip
153
153
  end
154
154
 
155
155
  # Prints the class tree from DEX.
156
156
  # P,C,M,F: indicates packages, classes methods, fields
157
157
  # x,k,r,d: indicates removed, kept, referenced and defined nodes
158
158
  def dex_packages(options = "")
159
- `apkanalyzer dex packages #{options} #{@apk_path}`.strip
159
+ `#{command_dex} packages #{options} #{@apk_path}`.strip
160
160
  end
161
161
 
162
162
  # Prints the bytecode of a class or method in smali format
163
163
  def dex_code
164
- `apkanalyzer dex code #{@apk_path}`.strip
164
+ `#{command_dex} code #{@apk_path}`.strip
165
165
  end
166
166
 
167
167
  # Prints a list of packages in resources table
168
168
  def resources_packages
169
- `apkanalyzer resources packages #{@apk_path}`.strip
169
+ `#{command_resources} packages #{@apk_path}`.strip
170
170
  end
171
171
 
172
172
  # Prints a list of configurations for the specified type.
@@ -175,7 +175,7 @@ module DroidAdbs
175
175
  # otherwise the first defined package will be used.
176
176
  #
177
177
  def resources_configs(type, package = "")
178
- `apkanalyzer resources configs --type #{type} #{package} #{@apk_path}`.strip
178
+ `#{command_resources} configs --type #{type} #{package} #{@apk_path}`.strip
179
179
  end
180
180
 
181
181
  # Prints the value of the resource specified by config, name, and type.
@@ -190,12 +190,31 @@ module DroidAdbs
190
190
  # resources_value "default", "revision_hash", "string"
191
191
  #
192
192
  def resources_value(config, name, type, package = "")
193
- `apkanalyzer resources value --config #{config} --name #{name} --type #{type} #{package} #{@apk_path}`.strip
193
+ `#{command_resources} value --config #{config} --name #{name} --type #{type} #{package} #{@apk_path}`.strip
194
194
  end
195
195
 
196
196
  # Prints the human-readable form of a binary XML file. Include the file option to specify the path to the file.
197
197
  def resources_xml(xml_file)
198
- `apkanalyzer resources xml --file #{xml_file} #{@apk_path}`.strip
198
+ `#{command_resources} xml --file #{xml_file} #{@apk_path}`.strip
199
199
  end
200
+
201
+ private
202
+
203
+ def command_manifest
204
+ 'apkanalyzer manifest'
205
+ end
206
+
207
+ def command_apk
208
+ 'apkanalyzer apk'
209
+ end
210
+
211
+ def command_dex
212
+ 'apkanalyzer dex'
213
+ end
214
+
215
+ def command_resources
216
+ 'apkanalyzer resources'
217
+ end
218
+
200
219
  end # class Apkanalyzer
201
220
  end # module DroidAdbs
@@ -66,6 +66,12 @@ module DroidAdbs
66
66
  `#{::DroidAdbs.shell} date -s #{yyyymmdd}.#{hhmmss}`.strip
67
67
  end
68
68
 
69
+ # @param [String] format A format to `adb shell date`. `+%Y-%m-%dT%T%z` is one format.
70
+ # @return [String] message from adb command
71
+ def get_date(format = "")
72
+ `#{::DroidAdbs.shell} date #{format}`.strip
73
+ end
74
+
69
75
  # Only for rooted devices.
70
76
  #
71
77
  # Default SET format is "MMDDhhmm[[CC]YY][.ss]", that's (2 digits each)
@@ -1,3 +1,3 @@
1
1
  module DroidAdbs
2
- VERSION = "0.4.0"
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: droid_adbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kazuaki MATSUO
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-08 00:00:00.000000000 Z
11
+ date: 2018-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
102
102
  version: '0'
103
103
  requirements: []
104
104
  rubyforge_project:
105
- rubygems_version: 2.6.8
105
+ rubygems_version: 2.6.14
106
106
  signing_key:
107
107
  specification_version: 4
108
108
  summary: adb command wrapper