mdq 1.0.0 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29fbbd7bc987bc45f23473fff290c05f458f9677c0f95739c6cfab4ea0e4da13
4
- data.tar.gz: 7797f6cdaad6c791717a83bfa5bfb67d5a1f485bc84e8855a6e3f91adc26251b
3
+ metadata.gz: eb4e645a90b2083463ab42641ac31601a9b433a1ab8c163bac6c50ad8f23ea83
4
+ data.tar.gz: f9ee18ecb1ba26fc5c22be56cbef9488a56c10881b911d3895eb0a37191e7f96
5
5
  SHA512:
6
- metadata.gz: 6fa1379783a969a874b20beb37b02d7ea7134f55f4cfc41f69c7b41ad8e3ab1f293602e8aa3cc2a8557d40fe5c18a08bfee49c16e4e7aa84241aac161abadf30
7
- data.tar.gz: 7612066bfa36a5702c7194da49f1d562bed37ddbcf0537e510dfcb4260baab57047743af94e8b734cdcd001b9d94bcd704c557d2d6552a36c7d6835a28d3ceb8
6
+ metadata.gz: 1cb781ce60a3916842174e8da0f76dc63deb92d4a4f3f2e58e1bafe76f34c2d1947a6ae169690a380d4541b33733f0adb2377eeac257124ead43839b4dfa6bb6
7
+ data.tar.gz: 574b835238868b31e97871e259d3f3d8e9155b1dcf2b6d1e0561f329dc057e6e80054a69d0f3e327cdf0f68e44a7c6fced9e175c9ebcdab652367801df98d124
data/README.base.md CHANGED
@@ -28,23 +28,6 @@ Show mobile devices.
28
28
 
29
29
  ```
30
30
  $ mdq devices
31
- ```
32
-
33
- ## Apss
34
-
35
- Show apps.
36
-
37
- ```
38
- $ mdq apps
39
- ```
40
-
41
-
42
- ## List
43
-
44
- It's easy to use.
45
-
46
- ```
47
- $ mdq list
48
31
  [
49
32
  {
50
33
  "id": 1,
@@ -97,6 +80,17 @@ $ mdq list
97
80
  ]
98
81
  ```
99
82
 
83
+ ## Apss
84
+
85
+ Show apps.
86
+
87
+ ```
88
+ $ mdq apps
89
+ ```
90
+
91
+
92
+ ## List
93
+
100
94
  You can filter using SQL.
101
95
 
102
96
  ```
data/README.ja.md CHANGED
@@ -23,23 +23,6 @@ Show mobile devices.
23
23
 
24
24
  ```
25
25
  $ mdq devices
