fix rake start_avd’ task to honor the avd’ env variable which can be used to override the default AVD configuration that should be used

This commit is contained in:
Laurent Sansonetti
2014-05-27 09:56:35 -07:00
parent 798ab6cd62
commit d2b5ec0bfc

View File

@@ -402,9 +402,10 @@ namespace 'emulator' do
desc "Start the emulator in the background"
task :start_avd do
unless `/bin/ps -a`.split(/\n/).any? { |x| x.include?('emulator64-arm') and x.include?('RubyMotion') }
avd = (ENV['avd'] || App.config.avd_config[:name])
unless `/bin/ps -a`.split(/\n/).any? { |x| x.include?('emulator64-arm') and x.include?(avd) }
Rake::Task["emulator:create_avd"].invoke
sh "\"#{App.config.sdk_path}/tools/emulator\" -avd \"#{App.config.avd_config[:name]}\" &"
sh "\"#{App.config.sdk_path}/tools/emulator\" -avd \"#{avd}\" &"
sh "\"#{App.config.sdk_path}/platform-tools/adb\" -e wait-for-device"
end
end