mdq 1.5.0 → 1.5.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/lib/mdq/cli.rb +9 -1
- data/lib/mdq/db.rb +3 -3
- data/lib/mdq/discovery.rb +14 -2
- 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: e82ce9d717037c9e6cb77fb68ebc07fbef2d3d1863b9bd9a0e5acde1b4f1ed65
|
|
4
|
+
data.tar.gz: b88aadd8b8a20ae0a3dc75e0902a29eed5b2c2b79ac00eef4d33161be6203519
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 410d82e49b9464a9da80fe3be11090e4433135565defeedd7f7ba6b3a3a58067188960fed97116945a30e982cfa80252c82cf6e6c97b65797eab0d0d607d61cf
|
|
7
|
+
data.tar.gz: 3ceffaccda4efa440a2f1a50ea1d91608a4be64b357eb2928c78a45d7fb782241463a61841e7674b160ed1186f5bac3f5d18285467b86904f7629e49a0eb1267
|
data/lib/mdq/cli.rb
CHANGED
|
@@ -29,9 +29,17 @@ module Mdq
|
|
|
29
29
|
type: :boolean
|
|
30
30
|
method_option :apple, desc: 'Show Apple devices', default: true,
|
|
31
31
|
type: :boolean
|
|
32
|
+
method_option :physical, desc: 'Show physical devices', default: true,
|
|
33
|
+
type: :boolean
|
|
34
|
+
method_option :simulated, desc: 'Show simulated devices', default: true,
|
|
35
|
+
type: :boolean
|
|
32
36
|
def devices
|
|
33
37
|
db = Mdq::DB.new
|
|
34
|
-
db.get(is_android: options[:android],
|
|
38
|
+
db.get(is_android: options[:android],
|
|
39
|
+
is_apple: options[:apple],
|
|
40
|
+
is_apps: false,
|
|
41
|
+
is_physical: options[:physical],
|
|
42
|
+
is_simulated: options[:simulated])
|
|
35
43
|
puts(JSON.pretty_generate(Device.all.as_json))
|
|
36
44
|
end
|
|
37
45
|
|
data/lib/mdq/db.rb
CHANGED
|
@@ -10,11 +10,11 @@ module Mdq
|
|
|
10
10
|
# DB
|
|
11
11
|
class DB < Discovery
|
|
12
12
|
# デバイスとアプリの取得
|
|
13
|
-
def get(is_android: true, is_apple: true, is_apps: true)
|
|
13
|
+
def get(is_android: true, is_apple: true, is_apps: true, is_physical: true, is_simulated: true)
|
|
14
14
|
reset
|
|
15
15
|
# デバイスの発見
|
|
16
|
-
android_discover if is_android
|
|
17
|
-
apple_discover if is_apple
|
|
16
|
+
android_discover(is_physical) if is_android
|
|
17
|
+
apple_discover(is_physical, is_simulated) if is_apple
|
|
18
18
|
|
|
19
19
|
return unless is_apps
|
|
20
20
|
|
data/lib/mdq/discovery.rb
CHANGED
|
@@ -64,7 +64,9 @@ module Mdq
|
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
# Androidデバイス一覧を取得する
|
|
67
|
-
def android_discover # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
|
|
67
|
+
def android_discover(is_physical = true) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity,Style/OptionalBooleanParameter
|
|
68
|
+
return if skip_device?(true, is_physical, false)
|
|
69
|
+
|
|
68
70
|
output, = adb_command('devices -l')
|
|
69
71
|
return if output.nil?
|
|
70
72
|
|
|
@@ -171,7 +173,7 @@ module Mdq
|
|
|
171
173
|
end
|
|
172
174
|
|
|
173
175
|
# Appleデバイス一覧を取得する
|
|
174
|
-
def apple_discover
|
|
176
|
+
def apple_discover(is_physical = true, is_simulated = true) # rubocop:disable Style/OptionalBooleanParameter
|
|
175
177
|
file = [@home, 'mdq.json'].join(File::Separator)
|
|
176
178
|
result = apple_command("list devices -v -j #{file}")
|
|
177
179
|
k = 1000.0
|
|
@@ -193,6 +195,8 @@ module Mdq
|
|
|
193
195
|
reality == 'physical'
|
|
194
196
|
end
|
|
195
197
|
|
|
198
|
+
next if skip_device?(physical, is_physical, is_simulated)
|
|
199
|
+
|
|
196
200
|
Device.create({
|
|
197
201
|
udid: udid,
|
|
198
202
|
serial_number: device['hardwareProperties']['serialNumber'],
|
|
@@ -268,6 +272,14 @@ module Mdq
|
|
|
268
272
|
|
|
269
273
|
"#{(size * 100).round / 100.0}#{units[i]}"
|
|
270
274
|
end
|
|
275
|
+
|
|
276
|
+
# デバイスの物理/シミュレートのフラグをスキップするかどうか
|
|
277
|
+
# 物理デバイスの場合: is_physical が true ならスキップしない(false)、false ならスキップする(true)。
|
|
278
|
+
# シミュレータの場合: is_simulated が true ならスキップしない(false)、false ならスキップする(true)。
|
|
279
|
+
# 判定不能(nil)の場合: シミュレータとして扱い、is_simulated の設定に従う。
|
|
280
|
+
def skip_device?(physical, is_physical, is_simulated)
|
|
281
|
+
!((physical && is_physical) || (!physical && is_simulated))
|
|
282
|
+
end
|
|
271
283
|
end
|
|
272
284
|
end
|
|
273
285
|
|
data/lib/mdq/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mdq
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.5.
|
|
4
|
+
version: 1.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- arthur87
|
|
8
8
|
bindir: exe
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-06-
|
|
10
|
+
date: 2026-06-20 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rubocop
|