26
- ```
27
-
28
- ## Apss
29
-
30
- Show apps.
31
-
32
- ```
33
- $ mdq apps
34
- ```
35
-
36
-
37
- ## List
38
-
39
- It's easy to use.
40
-
41
- ```
42
- $ mdq list
43
26
  [
44
27
  {
45
28
  "id": 1,
@@ -92,6 +75,17 @@ $ mdq list
92
75
  ]
93
76
  ```
94
77
 
78
+ ## Apss
79
+
80
+ Show apps.
81
+
82
+ ```
83
+ $ mdq apps
84
+ ```
85
+
86
+
87
+ ## List
88
+
95
89
  You can filter using SQL.
96
90
 
97
91
  ```
data/README.md CHANGED
@@ -23,23 +23,6 @@ Show mobile devices.
23
23
 
24
24
  ```
25
25
  $ mdq devices
26
- ```
27
-
28
- ## Apss
29
-
30
- Show apps.
31
-
32
- ```
33
- $ mdq apps
34
- ```
35
-
36
-
37
- ## List
38
-
39
- It's easy to use.
40
-
41
- ```
42
- $ mdq list
43
26
  [
44
27
  {
45
28
  "id": 1,
@@ -92,6 +75,17 @@ $ mdq list
92
75
  ]
93
76
  ```
94
77
 
78
+ ## Apss
79
+
80
+ Show apps.
81
+
82
+ ```
83
+ $ mdq apps
84
+ ```
85
+
86
+
87
+ ## List
88
+
95
89
  You can filter using SQL.
96
90
 
97
91
  ```
data/lib/mdq/cli.rb CHANGED
@@ -47,7 +47,7 @@ module Mdq
47
47
  end
48
48
 
49
49
  desc 'list', 'Show mobile devices or apps'
50
- method_option :query, desc: 'SQL to filter devices or apps', aliases: '-q'
50
+ method_option :query, desc: 'SQL to filter devices or apps', aliases: '-q', required: true
51
51
  def list
52
52
  db = Mdq::DB.new
53
53
  db.get
@@ -64,7 +64,7 @@ module Mdq
64
64
  db.device_screencap(options[:output], options[:udid])
65
65
  end
66
66
 
67
- desc 'install', 'Installing the app(apk, ipa)'
67
+ desc 'install', 'Installing the app(apk, apex, ipa)'
68
68
  method_option :udid, desc: 'Specify the device UDID', aliases: '-u', required: true
69
69
  method_option :input, desc: 'Path to the app file', aliases: '-i', required: true
70
70
  method_option :replace, desc: 'Replace the app if it is already installed', aliases: '-r', default: false,
@@ -75,9 +75,9 @@ module Mdq
75
75
  db.app_install(options[:input], options[:udid], options[:replace])
76
76
  end
77
77
 
78
- desc 'uninstall', 'Uninstalling the app(apk, ipa)'
78
+ desc 'uninstall', 'Uninstalling the app'
79
79
  method_option :udid, desc: 'Specify the device UDID', aliases: '-u', required: true
80
- method_option :input, desc: 'Path to the app file', aliases: '-i', required: true
80
+ method_option :input, desc: 'Path to the app', aliases: '-i', required: true
81
81
  def uninstall
82
82
  db = Mdq::DB.new
83
83
  db.get(is_apps: false)
data/lib/mdq/db.rb CHANGED
@@ -38,7 +38,7 @@ module Mdq
38
38
  def device_screencap(output, udid)
39
39
  device = Device.find_by(udid: udid)
40
40
  if device.nil? || !device.android?
41
- puts 'Device not found or not an Android device.'
41
+ warn 'Device not found or not an Android device.'
42
42
  return
43
43
  end
44
44
 
@@ -52,44 +52,42 @@ module Mdq
52
52
 
53
53
  # Appをインストールする
54
54
  def app_install(input, udid, is_replace)
55
- file_error_message = 'Invalid file format. Please provide an .apk file for Android or an .ipa file for iOS.'
56
- unless File.exist?(input)
57
- puts file_error_message
58
- return
59
- end
60
-
61
55
  device = Device.find_by(udid: udid)
62
56
  if device.nil?
63
- puts 'Device not found.'
57
+ warn 'Device not found.'
64
58
  return
65
59
  end
66
60
 
67
- if device.android? && input.end_with?('.apk')
61
+ if device.android?
68
62
  if is_replace
69
- adb_command("install -r #{input}", udid)
63
+ output, error = adb_command("install -r #{input}", udid)
70
64
  else
71
- adb_command("install #{input}", udid)
65
+ output, error = adb_command("install #{input}", udid)
72
66
  end
73
- elsif !device.android? && input.end_with?('.ipa')
74
- apple_command("device install app #{input}", udid)
75
67
  else
76
- puts file_error_message
68
+ output, error = apple_command("device install app #{input}", udid)
77
69
  end
70
+
71
+ puts output unless output.empty?
72
+ warn error unless error.empty?
78
73
  end
79
74
 
80
75
  # Appをアンインストールする
81
76
  def app_uninstall(input, udid)
82
77
  device = Device.find_by(udid: udid)
83
78
  if device.nil?
84
- puts 'Device not found.'
79
+ warn 'Device not found.'
85
80
  return
86
81
  end
87
82
 
88
83
  if device.android?
89
- adb_command("uninstall #{input}", udid)
84
+ output, error = adb_command("uninstall #{input}", udid)
90
85
  else
91
- apple_command("device uninstall app #{input}", udid)
86
+ output, error = apple_command("device uninstall app #{input}", udid)
92
87
  end
88
+
89
+ puts output unless output.empty?
90
+ warn error unless error.empty?
93
91
  end
94
92
  end
95
93
  end
data/lib/mdq/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mdq
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  end
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.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - arthur87
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-04-01 00:00:00.000000000 Z
10
+ date: 2026-04-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rubocop