Sha256: 103676c48e32bdeb6a98ec9e87aead5f6b00db37daa2006a4ffb71b079ae1a5d

Contents?: true

Size: 1.17 KB

Versions: 6

Compression:

Stored size: 1.17 KB

Contents

require 'rexml/document'
require 'rexml/xpath'

include REXML

def package_name(app)
  require 'rexml/document'
  require 'rexml/xpath'

  manifest = Document.new(manifest(app))
  manifest.root.attributes['package']
end
  
def main_activity(app)
  manifest = Document.new(manifest(app))
  main_activity = manifest.elements["//action[@name='android.intent.action.MAIN']/../.."].attributes['name']
  #Handle situation where main activity is on the form '.class_name'
  if main_activity.start_with? "."
    main_activity = package_name(app) + main_activity
  elsif not main_activity.include? "." #This is undocumentet behaviour but Android seems to accept shorthand naming that does not start with '.'
    main_activity = "#{package_name(app)}.#{main_activity}"
  end
  main_activity
end

def manifest(app)
  `java -jar "#{File.dirname(__FILE__)}/lib/manifest_extractor.jar" "#{app}"`
end

def checksum(file_path)
  require 'digest/md5'
  Digest::MD5.hexdigest(File.read(file_path))
end

def test_server_path(apk_file_path)
  "test_servers/#{checksum(apk_file_path)}_#{Calabash::Android::VERSION}.apk"
end

def is_windows?
  require 'rbconfig'
  (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)
end


Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
calabash-android-0.3.2.pre2 lib/calabash-android/helpers.rb
calabash-android-0.3.2.pre1 lib/calabash-android/helpers.rb
calabash-android-0.3.1 lib/calabash-android/helpers.rb
calabash-android-0.3.0 lib/calabash-android/helpers.rb
calabash-android-0.3.0.pre10 lib/calabash-android/helpers.rb
calabash-android-0.3.0.pre9 lib/calabash-android/helpers.rb