Sha256: 8cbc63852ddc95312220f492734be8a3d76877f6c1f6613c100d38ecb53d1ace
Contents?: true
Size: 1.33 KB
Versions: 7
Compression:
Stored size: 1.33 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.file(file_path).hexdigest 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 def log(message, error = false) $stdout.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S")} - #{message}" if (error or ARGV.include? "-v" or ARGV.include? "--verbose") end
Version data entries
7 entries across 7 versions & 1 rubygems