calabash-android 0.4.11 → 0.4.12
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 +4 -4
- data/Gemfile.lock +4 -4
- data/bin/calabash-android +5 -10
- data/lib/calabash-android/env.rb +94 -11
- data/lib/calabash-android/lib/TestServer.apk +0 -0
- data/lib/calabash-android/operations.rb +2 -2
- data/lib/calabash-android/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea33bf7b6030fbe284b0767a1c2ccde479b6e205
|
4
|
+
data.tar.gz: c791819581eb688c720d9e2bfb9435ff7bc8b4ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35b79d51f4e4402a2979df09eec441aa7edabaa8a5be505d75e7f8bbdd1a126aab888334730876d47075d86e36ce86a6afedc11f64edf8265308511a7b0fb826
|
7
|
+
data.tar.gz: c4c75abf90229fbe0f2cbc084a34ff75d8938fa656a13a59ac4b5e9e9469103cfcaf98d2c1266ccbf5ed01456fc3e6e3ec0762a054fe989bd1ffcb2bdb33e104
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
calabash-android (0.4.
|
4
|
+
calabash-android (0.4.12)
|
5
5
|
awesome_print
|
6
6
|
cucumber
|
7
7
|
escape (~> 0.0.4)
|
8
8
|
httpclient (~> 2.3.2)
|
9
9
|
json
|
10
|
-
retriable
|
10
|
+
retriable (~> 1.3.3.1)
|
11
11
|
rubyzip (~> 0.9.9)
|
12
12
|
slowhandcuke
|
13
13
|
xamarin-test-cloud (>= 0.9.23)
|
@@ -15,7 +15,7 @@ PATH
|
|
15
15
|
GEM
|
16
16
|
remote: http://rubygems.org/
|
17
17
|
specs:
|
18
|
-
awesome_print (1.
|
18
|
+
awesome_print (1.2.0)
|
19
19
|
builder (3.2.2)
|
20
20
|
cucumber (1.3.8)
|
21
21
|
builder (>= 2.1.2)
|
@@ -40,7 +40,7 @@ GEM
|
|
40
40
|
slowhandcuke (0.0.3)
|
41
41
|
cucumber
|
42
42
|
thor (0.18.1)
|
43
|
-
xamarin-test-cloud (0.9.
|
43
|
+
xamarin-test-cloud (0.9.25)
|
44
44
|
bundler (>= 1.3.0, < 2.0)
|
45
45
|
json
|
46
46
|
rest-client (~> 1.6.7)
|
data/bin/calabash-android
CHANGED
@@ -51,13 +51,6 @@ def relative_to_full_path(file_path)
|
|
51
51
|
File.expand_path(file_path)
|
52
52
|
end
|
53
53
|
|
54
|
-
def exit_if_android_sdk_not_found
|
55
|
-
unless File.exists?(Env.android_home_path || "")
|
56
|
-
puts "Please set ANDROID_HOME to point to the Android SDK"
|
57
|
-
exit 1
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
54
|
if (ARGV.length == 0)
|
62
55
|
print_usage
|
63
56
|
end
|
@@ -65,13 +58,13 @@ cmd = ARGV.shift
|
|
65
58
|
if cmd == 'help'
|
66
59
|
print_help
|
67
60
|
elsif cmd == 'build'
|
68
|
-
|
61
|
+
Env.exit_if_env_not_set_up
|
69
62
|
puts "Please specify the app you want to build a test server for" if (ARGV.empty? or not is_apk_file?(ARGV.first))
|
70
63
|
while not ARGV.empty? and is_apk_file?(ARGV.first)
|
71
64
|
calabash_build(relative_to_full_path(ARGV.shift))
|
72
65
|
end
|
73
66
|
elsif cmd == 'run'
|
74
|
-
|
67
|
+
Env.exit_if_env_not_set_up
|
75
68
|
if ARGV.empty? or not is_apk_file?(ARGV.first)
|
76
69
|
exit calabash_run()
|
77
70
|
else
|
@@ -80,6 +73,7 @@ elsif cmd == 'run'
|
|
80
73
|
elsif cmd == 'gen'
|
81
74
|
calabash_scaffold
|
82
75
|
elsif cmd == 'console'
|
76
|
+
Env.exit_if_env_not_set_up
|
83
77
|
if ARGV.empty?
|
84
78
|
puts "Please specify an app"
|
85
79
|
exit 1
|
@@ -90,9 +84,10 @@ elsif cmd == 'console'
|
|
90
84
|
end
|
91
85
|
calabash_console(relative_to_full_path(ARGV.shift))
|
92
86
|
elsif cmd == 'setup'
|
93
|
-
|
87
|
+
Env.exit_if_env_not_set_up
|
94
88
|
calabash_setup
|
95
89
|
elsif cmd == 'extract-manifest'
|
90
|
+
Env.exit_if_env_not_set_up
|
96
91
|
if ARGV.empty?
|
97
92
|
puts "Please specify an app"
|
98
93
|
exit 1
|
data/lib/calabash-android/env.rb
CHANGED
@@ -1,21 +1,89 @@
|
|
1
|
+
|
1
2
|
class Env
|
3
|
+
require 'win32/registry' if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/
|
4
|
+
|
5
|
+
def self.exit_if_env_not_set_up
|
6
|
+
exit_unless_jdk_is_available
|
7
|
+
exit_unless_android_sdk_is_available
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.exit_unless_android_sdk_is_available
|
11
|
+
if android_home_path
|
12
|
+
log "Android SDK found at: #{android_home_path}"
|
13
|
+
return
|
14
|
+
end
|
15
|
+
puts "Could not find an Android SDK please make sure it is installed."
|
16
|
+
puts "You can read about how Calabash-Android is searching for an Android SDK and how you can help here:"
|
17
|
+
puts "https://github.com/calabash/calabash-android/blob/master/documentation/installation.md#prerequisites"
|
18
|
+
exit 1
|
19
|
+
end
|
2
20
|
|
3
21
|
def self.keytool_path
|
22
|
+
find_executable_on_path(keytool_executable) ||
|
23
|
+
"\"#{jdk_path}/bin/#{keytool_executable}\""
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.exit_unless_jdk_is_available
|
27
|
+
jdk = jdk_path
|
28
|
+
if find_executable_on_path(keytool_executable) || jdk
|
29
|
+
log "JDK found on PATH." if find_executable_on_path(keytool_executable)
|
30
|
+
log "JDK found at: #{jdk}" if jdk
|
31
|
+
return
|
32
|
+
end
|
33
|
+
puts "Could not find Java Development Kit please make sure it is installed."
|
34
|
+
puts "You can read about how Calabash-Android is searching for a JDK and how you can help here:"
|
35
|
+
puts "https://github.com/calabash/calabash-android/blob/master/documentation/installation.md#prerequisites"
|
36
|
+
exit 1
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.jarsigner_path
|
40
|
+
find_executable_on_path(jarsigner_executable) ||
|
41
|
+
"\"#{jdk_path}/bin/#{jarsigner_executable}\""
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.jdk_path
|
45
|
+
path_if_jdk(ENV['JAVA_HOME']) ||
|
4
46
|
if is_windows?
|
5
|
-
|
47
|
+
path_if_jdk(read_registry(::Win32::Registry::HKEY_LOCAL_MACHINE, 'SOFTWARE\\JavaSoft\\Java Development Kit\\1.7', 'JavaHome')) ||
|
48
|
+
path_if_jdk(read_registry(::Win32::Registry::HKEY_LOCAL_MACHINE, 'SOFTWARE\\JavaSoft\\Java Development Kit\\1.6', 'JavaHome'))
|
6
49
|
else
|
7
|
-
|
50
|
+
path_if_android_home(read_attribute_from_monodroid_config('java-sdk', 'path'))
|
8
51
|
end
|
9
52
|
end
|
10
53
|
|
11
|
-
def self.
|
54
|
+
def self.android_home_path
|
55
|
+
path_if_android_home(ENV["ANDROID_HOME"]) ||
|
12
56
|
if is_windows?
|
13
|
-
|
57
|
+
path_if_android_home(read_registry(::Win32::Registry::HKEY_LOCAL_MACHINE, 'SOFTWARE\\Android SDK Tools', 'Path')) ||
|
58
|
+
path_if_android_home("C:\\Android\\android-sdk")
|
14
59
|
else
|
15
|
-
|
60
|
+
path_if_android_home(read_attribute_from_monodroid_config('android-sdk', 'path'))
|
16
61
|
end
|
17
62
|
end
|
18
63
|
|
64
|
+
def self.find_executable_on_path(executable)
|
65
|
+
path = path_elements.each do |x|
|
66
|
+
f = File.join(x, executable)
|
67
|
+
return "\"#{f}\"" if File.exists?(f)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.path_if_jdk(path)
|
72
|
+
path if path && File.exists?(File.join(path, 'bin', jarsigner_executable))
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.jarsigner_executable
|
76
|
+
is_windows? ? 'jarsigner.exe' : 'jarsigner'
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.keytool_executable
|
80
|
+
is_windows? ? 'keytool.exe' : 'keytool'
|
81
|
+
end
|
82
|
+
|
83
|
+
def self.adb_executable
|
84
|
+
is_windows? ? 'adb.exe' : 'adb'
|
85
|
+
end
|
86
|
+
|
19
87
|
def self.ant_path
|
20
88
|
is_windows? ? "ant.bat" : "ant"
|
21
89
|
end
|
@@ -32,21 +100,28 @@ class Env
|
|
32
100
|
end
|
33
101
|
end
|
34
102
|
|
35
|
-
def self.
|
36
|
-
%Q("#{android_home_path}/platform-tools
|
103
|
+
def self.adb_path
|
104
|
+
%Q("#{android_home_path}/platform-tools/#{adb_executable}")
|
105
|
+
end
|
106
|
+
|
107
|
+
def self.path_if_android_home(path)
|
108
|
+
path if path && File.exists?(File.join(path, 'platform-tools', adb_executable))
|
37
109
|
end
|
38
110
|
|
39
|
-
def self.
|
40
|
-
return
|
111
|
+
def self.path_elements
|
112
|
+
return [] unless ENV['PATH']
|
113
|
+
ENV['PATH'].split (/[:;]/)
|
114
|
+
end
|
115
|
+
|
116
|
+
def self.read_attribute_from_monodroid_config(element, attribute)
|
41
117
|
monodroid_config_file = File.expand_path("~/.config/xbuild/monodroid-config.xml")
|
42
118
|
if File.exists?(monodroid_config_file)
|
43
119
|
require 'rexml/document'
|
44
120
|
begin
|
45
|
-
return REXML::Document.new(IO.read(monodroid_config_file)).elements["
|
121
|
+
return REXML::Document.new(IO.read(monodroid_config_file)).elements["//#{element}"].attributes[attribute]
|
46
122
|
rescue
|
47
123
|
end
|
48
124
|
end
|
49
|
-
nil
|
50
125
|
end
|
51
126
|
|
52
127
|
def self.android_platform_path
|
@@ -57,4 +132,12 @@ class Env
|
|
57
132
|
end
|
58
133
|
end
|
59
134
|
|
135
|
+
def self.read_registry(root_key, key, value)
|
136
|
+
begin
|
137
|
+
root_key.open(key)[value]
|
138
|
+
rescue
|
139
|
+
nil
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
60
143
|
end
|
Binary file
|
@@ -402,7 +402,7 @@ module Operations
|
|
402
402
|
end
|
403
403
|
|
404
404
|
def adb_command
|
405
|
-
"#{Env.
|
405
|
+
"#{Env.adb_path} -s #{serial}"
|
406
406
|
end
|
407
407
|
|
408
408
|
def default_serial
|
@@ -439,7 +439,7 @@ module Operations
|
|
439
439
|
end
|
440
440
|
|
441
441
|
def connected_devices
|
442
|
-
lines = `#{Env.
|
442
|
+
lines = `#{Env.adb_path} devices`.split("\n")
|
443
443
|
lines.shift
|
444
444
|
lines.collect { |l| l.split("\t").first}
|
445
445
|
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.4.
|
4
|
+
version: 0.4.12
|
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-09-
|
11
|
+
date: 2013-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|