calabash-android 0.4.3.pre6 → 0.4.3.pre7

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.
@@ -81,17 +81,37 @@ def sign_apk(app_path, dest_path)
81
81
  end
82
82
 
83
83
  def read_keystore_info
84
+ keystore = default_keystore
85
+
84
86
  if File.exist? ".calabash_settings"
85
87
  keystore = JSON.parse(IO.read(".calabash_settings"))
86
- keystore["keystore_location"] = '"' + File.expand_path(keystore["keystore_location"]) + '"' if keystore["keystore_location"]
87
- keystore
88
- else
89
- {
90
- "keystore_location" => %Q("#{File.expand_path(File.join(ENV["HOME"], "/.android/debug.keystore"))}\"),
88
+ fail_if_key_missing(keystore, "keystore_location")
89
+ fail_if_key_missing(keystore, "keystore_password")
90
+ fail_if_key_missing(keystore, "keystore_alias")
91
+ keystore["keystore_location"] = File.expand_path(keystore["keystore_location"])
92
+ end
93
+ keystore["keystore_location"] = put_in_quotes(remove_quotes(keystore["keystore_location"]))
94
+ keystore
95
+ end
96
+
97
+ def default_keystore
98
+ {
99
+ "keystore_location" => File.expand_path(File.join(ENV["HOME"], "/.android/debug.keystore")),
91
100
  "keystore_password" => "android",
92
101
  "keystore_alias" => "androiddebugkey",
93
- }
94
- end
102
+ }
103
+ end
104
+
105
+ def fail_if_key_missing(map, key)
106
+ raise "Found .calabash_settings but no #{key} defined." unless map[key]
107
+ end
108
+
109
+ def remove_quotes(s)
110
+ s.gsub(/"/, "")
111
+ end
112
+
113
+ def put_in_quotes(s)
114
+ %Q{"#{s}"}
95
115
  end
96
116
 
97
117
  def keytool_path
@@ -104,7 +124,7 @@ end
104
124
 
105
125
  def fingerprint_from_keystore
106
126
  keystore_info = read_keystore_info
107
- cmd = "#{keytool_path} -v -list -alias #{keystore_info["keystore_alias"]} -keystore \"#{keystore_info["keystore_location"]}\" -storepass #{keystore_info["keystore_password"]}"
127
+ cmd = "#{keytool_path} -v -list -alias #{keystore_info["keystore_alias"]} -keystore #{keystore_info["keystore_location"]} -storepass #{keystore_info["keystore_password"]}"
108
128
 
109
129
  log cmd
110
130
  fingerprints = `#{cmd}`
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.4.3.pre6"
3
+ VERSION = "0.4.3.pre7"
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.3.pre6
4
+ version: 0.4.3.pre7
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors: