mdq 0.3.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 +4 -4
- data/README.base.md +3 -1
- data/README.ja.md +3 -1
- data/README.md +3 -1
- data/lib/mdq/check.rb +12 -2
- data/lib/mdq/db.rb +1 -11
- data/lib/mdq/discovery.rb +43 -35
- data/lib/mdq/list.rb +3 -3
- data/lib/mdq/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84a0f2929127bcd9631e862124b937660ab2f8e578d93213d08c792ae49a029a
|
4
|
+
data.tar.gz: b9c0cb1eb1eb10f74614a52c2fb8bbc3fc8be3b13cbfb213c21bb870a75b8a21
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 190b46a81fd4e4a7bf02439bdbd93e3399e75335db6bfbbd6cf9567e36ccb2656db6aba030a08320ad8e38527ce207db2b1c6790650e244ee99c8d785ef69518
|
7
|
+
data.tar.gz: be7aef474231155add2e325570eaaa0d6f2e31acfcb53afb0cb9a75ba8c3a5470481a7779066601940142857a52f6614f7ca95120c5898364af2981ceca18ed0
|
data/README.base.md
CHANGED
@@ -7,6 +7,8 @@
|
|
7
7
|
|
8
8
|
# mdq - Mobile Device Query
|
9
9
|
|
10
|
+
[](https://badge.fury.io/rb/mdq)
|
11
|
+
|
10
12
|
MDQ stands for Mobile Device Query and is a command line tool for displaying information about Android and Apple devices.
|
11
13
|
|
12
14
|
# Usage
|
@@ -127,7 +129,7 @@ Details of the devices table.
|
|
127
129
|
| build_version | ro.build.version.release | deviceProperties.osVersionNumber |
|
128
130
|
| build_id | ro.build.id | deviceProperties.osBuildUpdate |
|
129
131
|
| battery_level | battery | Always "null" |
|
130
|
-
| total_capacity | df |
|
132
|
+
| total_capacity | df | hardwareProperties.internalStorageCapacity |
|
131
133
|
| free_capacity | df | Always "null" |
|
132
134
|
|
133
135
|
|
data/README.ja.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
# mdq - Mobile Device Query
|
4
4
|
|
5
|
+
[](https://badge.fury.io/rb/mdq)
|
6
|
+
|
5
7
|
MDQ stands for Mobile Device Query and is a command line tool for displaying information about Android and Apple devices.
|
6
8
|
|
7
9
|
# Usage
|
@@ -122,7 +124,7 @@ Details of the devices table.
|
|
122
124
|
| build_version | ro.build.version.release | deviceProperties.osVersionNumber |
|
123
125
|
| build_id | ro.build.id | deviceProperties.osBuildUpdate |
|
124
126
|
| battery_level | battery | Always "null" |
|
125
|
-
| total_capacity | df |
|
127
|
+
| total_capacity | df | hardwareProperties.internalStorageCapacity |
|
126
128
|
| free_capacity | df | Always "null" |
|
127
129
|
|
128
130
|
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
# mdq - Mobile Device Query
|
4
4
|
|
5
|
+
[](https://badge.fury.io/rb/mdq)
|
6
|
+
|
5
7
|
MDQ stands for Mobile Device Query and is a command line tool for displaying information about Android and Apple devices.
|
6
8
|
|
7
9
|
# Usage
|
@@ -122,7 +124,7 @@ Details of the devices table.
|
|
122
124
|
| build_version | ro.build.version.release | deviceProperties.osVersionNumber |
|
123
125
|
| build_id | ro.build.id | deviceProperties.osBuildUpdate |
|
124
126
|
| battery_level | battery | Always "null" |
|
125
|
-
| total_capacity | df |
|
127
|
+
| total_capacity | df | hardwareProperties.internalStorageCapacity |
|
126
128
|
| free_capacity | df | Always "null" |
|
127
129
|
|
128
130
|
|
data/lib/mdq/check.rb
CHANGED
@@ -8,8 +8,18 @@ module Mdq
|
|
8
8
|
class Check
|
9
9
|
def initialize
|
10
10
|
db = Mdq::DB.new
|
11
|
-
|
12
|
-
|
11
|
+
show_message('adb', db.android_discoverable?)
|
12
|
+
show_message('Xcode', db.apple_discoverable?)
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def show_message(name, discoverable)
|
18
|
+
if discoverable
|
19
|
+
puts "# #{name} is installed."
|
20
|
+
else
|
21
|
+
puts "# #{name} is not installed."
|
22
|
+
end
|
13
23
|
end
|
14
24
|
end
|
15
25
|
end
|
data/lib/mdq/db.rb
CHANGED
@@ -10,8 +10,7 @@ module Mdq
|
|
10
10
|
class DB < Discovery
|
11
11
|
# クエリの実行
|
12
12
|
def get(sql)
|
13
|
-
|
14
|
-
|
13
|
+
reset
|
15
14
|
# デバイスの発見
|
16
15
|
android_discover
|
17
16
|
apple_discover
|
@@ -37,15 +36,6 @@ module Mdq
|
|
37
36
|
end
|
38
37
|
end
|
39
38
|
|
40
|
-
# 指定したソフトウェアのインストール状況を表示する
|
41
|
-
def show_version(name, command)
|
42
|
-
output, = Open3.capture3(command)
|
43
|
-
puts "# #{name} installed."
|
44
|
-
puts output
|
45
|
-
rescue StandardError
|
46
|
-
puts "# #{name} is not installed."
|
47
|
-
end
|
48
|
-
|
49
39
|
# Androidデバイスのスクリーンショットを撮る
|
50
40
|
def device_screencap(output, udid, is_android)
|
51
41
|
return unless is_android
|
data/lib/mdq/discovery.rb
CHANGED
@@ -9,8 +9,15 @@ module Mdq
|
|
9
9
|
# Discovery
|
10
10
|
class Discovery
|
11
11
|
def initialize
|
12
|
-
|
13
|
-
|
12
|
+
@home = FileUtils.mkdir_p([Dir.home, '.mdq'].join(File::Separator))
|
13
|
+
end
|
14
|
+
|
15
|
+
def android_discoverable?
|
16
|
+
adb_command('version').present?
|
17
|
+
end
|
18
|
+
|
19
|
+
def apple_discoverable?
|
20
|
+
apple_command('--version').present?
|
14
21
|
end
|
15
22
|
|
16
23
|
private
|
@@ -112,9 +119,9 @@ module Mdq
|
|
112
119
|
|
113
120
|
# Appleデバイス一覧を取得する
|
114
121
|
def apple_discover
|
115
|
-
file = [
|
122
|
+
file = [@home, 'mdq.json'].join(File::Separator)
|
116
123
|
result = apple_command("list devices -v -j #{file}")
|
117
|
-
|
124
|
+
|
118
125
|
return unless File.exist?(file)
|
119
126
|
|
120
127
|
File.open(file, 'r') do |f|
|
@@ -130,7 +137,8 @@ module Mdq
|
|
130
137
|
marketing_name: device['hardwareProperties']['marketingName'],
|
131
138
|
model: device['hardwareProperties']['productType'],
|
132
139
|
build_version: device['deviceProperties']['osVersionNumber'],
|
133
|
-
build_id: device['deviceProperties']['osBuildUpdate']
|
140
|
+
build_id: device['deviceProperties']['osBuildUpdate'],
|
141
|
+
total_capacity: device['hardwareProperties']['internalStorageCapacity']
|
134
142
|
})
|
135
143
|
end
|
136
144
|
|
@@ -151,7 +159,7 @@ module Mdq
|
|
151
159
|
|
152
160
|
# Appleデバイスのアプリを取得する
|
153
161
|
def apple_apps(udid)
|
154
|
-
file = [
|
162
|
+
file = [@home, 'mdq-apps.json'].join(File::Separator)
|
155
163
|
apple_command("device info apps -j #{file}", udid)
|
156
164
|
File.open(file, 'r') do |f|
|
157
165
|
result = JSON.parse(f.read)
|
@@ -170,44 +178,44 @@ module Mdq
|
|
170
178
|
end
|
171
179
|
File.delete(file)
|
172
180
|
end
|
181
|
+
|
182
|
+
def reset
|
183
|
+
Device.destroy_all
|
184
|
+
App.destroy_all
|
185
|
+
ActiveRecord::Base.connection.execute("delete from sqlite_sequence where name='devices'")
|
186
|
+
ActiveRecord::Base.connection.execute("delete from sqlite_sequence where name='apps'")
|
187
|
+
end
|
173
188
|
end
|
174
189
|
end
|
175
190
|
|
191
|
+
ActiveRecord::Schema.verbose = false
|
192
|
+
ActiveRecord::Migration.verbose = false
|
193
|
+
|
176
194
|
ActiveRecord::Base.establish_connection(
|
177
195
|
adapter: 'sqlite3',
|
178
196
|
database: ':memory:'
|
179
197
|
)
|
180
198
|
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
t.integer :total_capacity
|
196
|
-
t.integer :free_capacity
|
197
|
-
end
|
198
|
-
|
199
|
-
create_table :apps do |t|
|
200
|
-
t.string :udid
|
201
|
-
t.string :name
|
202
|
-
t.string :package_name
|
203
|
-
t.string :version
|
204
|
-
end
|
205
|
-
end
|
199
|
+
ActiveRecord::Migration.create_table :devices do |t|
|
200
|
+
t.string :udid
|
201
|
+
t.string :serial_number
|
202
|
+
t.string :name
|
203
|
+
t.boolean :authorized
|
204
|
+
t.string :platform
|
205
|
+
t.string :marketing_name
|
206
|
+
t.string :model
|
207
|
+
t.string :build_version
|
208
|
+
t.string :build_id
|
209
|
+
t.integer :battery_level
|
210
|
+
t.integer :total_capacity
|
211
|
+
t.integer :free_capacity
|
212
|
+
end
|
206
213
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
214
|
+
ActiveRecord::Migration.create_table :apps do |t|
|
215
|
+
t.string :udid
|
216
|
+
t.string :name
|
217
|
+
t.string :package_name
|
218
|
+
t.string :version
|
211
219
|
end
|
212
220
|
|
213
221
|
# Device
|
data/lib/mdq/list.rb
CHANGED
@@ -25,9 +25,9 @@ module Mdq
|
|
25
25
|
udid = model.udid
|
26
26
|
is_android = model.android?
|
27
27
|
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
db.device_screencap(options[:cap], udid, is_android) if options[:cap]
|
29
|
+
db.app_install(options[:install], udid, is_android) if options[:install]
|
30
|
+
db.app_uninstall(options[:uninstall], udid, is_android) if options[:uninstall]
|
31
31
|
rescue StandardError
|
32
32
|
# none
|
33
33
|
end
|
data/lib/mdq/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mdq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- arthur87
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-05-
|
11
|
+
date: 2025-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|