lib/calabash-android/env.rb in calabash-android-0.4.10.pre2 vs lib/calabash-android/env.rb in calabash-android-0.4.10.pre3

- old
+ new

@@ -1,6 +1,5 @@ - class Env def self.keytool_path if is_windows? "\"#{ENV["JAVA_HOME"]}/bin/keytool.exe\"" @@ -22,6 +21,31 @@ end def self.is_windows? (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/) end + + def self.tools_dir + Dir.chdir(android_home_path) do + dirs = Dir["build-tools/*"] + Dir["platform-tools"] + raise "Could not find tools directory in #{android_home_path}" if dirs.empty? + File.expand_path(dirs.first) + end + end + + def self.adb + %Q("#{android_home_path}/platform-tools/adb") + end + + def self.android_home_path + ENV["ANDROID_HOME"] + end + + def self.android_platform_path + Dir.chdir(android_home_path) do + platforms = Dir["platforms/android-*"].sort_by { |item| '%08s' % item.split('-').last } + raise "No Android SDK found in #{android_home_path}/platforms/" if platforms.empty? + File.expand_path(platforms.last) + end + end + end \ No newline at end of file