lib/dryrun/android_project.rb in dryrun-0.5.3 vs lib/dryrun/android_project.rb in dryrun-0.5.4
- old
+ new
@@ -1,16 +1,19 @@
require 'oga'
require 'fileutils'
require 'tempfile'
require_relative 'dryrun_utils'
+require 'pry'
module DryRun
class AndroidProject
- def initialize(path, custom_app_path, custom_module)
+ def initialize(path, custom_app_path, custom_module, flavour)
+
@custom_app_path = custom_app_path
@custom_module = custom_module
@base_path = path
+ @flavour = flavour
@settings_gradle_path = settings_gradle_file
check_custom_app_path
@modules = find_modules
@@ -79,23 +82,26 @@
builder = "gradle"
if File.exist?('gradlew')
DryrunUtils.execute('chmod +x gradlew')
- builder = 'sh gradlew'
+ builder = './gradlew'
end
# Generate the gradle/ folder
DryrunUtils.execute('gradle wrap') if File.exist?('gradlew') and !is_gradle_wrapped
remove_application_id
remove_local_properties
if @custom_module
- DryrunUtils.execute("#{builder} clean :#{@custom_module}:installDebug")
+ DryrunUtils.execute("#{builder} clean")
+ DryrunUtils.execute("#{builder} :#{@custom_module}:install#{@flavour}Debug")
else
- DryrunUtils.execute("#{builder} clean installDebug")
+ DryrunUtils.execute("#{builder} clean")
+ puts "#{builder} install#{@flavour}Debug"
+ DryrunUtils.execute("#{builder} install#{@flavour}Debug")
end
clear_app_data
puts "Installing #{@package.green}...\n"
@@ -134,10 +140,10 @@
def get_uninstall_command
"adb uninstall #{@package}"
end
def clear_app_data
- DryrunUtils.execute(get_clear_app_command)
+ system(get_clear_app_command)
end
def uninstall_application
DryrunUtils.execute(get_uninstall_command) # > /dev/null 2>&1")
end