Sha256: 96efb0ac753710bfc578ccb98d763e683522d0f72070c43128dcfc6a2e18f9a0

Contents?: true

Size: 1003 Bytes

Versions: 2

Compression:

Stored size: 1003 Bytes

Contents

require 'pathname'

module Ruboto
  module SdkLocations
    if ENV['ANDROID_HOME']
      ANDROID_HOME = ENV['ANDROID_HOME']
    else
      adb_location = `#{RUBY_PLATFORM =~ /mingw|mswin/ ? 'where' : 'which'} adb`.chomp
      if adb_location.empty?
        raise 'Unable to locate the "adb" command.  Either set the ANDROID_HOME environment variable or add the location of the "adb" command to your path.'
      end
      ANDROID_HOME = File.dirname(File.dirname(Pathname.new(adb_location).realpath))
      unless File.exists? "#{ANDROID_HOME}/tools"
        puts "Found '#{adb_location}' but it is not in a proper Android SDK installation."
      end
    end
    unless File.exists? "#{ANDROID_HOME}/tools"
      raise "The '<ANDROID_HOME>/tools' directory is missing.
Please set the ANDROID_HOME environment variable to a proper Android SDK installation."
    end
    ANDROID_TOOLS_REVISION = File.read("#{ANDROID_HOME}/tools/source.properties").slice(/Pkg.Revision=\d+/).slice(/\d+$/).to_i
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruboto-0.12.0 lib/ruboto/sdk_locations.rb
ruboto-0.12.0.rc.0 lib/ruboto/sdk_locations.rb