Class: Fastlane::Actions::StartAvdEmulatorAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/avd_emulator/actions/start_avd_emulator_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



30
31
32
# File 'lib/fastlane/plugin/avd_emulator/actions/start_avd_emulator_action.rb', line 30

def self.authors
  ["Guillaume Elloy"]
end

.available_optionsObject



40
41
42
43
44
45
46
47
48
# File 'lib/fastlane/plugin/avd_emulator/actions/start_avd_emulator_action.rb', line 40

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :name,
                            env_name: "START_ANDROID_EMULATOR_NAME",
                         description: "The name of the emulator to start",
                            optional: true,
                                type: String)
  ]
end

.descriptionObject



26
27
28
# File 'lib/fastlane/plugin/avd_emulator/actions/start_avd_emulator_action.rb', line 26

def self.description
  "This plugin is listing available android avd emulators, allowing you to start the selected one."
end

.detailsObject



34
35
36
37
38
# File 'lib/fastlane/plugin/avd_emulator/actions/start_avd_emulator_action.rb', line 34

def self.details
  "Run the plugin to list all avd emulators available in your environment. "\
  "Select one to start it. "\
  "It is also possible to start one directly by specifying his name with the :name option."
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/fastlane/plugin/avd_emulator/actions/start_avd_emulator_action.rb', line 50

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fastlane/plugin/avd_emulator/actions/start_avd_emulator_action.rb', line 7

def self.run(params)
  Helper::StartAvdEmulatorHelper.check_for_environment_variable

  emulator_name = params[:name]
  emulator_list = Helper::StartAvdEmulatorHelper.get_emulator_list

  is_emulator_available = emulator_list.include? emulator_name
  if !emulator_name or !is_emulator_available
    if emulator_name and !is_emulator_available
      Helper::StartAvdEmulatorHelper.show_name_error(emulator_name)
    end
    emulator_name = Helper::StartAvdEmulatorHelper.show_emulator_selector(emulator_list)
  end

  Helper::StartAvdEmulatorHelper.start_emulator_in_background(emulator_name)
  Helper::StartAvdEmulatorHelper.show_waiting_message
  Helper::StartAvdEmulatorHelper.wait_for_emulator_to_be_started
end