Class: Pindo::Command::Android::Install
Constant Summary
DEFAULT_OPTIONS, DEFAULT_ROOT_OPTIONS
Instance Attribute Summary
#args_help_flag
Class Method Summary
collapse
Instance Method Summary
collapse
command_name, #initialize_options, run, use_cache?
#pindo_log_instance
#pindo_single_config
Constructor Details
#initialize(argv) ⇒ Install
Returns a new instance of Install.
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/pindo/command/android/install.rb', line 38
def initialize(argv)
@args_apk_file = argv.shift_argument
@options = initialize_options(argv)
apk_option = @options[:apk] rescue nil
if !apk_option.nil?
@args_apk_file = apk_option
end
if @args_apk_file && !@args_apk_file.empty?
@args_apk_file = @args_apk_file.strip.gsub(/\"/, '')
end
super(argv)
end
|
Class Method Details
.options ⇒ Object
34
35
36
|
# File 'lib/pindo/command/android/install.rb', line 34
def self.options
option_items.map(&:to_claide_option).concat(super)
end
|
Instance Method Details
#run ⇒ Object
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
# File 'lib/pindo/command/android/install.rb', line 57
def run
@adb_path = find_adb
puts "ADB: #{@adb_path}"
apk_file = find_apk_file
puts "APK 文件: #{apk_file}"
devices = detect_available_devices
if devices.empty?
raise Informative, "未检测到可用的 Android 设备,请确认设备已连接并开启 USB 调试"
end
device = select_device(devices)
puts "目标设备: #{device[:brand]} #{device[:model]} (#{device[:serial]})"
install_apk_to_device(apk_file, device)
end
|
#validate! ⇒ Object
53
54
55
|
# File 'lib/pindo/command/android/install.rb', line 53
def validate!
super
end
|