calabash-android 0.4.0.pre2 → 0.4.0.pre3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -44,16 +44,8 @@ def resign_apk(app_path)
44
44
  unsigned_path = File.join(tmp_dir, 'unsigned.apk')
45
45
  FileUtils.cp(app_path, unsigned_path)
46
46
 
47
- #Delete META-INF/*
48
- to_remove = Zip::ZipFile.foreach(unsigned_path).find_all { |e| /^META-INF\// =~ e.name}.collect &:name
47
+ `java -jar "#{File.dirname(__FILE__)}/lib/unsign.jar" "#{unsigned_path}"`
49
48
 
50
- Zip::ZipFile.open(unsigned_path) do |zip_file|
51
- to_remove.each do |x|
52
- log "Removing #{x}"
53
- zip_file.remove x
54
- end
55
- zip_file.commit
56
- end
57
49
  sign_apk(unsigned_path, app_path)
58
50
  end
59
51
  end
@@ -87,9 +79,17 @@ def read_keystore_info
87
79
  end
88
80
  end
89
81
 
82
+ def keytool_path
83
+ if is_windows?
84
+ "\"#{ENV["JAVA_HOME"]}/bin/keytool.exe\""
85
+ else
86
+ "keytool"
87
+ end
88
+ end
89
+
90
90
  def fingerprint_from_keystore
91
91
  keystore_info = read_keystore_info
92
- fingerprints = `keytool -v -list -alias #{keystore_info["keystore_alias"]} -keystore #{keystore_info["keystore_location"]} -storepass #{keystore_info["keystore_password"]}`
92
+ fingerprints = `#{keytool_path} -v -list -alias #{keystore_info["keystore_alias"]} -keystore #{keystore_info["keystore_location"]} -storepass #{keystore_info["keystore_password"]}`
93
93
  md5_fingerprint = extract_md5_fingerprint(fingerprints)
94
94
  log "MD5 fingerprint for keystore (#{keystore_info["keystore_location"]}): #{md5_fingerprint}"
95
95
  md5_fingerprint
@@ -107,7 +107,7 @@ def fingerprint_from_apk(app_path)
107
107
  raise "No RSA file found in META-INF. Cannot proceed." if rsa_files.empty?
108
108
  raise "More than one RSA file found in META-INF. Cannot proceed." if rsa_files.length > 1
109
109
 
110
- fingerprints = `keytool -v -printcert -file #{rsa_files.first}`
110
+ fingerprints = `#{keytool_path} -v -printcert -file #{rsa_files.first}`
111
111
  md5_fingerprint = extract_md5_fingerprint(fingerprints)
112
112
  log "MD5 fingerprint for signing cert (#{app_path}): #{md5_fingerprint}"
113
113
  md5_fingerprint
@@ -116,9 +116,9 @@ def fingerprint_from_apk(app_path)
116
116
  end
117
117
 
118
118
  def extract_md5_fingerprint(fingerprints)
119
- m = fingerprints.scan(/MD5:\s+((?:\h\h:){15}\h\h)/)
120
- raise "No MD5 fingerprint found:\n #{fingerprints}" unless m
121
- m.last.first
119
+ m = fingerprints.scan(/MD5:\s+((?:\h\h:){15}\h\h)/).flatten
120
+ raise "No MD5 fingerprint found:\n #{fingerprints}" if m.empty?
121
+ m.first
122
122
  end
123
123
 
124
124
  def is_windows?
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.4.0.pre2"
3
+ VERSION = "0.4.0.pre3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0.pre2
4
+ version: 0.4.0.pre3
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-18 00:00:00.000000000 Z
12
+ date: 2012-12-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber
@@ -130,6 +130,7 @@ files:
130
130
  - lib/calabash-android/lib/AXMLPrinter2.jar
131
131
  - lib/calabash-android/lib/manifest_extractor.jar
132
132
  - lib/calabash-android/lib/screenShotTaker.jar
133
+ - lib/calabash-android/lib/unsign.jar
133
134
  - lib/calabash-android/management/adb.rb
134
135
  - lib/calabash-android/management/app_installation.rb
135
136
  - lib/calabash-android/operations.rb