calabash-android 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
data/bin/calabash-android CHANGED
@@ -80,11 +80,11 @@ elsif cmd == 'extract-manifest'
80
80
  puts manifest ARGV.first
81
81
  exit 0
82
82
  elsif cmd == 'resign'
83
- unless File.exist? ARGV.first
83
+ unless File.exist?(File.expand_path(ARGV.first))
84
84
  puts "No such file #{ARGV.first}"
85
85
  exit 1
86
86
  end
87
- resign_apk(ARGV.first)
87
+ resign_apk(File.expand_path(ARGV.first))
88
88
 
89
89
  elsif cmd == 'version'
90
90
  puts Calabash::Android::VERSION
@@ -39,20 +39,23 @@ def test_server_path(apk_file_path)
39
39
  end
40
40
 
41
41
  def resign_apk(app_path)
42
- log "Resign apk"
43
- #Delete META-INF/*
44
- unsigned_path = Tempfile.new('unsigned.apk').path
45
- FileUtils.cp(app_path, unsigned_path)
46
-
47
- to_remove = Zip::ZipFile.foreach(unsigned_path).find_all { |e| /^META-INF\// =~ e.name}.collect &:name
48
-
49
- Zip::ZipFile.open(unsigned_path) do |zip_file|
50
- to_remove.each do |x|
51
- log "Removing #{x}"
52
- zip_file.remove x
42
+ Dir.mktmpdir do |tmp_dir|
43
+ log "Resign apk"
44
+ unsigned_path = File.join(tmp_dir, 'unsigned.apk')
45
+ FileUtils.cp(app_path, unsigned_path)
46
+
47
+ #Delete META-INF/*
48
+ to_remove = Zip::ZipFile.foreach(unsigned_path).find_all { |e| /^META-INF\// =~ e.name}.collect &:name
49
+
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
53
56
  end
57
+ sign_apk(unsigned_path, app_path)
54
58
  end
55
- sign_apk(unsigned_path, app_path)
56
59
  end
57
60
 
58
61
  def sign_apk(app_path, dest_path)
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.3.7"
3
+ VERSION = "0.3.8"
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.3.7
4
+ version: 0.3.8
5
5
  prerelease:
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-06 00:00:00.000000000 Z
12
+ date: 2012-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber