Class: Dryrun::InstallApplicationCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/dryrun/install_application_command.rb

Instance Method Summary collapse

Instance Method Details

#get_execution_command_line(package, launcher_activity) ⇒ Object



24
25
26
# File 'lib/dryrun/install_application_command.rb', line 24

def get_execution_command_line(package, launcher_activity)
  "am start -n \"#{launcheable_activity(package, launcher_activity)}\" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER"
end

#launcheable_activity(package, launcher_activity) ⇒ Object



28
29
30
31
# File 'lib/dryrun/install_application_command.rb', line 28

def launcheable_activity(package, launcher_activity)
  full_path_to_launcher = "#{package}#{launcher_activity.gsub(package, '')}"
  "#{package}/#{full_path_to_launcher}"
end

#run(builder, package, launcher_activity, custom_module, flavour, device) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/dryrun/install_application_command.rb', line 7

def run(builder, package, launcher_activity, custom_module, flavour, device)
  execute_line = get_execution_command_line(package, launcher_activity)
  builder.clean

  if device.nil?
    puts 'No devices picked/available, proceeding with assemble instead'.green
    builder.assemble(custom_module, flavour)
  else
    builder.install(custom_module, flavour)
  end

  unless device.nil?
    AndroidUtils.clear_app_data(package)
    AndroidUtils.pretty_run(execute_line, package)
  end
end