calabash-android 0.4.16 → 0.4.18

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7314407709a63f7e8e463a01e2e12b5c9a697fe
4
- data.tar.gz: 2d95c65ee050fec3409ccaf1ef7168bf89757290
3
+ metadata.gz: 2c44c0e993a7a43772eeba1e688c898e44bf09c6
4
+ data.tar.gz: 3dfac41109392ced77865e6b0e8853c7fa90252d
5
5
  SHA512:
6
- metadata.gz: b6f1ebb7b0abff64917d9bf2db2ee0a064b4ef6ec3ec8c7b20fd9886b3914382a97277c68e88f72a9e7b7eadd281356602884c96e560cf45800d18c0e071f4ba
7
- data.tar.gz: 2eb5199dafc58b36844e9198c80752e9bd517cebb89db931855afd22ff9aad993302a0471d16db42a51a10f486fab24034627d2501d9eaefbf39516c84fa3684
6
+ metadata.gz: fc19afcc81335aa79fd2eb45cc34c58fd0a21bc298f059ce7061a453d4ddf564c3347b0321ac7573828f6977dd9a39769d2f1463e498e484f5ef60061775c69b
7
+ data.tar.gz: 3879719b56b1aa587f552ff601db1f36e7576d2b7105496d08b5fbf48206f739186c53037acc28c226edd928bb9dcdef402e23f9e1aa982e6126ef0d38e1b064
@@ -3,6 +3,11 @@ def calabash_build(app)
3
3
  log "#{app} was signed with a certificate with fingerprint #{apk_fingerprint}"
4
4
 
5
5
  keystores = JavaKeystore.get_keystores
6
+ if keystores.empty?
7
+ puts "No keystores found."
8
+ puts "Please create one or run calabash-android setup to configure calabash-android to use an existing keystore."
9
+ exit 1
10
+ end
6
11
  keystore = keystores.find { |k| k.fingerprint == apk_fingerprint}
7
12
 
8
13
  unless keystore
@@ -78,6 +78,10 @@ class Env
78
78
  path if path && File.exists?(File.join(path, 'bin', jarsigner_executable))
79
79
  end
80
80
 
81
+ def self.zipalign_path
82
+ %Q("#{android_home_path}/tools/zipalign")
83
+ end
84
+
81
85
  def self.jarsigner_executable
82
86
  is_windows? ? 'jarsigner.exe' : 'jarsigner'
83
87
  end
@@ -76,14 +76,27 @@ def resign_apk(app_path)
76
76
  Dir.mktmpdir do |tmp_dir|
77
77
  log "Resign apk"
78
78
  unsigned_path = File.join(tmp_dir, 'unsigned.apk')
79
+ unaligned_path = File.join(tmp_dir, 'unaligned.apk')
79
80
  FileUtils.cp(app_path, unsigned_path)
81
+ unsign_apk(unsigned_path)
82
+ sign_apk(unsigned_path, unaligned_path)
83
+ zipalign_apk(unaligned_path, app_path)
84
+ end
85
+ end
80
86
 
81
- `#{Env.java_path} -jar "#{File.dirname(__FILE__)}/lib/unsign.jar" "#{unsigned_path}"`
82
-
83
- sign_apk(unsigned_path, app_path)
87
+ def unsign_apk(path)
88
+ files_to_remove = `#{Env.tools_dir}/aapt list "#{path}"`.lines.collect(&:strip).grep(/^META-INF\//)
89
+ if files_to_remove.empty?
90
+ log "App wasn't signed. Will not try to unsign it."
91
+ else
92
+ system("#{Env.tools_dir}/aapt remove \"#{path}\" #{files_to_remove.join(" ")}")
84
93
  end
85
94
  end
86
95
 
96
+ def zipalign_apk(inpath, outpath)
97
+ system(%Q(#{Env.zipalign_path} -f 4 "#{inpath}" "#{outpath}"))
98
+ end
99
+
87
100
  def sign_apk(app_path, dest_path)
88
101
  java_keystore = JavaKeystore.get_keystores.first
89
102
  java_keystore.sign_apk(app_path, dest_path)
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.4.16"
3
+ VERSION = "0.4.18"
4
4
  end
5
5
  end
@@ -44,6 +44,14 @@
44
44
  <fail unless="doesCalabashJsExist">
45
45
  ${calabashjs.dir} does not exist.
46
46
  </fail>
47
+ <antversion property="version.running" />
48
+ <fail message="FATAL ERROR: The running Ant version, ${version.running}, is too old.">
49
+ <condition>
50
+ <not>
51
+ <antversion atleast="1.8" />
52
+ </not>
53
+ </condition>
54
+ </fail>
47
55
  </target>
48
56
 
49
57
  <target name="-stage">
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.16
4
+ version: 0.4.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Maturana Larsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-11 00:00:00.000000000 Z
11
+ date: 2013-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -180,7 +180,6 @@ files:
180
180
  - lib/calabash-android/lib/apktool-cli-1.5.3-SNAPSHOT.jar
181
181
  - lib/calabash-android/lib/manifest_extractor.jar
182
182
  - lib/calabash-android/lib/screenshotTaker.jar
183
- - lib/calabash-android/lib/unsign.jar
184
183
  - lib/calabash-android/management/adb.rb
185
184
  - lib/calabash-android/management/app_installation.rb
186
185
  - lib/calabash-android/operations.rb