lib/dryrun/android_project.rb in dryrun-0.5.1 vs lib/dryrun/android_project.rb in dryrun-0.5.2
- old
+ new
@@ -1,8 +1,9 @@
require 'nokogiri'
require 'fileutils'
require 'tempfile'
+require_relative 'dryrun_utils'
module DryRun
class AndroidProject
def initialize(path, custom_app_path, custom_module)
@custom_app_path = custom_app_path
@@ -30,11 +31,11 @@
Dir.chdir @base_path
file_name = 'local.properties'
File.delete(file_name) if File.exist?(file_name)
- system("touch #{file_name}")
+ DryrunUtils.execute("touch #{file_name}")
end
def remove_application_id
# Open temporary file
tmp = Tempfile.new("extract")
@@ -76,33 +77,33 @@
end
builder = "gradle"
if File.exist?('gradlew')
- system('chmod +x gradlew')
+ DryrunUtils.execute('chmod +x gradlew')
builder = 'sh gradlew'
end
# Generate the gradle/ folder
- system('gradle wrap') if File.exist?('gradlew') and !is_gradle_wrapped
+ DryrunUtils.execute('gradle wrap') if File.exist?('gradlew') and !is_gradle_wrapped
remove_application_id
remove_local_properties
if @custom_module
- system("#{builder} clean :#{@custom_module}:installDebug")
+ DryrunUtils.execute("#{builder} clean :#{@custom_module}:installDebug")
else
- system("#{builder} clean installDebug")
+ DryrunUtils.execute("#{builder} clean installDebug")
end
clear_app_data
puts "Installing #{@package.green}...\n"
puts "executing: #{execute_line.green}\n\n"
- system(execute_line)
+ DryrunUtils.execute(execute_line)
end
def is_gradle_wrapped
return false if !File.directory?('gradle/')
@@ -133,14 +134,14 @@
def get_uninstall_command
"adb uninstall #{@package}"
end
def clear_app_data
- system(get_clear_app_command)
+ DryrunUtils.execute(get_clear_app_command)
end
def uninstall_application
- system(get_uninstall_command) # > /dev/null 2>&1")
+ DryrunUtils.execute(get_uninstall_command) # > /dev/null 2>&1")
end
def get_execution_line_command(path_to_sample)
path_to_manifest = File.join(path_to_sample, 'src/main/AndroidManifest.xml')