class Screengrab::AndroidEnvironment

Attributes

android_home[R]

Public Class Methods

new(android_home, build_tools_version = nil) click to toggle source

android_home - the String path to the install location of the Android SDK build_tools_version - the String version of the Android build tools that should be used, ignored

# File screengrab/lib/screengrab/android_environment.rb, line 10
def initialize(android_home, build_tools_version = nil)
  @android_home = android_home
end

Public Instance Methods

adb_path() click to toggle source
# File screengrab/lib/screengrab/android_environment.rb, line 18
def adb_path
  @adb_path ||= find_adb(platform_tools_path)
end
platform_tools_path() click to toggle source
# File screengrab/lib/screengrab/android_environment.rb, line 14
def platform_tools_path
  @platform_tools_path ||= find_platform_tools(android_home)
end

Private Instance Methods

executable_command?(cmd_path) click to toggle source
# File screengrab/lib/screengrab/android_environment.rb, line 39
def executable_command?(cmd_path)
  Helper.executable?(cmd_path)
end
find_adb(platform_tools_path) click to toggle source
# File screengrab/lib/screengrab/android_environment.rb, line 31
def find_adb(platform_tools_path)
  return FastlaneCore::CommandExecutor.which('adb') unless platform_tools_path

  adb_path = Helper.get_executable_path(File.join(platform_tools_path, 'adb'))
  adb_path = Helper.localize_file_path(adb_path)
  return executable_command?(adb_path) ? adb_path : nil
end
find_platform_tools(android_home) click to toggle source
# File screengrab/lib/screengrab/android_environment.rb, line 24
def find_platform_tools(android_home)
  return nil unless android_home

  platform_tools_path = Helper.localize_file_path(File.join(android_home, 'platform-tools'))
  File.directory?(platform_tools_path) ? platform_tools_path : nil
end