calabash-android 0.5.8 → 0.5.9.pre1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b2972ff40ef8c48deee8114f14ef05c167eb515a
4
- data.tar.gz: 2616762916d55820dd12156e65adfbc12e85c997
3
+ metadata.gz: 091c6d35abaadeb97ab814a723dfdc9baeb69702
4
+ data.tar.gz: c4d86e7ce7e2b7c101a23c66528346ea39e679bf
5
5
  SHA512:
6
- metadata.gz: 796972c0f61e384a2894b1e3ac3051aa5bcd0eb3f6ef5346285d5f2804faa5e9ed5513d124dc7caaa67027ac37c833b498cfd3a4fd00facd69cbefaac3998051
7
- data.tar.gz: 8a5151fca2ba0de14738a2b1551b0eed9847d185a0a71c7377b9d954100e21149fdac139de182ba17bea366332e7b41f5afccc585a922c773335816d2b58ef8e
6
+ metadata.gz: 3c538a2dc7c8a24887e9cb8d2e676ded1ffc7523b564e667590308000095d17d14ad1ba2e38daebe3badc0b3f54c85695f02b4627a97085752f367658bccef7d
7
+ data.tar.gz: c55e01a414d1ffb8e7390187e898dc1a837d9dfd7d009335c7b413cae58a2ca1988a0c14b87de1cfe63690ab23592f0f51cdcf85eb3489392f82cd110c74de87
@@ -1,36 +1,28 @@
1
1
  require 'calabash-android/management/app_installation'
2
2
 
3
3
  AfterConfiguration do |config|
4
- FeatureNameMemory.feature_name = nil
4
+ FeatureMemory.feature = nil
5
5
  end
6
6
 
7
7
  Before do |scenario|
8
- @scenario_is_outline = (scenario.class == Cucumber::Ast::OutlineTable::ExampleRow)
9
- if @scenario_is_outline
10
- scenario = scenario.scenario_outline
11
- end
8
+ scenario = scenario.scenario_outline if scenario.respond_to?(:scenario_outline)
12
9
 
13
- feature_name = scenario.feature.title
14
- if FeatureNameMemory.feature_name != feature_name \
15
- or ENV["RESET_BETWEEN_SCENARIOS"] == "1"
16
- if ENV["RESET_BETWEEN_SCENARIOS"] == "1"
17
- log "New scenario - reinstalling apps"
10
+ feature = scenario.feature
11
+ if FeatureMemory.feature != feature || ENV['RESET_BETWEEN_SCENARIOS'] == '1'
12
+ if ENV['RESET_BETWEEN_SCENARIOS'] == '1'
13
+ log 'New scenario - reinstalling apps'
18
14
  else
19
- log "First scenario in feature - reinstalling apps"
15
+ log 'First scenario in feature - reinstalling apps'
20
16
  end
21
-
17
+
22
18
  uninstall_apps
23
- install_app(ENV["TEST_APP_PATH"])
24
- install_app(ENV["APP_PATH"])
25
- FeatureNameMemory.feature_name = feature_name
26
- FeatureNameMemory.invocation = 1
19
+ install_app(ENV['TEST_APP_PATH'])
20
+ install_app(ENV['APP_PATH'])
21
+ FeatureMemory.feature = feature
22
+ FeatureMemory.invocation = 1
27
23
  else
28
- FeatureNameMemory.invocation += 1
24
+ FeatureMemory.invocation += 1
29
25
  end
30
26
  end
31
27
 
32
- FeatureNameMemory = Class.new
33
- class << FeatureNameMemory
34
- @feature_name = nil
35
- attr_accessor :feature_name, :invocation
36
- end
28
+ FeatureMemory = Struct.new(:feature, :invocation).new
@@ -146,14 +146,20 @@ def fingerprint_from_apk(app_path)
146
146
  FileUtils.cp(app_path, "app.apk")
147
147
  FileUtils.mkdir("META-INF")
148
148
  Zip::File.foreach("app.apk") do |z|
149
- z.extract if /^META-INF\/\w+.(RSA|rsa)/ =~ z.name
149
+ z.extract if /^META-INF\/\w+.(rsa|dsa)/i =~ z.name
150
150
  end
