mdq 1.0.1 → 1.1.0

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: eb4e645a90b2083463ab42641ac31601a9b433a1ab8c163bac6c50ad8f23ea83
4
- data.tar.gz: f9ee18ecb1ba26fc5c22be56cbef9488a56c10881b911d3895eb0a37191e7f96
3
+ metadata.gz: 7c36b341ecf3203e0d02c57d48b84f1f7c9baf26464170912aa2b8f4fcb45fb0
4
+ data.tar.gz: ecc41b8401ae612cd285a72fd78a1ff0e962b73465faf99e7771efa14474ab0f
5
5
  SHA512:
6
- metadata.gz: 1cb781ce60a3916842174e8da0f76dc63deb92d4a4f3f2e58e1bafe76f34c2d1947a6ae169690a380d4541b33733f0adb2377eeac257124ead43839b4dfa6bb6
7
- data.tar.gz: 574b835238868b31e97871e259d3f3d8e9155b1dcf2b6d1e0561f329dc057e6e80054a69d0f3e327cdf0f68e44a7c6fced9e175c9ebcdab652367801df98d124
6
+ metadata.gz: f98aec1c38480c9d34d5b7175e742614ee1beade579ea97d289c2142e20e04266fd55e89ba9a8648f12caf08c606d49a66666750e0297f3522055a15f7f4aae2
7
+ data.tar.gz: b1d857915379f24189a634029f7e2c2f2e772200bc85a50202793a3097d0f4d31c7541839f065327fceed36074f7bb0ce729b6e77b040b78c8b2b2a5c54b4e6f
data/lib/mdq/cli.rb CHANGED
@@ -64,6 +64,15 @@ module Mdq
64
64
  db.device_screencap(options[:output], options[:udid])
65
65
  end
66
66
 
67
+ desc 'simcap', 'Take a screenshot of the simulator.'
68
+ method_option :android, desc: 'Android emulator screenshot file name'
69
+ method_option :apple, desc: 'Apple simulator screenshot file name'
70
+ def simcap
71
+ db = Mdq::DB.new
72
+ db.sim_screencap(options[:android], is_android: true) if options[:android]
73
+ db.sim_screencap(options[:apple], is_android: false) if options[:apple]
74
+ end
75
+
67
76
  desc 'install', 'Installing the app(apk, apex, ipa)'
68
77
  method_option :udid, desc: 'Specify the device UDID', aliases: '-u', required: true
69
78
  method_option :input, desc: 'Path to the app file', aliases: '-i', required: true
data/lib/mdq/db.rb CHANGED
@@ -50,6 +50,17 @@ module Mdq
50
50
  adb_command("shell rm #{full_path}", udid)
51
51
  end
52
52
 
53
+ def sim_screencap(output, is_android: true)
54
+ if is_android
55
+ output, error = adb_command("emu screenrecord #{output}}")
56
+ else
57
+ output, error = apple_sim_command("io booted screenshot #{output}")
58
+ end
59
+
60
+ puts output unless output.empty?
61
+ warn error unless error.empty?
62
+ end
63
+
53
64
  # Appをインストールする
54
65
  def app_install(input, udid, is_replace)
55
66
  device = Device.find_by(udid: udid)
data/lib/mdq/discovery.rb CHANGED
@@ -52,6 +52,17 @@ module Mdq
52
52
  end
53
53
  end
54
54
 
55
+ # simctlコマンド
56
+ def apple_sim_command(arg)
57
+ command = "xcrun simctl #{arg}"
58
+
59
+ begin
60
+ Open3.capture3(command)
61
+ rescue StandardError
62
+ nil
63
+ end
64
+ end
65
+
55
66
  # Androidデバイス一覧を取得する
56
67
  def android_discover # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
57
68
  output, = adb_command('devices -l')
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.1'
4
+ VERSION = '1.1.0'
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.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - arthur87
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2026-04-02 00:00:00.000000000 Z
10
+ date: 2026-04-09 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rubocop