Class: Fastlane::Helper::StartAvdEmulatorHelper
- Inherits:
-
Object
- Object
- Fastlane::Helper::StartAvdEmulatorHelper
- Defined in:
- lib/fastlane/plugin/avd_emulator/helper/start_avd_emulator_helper.rb
Class Method Summary collapse
- .check_for_environment_variable ⇒ Object
- .get_emulator_list ⇒ Object
- .show_emulator_selector(emulator_list) ⇒ Object
- .show_name_error(emulator_name) ⇒ Object
- .show_waiting_message ⇒ Object
- .start_emulator_in_background(emulator_name) ⇒ Object
- .wait_for_emulator_to_be_started ⇒ Object
Class Method Details
.check_for_environment_variable ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/fastlane/plugin/avd_emulator/helper/start_avd_emulator_helper.rb', line 8 def self.check_for_environment_variable if !ENV['ANDROID_HOME'] error_str = "\n-----------------------------------------------------"\ "\n--- $ANDROID_HOME environment variable is not set 🚨"\ "\n-----------------------------------------------------" UI.user_error!(error_str) end end |
.get_emulator_list ⇒ Object
38 39 40 |
# File 'lib/fastlane/plugin/avd_emulator/helper/start_avd_emulator_helper.rb', line 38 def self.get_emulator_list `$ANDROID_HOME/tools/emulator -list-avds`.split("\n") end |
.show_emulator_selector(emulator_list) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/fastlane/plugin/avd_emulator/helper/start_avd_emulator_helper.rb', line 24 def self.show_emulator_selector(emulator_list) select_str = "\n------------------------------------"\ "\n--- Available Android emulators 📱🤖"\ "\n------------------------------------" UI.select(select_str, emulator_list) end |
.show_name_error(emulator_name) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/fastlane/plugin/avd_emulator/helper/start_avd_emulator_helper.rb', line 17 def self.show_name_error(emulator_name) error_str = "\n---------------------------------------------------"\ "\n--- No emulator named #{emulator_name} available 🚨"\ "\n---------------------------------------------------" UI.error(error_str) end |
.show_waiting_message ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/fastlane/plugin/avd_emulator/helper/start_avd_emulator_helper.rb', line 31 def self. waiting_str = "\n---------------------------------------"\ "\n--- Waiting for selected emulator... ☕️"\ "\n---------------------------------------" UI.important(waiting_str) end |
.start_emulator_in_background(emulator_name) ⇒ Object
41 42 43 |
# File 'lib/fastlane/plugin/avd_emulator/helper/start_avd_emulator_helper.rb', line 41 def self.start_emulator_in_background(emulator_name) system("nohup $ANDROID_HOME/tools/emulator -avd #{emulator_name} > /dev/null 2>&1 &") end |
.wait_for_emulator_to_be_started ⇒ Object
44 45 46 47 |
# File 'lib/fastlane/plugin/avd_emulator/helper/start_avd_emulator_helper.rb', line 44 def self.wait_for_emulator_to_be_started lines_to_trim = 2 system("while [ `$ANDROID_HOME/platform-tools/adb devices | grep -c '^'` -le #{lines_to_trim} ] ; do sleep 1; done") end |