151
- rsa_files = Dir["#{tmp_dir}/META-INF/*"]
151
+ signature_files = Dir["#{tmp_dir}/META-INF/*"]
152
152
 
153
- raise "No RSA file found in META-INF. Cannot proceed." if rsa_files.empty?
154
- raise "More than one RSA file found in META-INF. Cannot proceed." if rsa_files.length > 1
153
+ log 'Signature files:'
155
154
 
156
- cmd = "#{Env.keytool_path} -v -printcert -J\"-Dfile.encoding=utf-8\" -file \"#{rsa_files.first}\""
155
+ signature_files.each do |signature_file|
156
+ log signature_file
157
+ end
158
+
159
+ raise "No signature files found in META-INF. Cannot proceed." if signature_files.empty?
160
+ raise "More than one signature file (DSA or RSA) found in META-INF. Cannot proceed." if signature_files.length > 1
161
+
162
+ cmd = "#{Env.keytool_path} -v -printcert -J\"-Dfile.encoding=utf-8\" -file \"#{signature_files.first}\""
157
163
  log cmd
158
164
  fingerprints = `#{cmd}`
159
165
  md5_fingerprint = extract_md5_fingerprint(fingerprints)
@@ -169,6 +175,12 @@ def extract_md5_fingerprint(fingerprints)
169
175
  m.first
170
176
  end
171
177
 
178
+ def extract_signature_algorithm_name(fingerprints)
179
+ m = fingerprints.scan(/Signature algorithm name: (.*)/).flatten
180
+ raise "No signature algorithm names found:\n #{fingerprints}" if m.empty?
181
+ m.first
182
+ end
183
+
172
184
  def log(message, error = false)
173
185
  $stdout.puts "#{Time.now.strftime("%Y-%m-%d %H:%M:%S")} - #{message}" if (error or ARGV.include? "-v" or ARGV.include? "--verbose")
174
186
  end
@@ -1,5 +1,6 @@
1
1
  class JavaKeystore
2
2
  attr_reader :errors, :location, :keystore_alias, :password, :fingerprint
3
+ attr_reader :signature_algorithm_name
3
4
 
4
5
  def initialize(location, keystore_alias, password)
5
6
  raise "No such keystore file '#{location}'" unless File.exists?(File.expand_path(location))
@@ -38,13 +39,16 @@ class JavaKeystore
38
39
  log "Key store data:"
39
40
  log keystore_data
40
41
  @fingerprint = extract_md5_fingerprint(keystore_data)
42
+ @signature_algorithm_name = extract_signature_algorithm_name(keystore_data)
43
+ log "Fingerprint: #{fingerprint}"
44
+ log "Signature algorithm name: #{signature_algorithm_name}"
41
45
  end
42
46
 
43
47
  def sign_apk(apk_path, dest_path)
44
48
  raise "Cannot sign with a miss configured keystore" if errors
45
49
  raise "No such file: #{apk_path}" unless File.exists?(apk_path)
46
50
 
47
- unless system_with_stdout_on_success(Env.jarsigner_path, '-sigalg', 'MD5withRSA', '-digestalg', 'SHA1', '-signedjar', dest_path, '-storepass', password, '-keystore', location, apk_path, keystore_alias)
51
+ unless system_with_stdout_on_success(Env.jarsigner_path, '-sigalg', signature_algorithm_name, '-digestalg', 'SHA1', '-signedjar', dest_path, '-storepass', password, '-keystore', location, apk_path, keystore_alias)
48
52
  raise "Could not sign app: #{apk_path}"
49
53
  end
50
54
  end
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.5.8"
3
+ VERSION = "0.5.9.pre1"
4
4
  end
5
5
  end
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.5.8
4
+ version: 0.5.9.pre1
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: 2015-03-09 00:00:00.000000000 Z
11
+ date: 2015-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -266,9 +266,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
266
266
  version: '0'
267
267
  required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  requirements:
269
- - - '>='
269
+ - - '>'
270
270
  - !ruby/object:Gem::Version
271
- version: '0'
271
+ version: 1.3.1
272
272
  requirements: []
273
273
  rubyforge_project:
274
274
  rubygems_version: 2.0.2