Sha256: e8d01149ee7cba3f5ef8cf594e2165a2c7a41ac65b2d76c1b114681951c23def

Contents?: true

Size: 1.09 KB

Versions: 2

Compression:

Stored size: 1.09 KB

Contents

class Env

  def self.keytool_path
    if is_windows?
      "\"#{ENV["JAVA_HOME"]}/bin/keytool.exe\""
    else
      "keytool"
    end
  end

  def self.jarsigner_path
    if is_windows?
      "\"#{ENV["JAVA_HOME"]}/bin/jarsigner.exe\""
    else
      "jarsigner"
    end
  end

  def self.ant_path
    is_windows? ? "ant.bat" : "ant"
  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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
calabash-android-0.4.10.pre4 lib/calabash-android/env.rb
calabash-android-0.4.10.pre3 lib/calabash-android/env.rb