Method: Fastlane::Actions::AppiumAction.detect_appium

Defined in:
fastlane/lib/fastlane/actions/appium.rb

.detect_appium(params) ⇒ Object

[View source]

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'fastlane/lib/fastlane/actions/appium.rb', line 43

def self.detect_appium(params)
  appium_path = params[:appium_path] || `which appium`.to_s.strip

  if appium_path.empty?
    if File.exist?(APPIUM_PATH_HOMEBREW)
      appium_path = APPIUM_PATH_HOMEBREW
    elsif File.exist?(APPIUM_APP_PATH)
      appium_path = APPIUM_APP_PATH
    end
  end

  unless File.exist?(appium_path)
    UI.user_error!("You have to install Appium using `npm install -g appium`")
  end

  if appium_path.end_with?('.app')
    appium_path = "#{appium_path}/#{APPIUM_APP_BUNDLE_PATH}"
  end

  UI.message("Appium executable detected: #{appium_path}")
  appium_path
end