Class: Mdq::CLI
- Inherits:
-
Thor
- Object
- Thor
- Mdq::CLI
- Defined in:
- lib/mdq/cli.rb
Overview
entry point
Class Method Summary collapse
Instance Method Summary collapse
- #apps ⇒ Object
- #cap ⇒ Object
- #check ⇒ Object
- #devices ⇒ Object
- #install ⇒ Object
- #list ⇒ Object
- #simcap ⇒ Object
- #uninstall ⇒ Object
- #version ⇒ Object
Class Method Details
.exit_on_failure? ⇒ Boolean
10 11 12 |
# File 'lib/mdq/cli.rb', line 10 def exit_on_failure? true end |
.help(shell, subcommand) ⇒ Object
114 115 116 117 |
# File 'lib/mdq/cli.rb', line 114 def self.help(shell, subcommand) super puts 'Online documentation: https://github.com/arthur87/mdq' end |
Instance Method Details
#apps ⇒ Object
51 52 53 54 55 |
# File 'lib/mdq/cli.rb', line 51 def apps db = Mdq::DB.new db.get(is_android: [:android], is_apple: [:apple]) puts(JSON.pretty_generate(App.all.as_json)) end |
#cap ⇒ Object
79 80 81 82 83 |
# File 'lib/mdq/cli.rb', line 79 def cap db = Mdq::DB.new db.get(is_apps: false) db.device_screencap([:output], [:udid]) end |
#check ⇒ Object
21 22 23 24 25 |
# File 'lib/mdq/cli.rb', line 21 def check db = Mdq::DB.new puts "adb is installed: #{db.android_discoverable?}" puts "Xcode is installed: #{db.apple_discoverable?}" end |
#devices ⇒ Object
36 37 38 39 40 41 42 43 44 |
# File 'lib/mdq/cli.rb', line 36 def devices db = Mdq::DB.new db.get(is_android: [:android], is_apple: [:apple], is_apps: false, is_physical: [:physical], is_simulated: [:simulated]) puts(JSON.pretty_generate(Device.all.as_json)) end |
#install ⇒ Object
99 100 101 102 103 |
# File 'lib/mdq/cli.rb', line 99 def install db = Mdq::DB.new db.get(is_apps: false) db.app_install([:input], [:udid], [:replace]) end |
#list ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/mdq/cli.rb', line 63 def list db = Mdq::DB.new is_apps = db.query_contains_apps_table?([:query]) db.get(is_android: [:android], is_apple: [:apple], is_apps: is_apps) begin result = db.query(['query']) puts(JSON.pretty_generate(result.as_json)) rescue StandardError => e warn e. end end |
#simcap ⇒ Object
89 90 91 92 |
# File 'lib/mdq/cli.rb', line 89 def simcap db = Mdq::DB.new db.sim_screencap([:output], is_android: [:platform] == 'android') end |