calabash 2.0.0.pre2 → 2.0.0.pre3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -26
- data/lib/calabash/android/adb.rb +9 -0
- data/lib/calabash/android/build/builder.rb +2 -0
- data/lib/calabash/android/build/java_keystore.rb +10 -0
- data/lib/calabash/android/build/resigner.rb +4 -0
- data/lib/calabash/android/build/test_server.rb +2 -0
- data/lib/calabash/android/defaults.rb +1 -0
- data/lib/calabash/android/device.rb +18 -0
- data/lib/calabash/android/interactions.rb +2 -0
- data/lib/calabash/android/lib/TestServer.apk +0 -0
- data/lib/calabash/android/life_cycle.rb +1 -0
- data/lib/calabash/android/physical_buttons.rb +8 -0
- data/lib/calabash/android/screenshot.rb +1 -0
- data/lib/calabash/android/server.rb +1 -0
- data/lib/calabash/android/text.rb +1 -0
- data/lib/calabash/cli/build.rb +1 -0
- data/lib/calabash/cli/console.rb +2 -0
- data/lib/calabash/cli/generate.rb +3 -0
- data/lib/calabash/cli/helpers.rb +6 -0
- data/lib/calabash/cli/resign.rb +1 -0
- data/lib/calabash/cli/run.rb +2 -0
- data/lib/calabash/cli/setup_keystore.rb +2 -0
- data/lib/calabash/color.rb +7 -0
- data/lib/calabash/defaults.rb +1 -0
- data/lib/calabash/device.rb +2 -0
- data/lib/calabash/environment.rb +1 -0
- data/lib/calabash/http/retriable_client.rb +2 -0
- data/lib/calabash/interactions.rb +1 -0
- data/lib/calabash/ios/conditions.rb +3 -0
- data/lib/calabash/ios/date_picker.rb +412 -0
- data/lib/calabash/ios/defaults.rb +1 -0
- data/lib/calabash/ios/device/device_implementation.rb +5 -1
- data/lib/calabash/ios/device/ipad_1x_2x_mixin.rb +253 -0
- data/lib/calabash/ios/device/keyboard_mixin.rb +2 -0
- data/lib/calabash/ios/device/rotation_mixin.rb +1 -0
- data/lib/calabash/ios/device/routes/condition_route_mixin.rb +1 -0
- data/lib/calabash/ios/device/routes/map_route_mixin.rb +1 -0
- data/lib/calabash/ios/device/routes/response_parser.rb +1 -0
- data/lib/calabash/ios/device/routes/uia_route_mixin.rb +44 -6
- data/lib/calabash/ios/device/text_mixin.rb +2 -0
- data/lib/calabash/ios/device/uia_keyboard_mixin.rb +9 -0
- data/lib/calabash/ios/device/uia_mixin.rb +1 -0
- data/lib/calabash/ios/device.rb +1 -0
- data/lib/calabash/ios/interactions.rb +30 -1
- data/lib/calabash/ios/runtime.rb +8 -0
- data/lib/calabash/ios.rb +2 -0
- data/lib/calabash/life_cycle.rb +19 -2
- data/lib/calabash/location.rb +2 -0
- data/lib/calabash/page.rb +13 -0
- data/lib/calabash/patch.rb +1 -0
- data/lib/calabash/utility.rb +4 -4
- data/lib/calabash/version.rb +1 -1
- data/lib/calabash/wait.rb +4 -0
- data/lib/calabash.rb +6 -4
- metadata +113 -112
- data/lib/calabash/android/scroll.rb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99f4bb2a90e0b3d0e826f6afe73b213a36e984e0
|
4
|
+
data.tar.gz: 2056799cd44ee3504b986351da16bb834f72e382
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ba0e8c86de9a8682affd9712cbfc4d7b50bf472bc285c8375e210ae5f99146910f6229ff140cc316ab6dea697ecfbc0bc75e415f750b8706940981080bfa2a1
|
7
|
+
data.tar.gz: 2a71fcf01eb79e7cb15d294a70b7cd9ba42111c09ef82966e4b9d7522221e7b726df29483683b6ef6640412b75f2e2edc80c0e4084567d57a02b1a1c68102140
|
data/README.md
CHANGED
@@ -27,8 +27,6 @@ $ rake -T
|
|
27
27
|
rake android:build # Build the Android test server
|
28
28
|
rake build # Build calabash-1.9.9.pre2.gem into the pkg directory
|
29
29
|
rake ctags # Generate ctags in ./git/tags
|
30
|
-
rake cucumber:android # Run Android cucumber tests
|
31
|
-
rake cucumber:ios # Run iOS cucumber tests
|
32
30
|
rake install # Build and install calabash-1.9.9.pre2.gem into system gems
|
33
31
|
rake release # Create tag v1.9.9.pre2 and build and push calabash-1.9.9.pre2.gem to Rubygems
|
34
32
|
rake spec # Run RSpec code examples
|
@@ -63,28 +61,5 @@ $ be cucumber
|
|
63
61
|
|
64
62
|
### Cucumber iOS
|
65
63
|
|
66
|
-
|
67
|
-
$ cd cucumber/ios
|
68
|
-
$ bundle update
|
69
|
-
$ rake ensure_app # Optional. See note below.
|
70
|
-
$ be cucumber
|
71
|
-
```
|
72
|
-
|
73
|
-
The rake task `ensure_app` checks the `cucumber/ios` directory for
|
74
|
-
CalSmoke-cal.app. If it exists, it will do nothing. If it does not exist,
|
75
|
-
it will pull the latest sources from the CalSmoke repo, build the
|
76
|
-
CalSmoke-cal.app from the master branch, and install it in the
|
77
|
-
`cucumber/ios` directory.
|
78
|
-
|
79
|
-
If you want to use a different CalSmoke-cal.app, drop it into `cucumber/ios`
|
80
|
-
or call cucumber with `CAL\_APP` set.
|
81
|
-
|
82
|
-
```
|
83
|
-
$ CAL_APP=/path/to/your/CalSmoke-cal.app be cucumber
|
84
|
-
```
|
85
|
-
|
86
|
-
The rake task `ensure_ipa` does the same thing, but for the CalSmoke-cal.ipa.
|
87
|
-
|
88
|
-
Testing against physical devices requires that you have ideviceinstaller
|
89
|
-
installed in /usr/local/bin/ideviceinstaller.
|
64
|
+
See `cucumber/ios/README.md`.
|
90
65
|
|
data/lib/calabash/android/adb.rb
CHANGED
@@ -17,8 +17,10 @@ module Calabash
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
# @!visibility private
|
20
21
|
PROCESS_WAIT_TIME = 10
|
21
22
|
|
23
|
+
# @!visibility private
|
22
24
|
def self.open_pipe_with_timeout(timeout, *cmd, &block)
|
23
25
|
begin
|
24
26
|
i, o, e, t, pid = nil
|
@@ -52,6 +54,7 @@ module Calabash
|
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
57
|
+
# @!visibility private
|
55
58
|
def self.open_adb_pipe(*cmd, **options, &block)
|
56
59
|
timeout = options.fetch(:timeout, PROCESS_WAIT_TIME)
|
57
60
|
|
@@ -60,8 +63,10 @@ module Calabash
|
|
60
63
|
end
|
61
64
|
end
|
62
65
|
|
66
|
+
# @!visibility private
|
63
67
|
DAEMON_STARTED_MESSAGE = "* daemon not running. starting it now on port 5037 *\n* daemon started successfully *\n"
|
64
68
|
|
69
|
+
# @!visibility private
|
65
70
|
def self.command(*cmd, **args)
|
66
71
|
Logger.debug("ADB Command: #{cmd.join(', ')}")
|
67
72
|
Logger.debug("ADB input: #{args[:input]}")
|
@@ -121,10 +126,12 @@ module Calabash
|
|
121
126
|
|
122
127
|
attr_reader :serial
|
123
128
|
|
129
|
+
# @!visibility private
|
124
130
|
def initialize(serial)
|
125
131
|
@serial = serial
|
126
132
|
end
|
127
133
|
|
134
|
+
# @!visibility private
|
128
135
|
def command(*argv, **args)
|
129
136
|
cmd = argv.dup
|
130
137
|
|
@@ -135,8 +142,10 @@ module Calabash
|
|
135
142
|
ADB.command(*cmd, args)
|
136
143
|
end
|
137
144
|
|
145
|
+
# @!visibility private
|
138
146
|
END_STRING = '__CAL_END__'
|
139
147
|
|
148
|
+
# @!visibility private
|
140
149
|
def shell(shell_cmd, options={})
|
141
150
|
if shell_cmd.nil? || shell_cmd.empty?
|
142
151
|
raise ArgumentError, "Invalid shell command '#{shell_cmd}'"
|
@@ -16,6 +16,7 @@ module Calabash
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
# @!visibility private
|
19
20
|
def build
|
20
21
|
apk_fingerprint = fingerprint_from_apk
|
21
22
|
@logger.log "#{@application_path} was signed with a certificate with fingerprint #{apk_fingerprint}", :debug
|
@@ -83,6 +84,7 @@ module Calabash
|
|
83
84
|
@logger.log "Done signing the test server. Moved it to #{test_server_file_name}"
|
84
85
|
end
|
85
86
|
|
87
|
+
# @!visibility private
|
86
88
|
def fingerprint_from_apk
|
87
89
|
application_path = File.expand_path(@application_path)
|
88
90
|
|
@@ -5,6 +5,7 @@ module Calabash
|
|
5
5
|
module Build
|
6
6
|
# @!visibility private
|
7
7
|
class JavaKeystore
|
8
|
+
# @!visibility private
|
8
9
|
CALABASH_KEYSTORE_SETTINGS_FILENAME = 'calabash_keystore_settings.json'
|
9
10
|
|
10
11
|
attr_reader :errors, :location, :keystore_alias, :store_password
|
@@ -68,6 +69,7 @@ module Calabash
|
|
68
69
|
@logger.log "Signature algorithm name: #{signature_algorithm_name}", :debug
|
69
70
|
end
|
70
71
|
|
72
|
+
# @!visibility private
|
71
73
|
def sign_apk(apk_path, dest_path)
|
72
74
|
raise "Cannot sign with a miss configured keystore" if errors
|
73
75
|
raise "No such file: #{apk_path}" unless File.exists?(apk_path)
|
@@ -86,6 +88,7 @@ module Calabash
|
|
86
88
|
end
|
87
89
|
end
|
88
90
|
|
91
|
+
# @!visibility private
|
89
92
|
def system_with_stdout_on_success(cmd, *args)
|
90
93
|
a = Escape.shell_command(args)
|
91
94
|
cmd = "#{cmd} #{a.gsub("'", '"')}"
|
@@ -98,10 +101,12 @@ module Calabash
|
|
98
101
|
end
|
99
102
|
end
|
100
103
|
|
104
|
+
# @!visibility private
|
101
105
|
def fail_wrong_info
|
102
106
|
raise "Could not read keystore with the given credentials. Please ensure "
|
103
107
|
end
|
104
108
|
|
109
|
+
# @!visibility private
|
105
110
|
def self.read_keystore_with_default_password_and_alias(path)
|
106
111
|
path = File.expand_path path
|
107
112
|
|
@@ -128,6 +133,7 @@ module Calabash
|
|
128
133
|
end
|
129
134
|
end
|
130
135
|
|
136
|
+
# @!visibility private
|
131
137
|
def self.get_keystores
|
132
138
|
if keystore = keystore_from_settings
|
133
139
|
[ keystore ]
|
@@ -141,6 +147,7 @@ module Calabash
|
|
141
147
|
end
|
142
148
|
end
|
143
149
|
|
150
|
+
# @!visibility private
|
144
151
|
def self.keystore_from_settings
|
145
152
|
if File.exist?(CALABASH_KEYSTORE_SETTINGS_FILENAME)
|
146
153
|
Logger.info "Reading keystore information specified in #{CALABASH_KEYSTORE_SETTINGS_FILENAME}"
|
@@ -157,16 +164,19 @@ module Calabash
|
|
157
164
|
end
|
158
165
|
end
|
159
166
|
|
167
|
+
# @!visibility private
|
160
168
|
def self.fail_if_key_missing(map, key)
|
161
169
|
raise "Found #{CALABASH_KEYSTORE_SETTINGS_FILENAME} but no #{key} defined." unless map[key]
|
162
170
|
end
|
163
171
|
|
172
|
+
# @!visibility private
|
164
173
|
def self.extract_md5_fingerprint(fingerprints)
|
165
174
|
m = fingerprints.scan(/MD5.*((?:[a-fA-F\d]{2}:){15}[a-fA-F\d]{2})/).flatten
|
166
175
|
raise "No MD5 fingerprint found:\n #{fingerprints}" if m.empty?
|
167
176
|
m.first
|
168
177
|
end
|
169
178
|
|
179
|
+
# @!visibility private
|
170
180
|
def self.extract_signature_algorithm_name(fingerprints)
|
171
181
|
m = fingerprints.scan(/Signature algorithm name: (.*)/).flatten
|
172
182
|
raise "No signature algorithm names found:\n #{fingerprints}" if m.empty?
|
@@ -14,6 +14,7 @@ module Calabash
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
# @!visibility private
|
17
18
|
def resign!
|
18
19
|
Dir.mktmpdir do |tmp_dir|
|
19
20
|
@logger.log 'Resigning apk', :debug
|
@@ -26,6 +27,7 @@ module Calabash
|
|
26
27
|
end
|
27
28
|
end
|
28
29
|
|
30
|
+
# @!visibility private
|
29
31
|
def unsign(unsigned_path)
|
30
32
|
meta_files = `"#{Environment.aapt_path}" list "#{unsigned_path}"`.lines.collect(&:strip).grep(/^META-INF\//)
|
31
33
|
|
@@ -53,12 +55,14 @@ module Calabash
|
|
53
55
|
end
|
54
56
|
end
|
55
57
|
|
58
|
+
# @!visibility private
|
56
59
|
def zipalign(unaligned_path, app_path)
|
57
60
|
cmd = %Q("#{Environment.zipalign_path}" -f 4 "#{unaligned_path}" "#{app_path}")
|
58
61
|
@logger.log "Zipaligning using: #{cmd}", :debug
|
59
62
|
system(cmd)
|
60
63
|
end
|
61
64
|
|
65
|
+
# @!visibility private
|
62
66
|
def sign(app_path, dest_path)
|
63
67
|
java_keystore = JavaKeystore.get_keystores.first
|
64
68
|
|
@@ -7,10 +7,12 @@ module Calabash
|
|
7
7
|
@application_path = application_path
|
8
8
|
end
|
9
9
|
|
10
|
+
# @!visibility private
|
10
11
|
def path
|
11
12
|
File.expand_path("test_servers/#{checksum(@application_path)}_#{VERSION}.apk")
|
12
13
|
end
|
13
14
|
|
15
|
+
# @!visibility private
|
14
16
|
def exists?
|
15
17
|
File.exists?(path)
|
16
18
|
end
|
@@ -22,6 +22,7 @@ module Calabash
|
|
22
22
|
port_forward(new_server.endpoint.port, new_server.test_server_port)
|
23
23
|
end
|
24
24
|
|
25
|
+
# @!visibility private
|
25
26
|
def self.default_serial
|
26
27
|
serials = list_serials
|
27
28
|
|
@@ -46,6 +47,7 @@ module Calabash
|
|
46
47
|
end
|
47
48
|
end
|
48
49
|
|
50
|
+
# @!visibility private
|
49
51
|
def self.list_serials
|
50
52
|
output = ADB.command('devices')
|
51
53
|
lines = output.lines
|
@@ -62,12 +64,14 @@ module Calabash
|
|
62
64
|
end
|
63
65
|
end
|
64
66
|
|
67
|
+
# @!visibility private
|
65
68
|
def installed_packages
|
66
69
|
adb.shell('pm list packages').lines.map do |line|
|
67
70
|
line.sub('package:', '').chomp
|
68
71
|
end
|
69
72
|
end
|
70
73
|
|
74
|
+
# @!visibility private
|
71
75
|
def installed_apps
|
72
76
|
adb.shell('pm list packages -f').lines.map do |line|
|
73
77
|
# line will be package:<path>=<package>
|
@@ -80,6 +84,7 @@ module Calabash
|
|
80
84
|
end
|
81
85
|
end
|
82
86
|
|
87
|
+
# @!visibility private
|
83
88
|
def test_server_responding?
|
84
89
|
begin
|
85
90
|
http_client.get(HTTP::Request.new('ping'), retries: 1).body == 'pong'
|
@@ -88,6 +93,7 @@ module Calabash
|
|
88
93
|
end
|
89
94
|
end
|
90
95
|
|
96
|
+
# @!visibility private
|
91
97
|
def test_server_ready?
|
92
98
|
begin
|
93
99
|
http_client.get(HTTP::Request.new('ready')).body == 'true'
|
@@ -96,6 +102,7 @@ module Calabash
|
|
96
102
|
end
|
97
103
|
end
|
98
104
|
|
105
|
+
# @!visibility private
|
99
106
|
def port_forward(host_port, test_server_port = nil)
|
100
107
|
if test_server_port.nil?
|
101
108
|
test_server_port = server.test_server_port
|
@@ -105,6 +112,7 @@ module Calabash
|
|
105
112
|
adb.command(*adb_forward_cmd)
|
106
113
|
end
|
107
114
|
|
115
|
+
# @!visibility private
|
108
116
|
def make_map_parameters(query, map_method_name, *method_args)
|
109
117
|
converted_args = []
|
110
118
|
|
@@ -172,6 +180,7 @@ module Calabash
|
|
172
180
|
Calabash::QueryResult.create(result['results'], query)
|
173
181
|
end
|
174
182
|
|
183
|
+
# @!visibility private
|
175
184
|
def perform_action(action, *arguments)
|
176
185
|
@logger.log "Action: #{action} - Arguments: #{arguments.join(', ')}"
|
177
186
|
|
@@ -197,10 +206,12 @@ module Calabash
|
|
197
206
|
result
|
198
207
|
end
|
199
208
|
|
209
|
+
# @!visibility private
|
200
210
|
def enter_text(text)
|
201
211
|
perform_action('keyboard_enter_text', text)
|
202
212
|
end
|
203
213
|
|
214
|
+
# @!visibility private
|
204
215
|
def md5_checksum(file_path)
|
205
216
|
result = adb.shell("#{md5_binary} '#{file_path}'")
|
206
217
|
captures = result.match(/(\w+)/).captures
|
@@ -234,15 +245,18 @@ module Calabash
|
|
234
245
|
result['result']
|
235
246
|
end
|
236
247
|
|
248
|
+
# @!visibility private
|
237
249
|
def go_home
|
238
250
|
adb.shell("input keyevent 3")
|
239
251
|
end
|
240
252
|
|
253
|
+
# @!visibility private
|
241
254
|
def set_location(location)
|
242
255
|
perform_action('set_gps_coordinates',
|
243
256
|
location[:latitude], location[:longitude])
|
244
257
|
end
|
245
258
|
|
259
|
+
# @!visibility private
|
246
260
|
def resume_app(path_or_application)
|
247
261
|
application = parse_path_or_app_parameters(path_or_application)
|
248
262
|
|
@@ -263,6 +277,7 @@ module Calabash
|
|
263
277
|
true
|
264
278
|
end
|
265
279
|
|
280
|
+
# @!visibility private
|
266
281
|
def resume_activity(package, activity)
|
267
282
|
if package_running?(package)
|
268
283
|
if info[:sdk_version] >= 11
|
@@ -279,12 +294,14 @@ module Calabash
|
|
279
294
|
end
|
280
295
|
end
|
281
296
|
|
297
|
+
# @!visibility private
|
282
298
|
def app_running?(path_or_application)
|
283
299
|
application = parse_path_or_app_parameters(path_or_application)
|
284
300
|
|
285
301
|
package_running?(application.identifier)
|
286
302
|
end
|
287
303
|
|
304
|
+
# @!visibility private
|
288
305
|
def current_focus
|
289
306
|
# Example: mFocusedApp=AppWindowToken{42c52610 token=Token{42b5d048 ActivityRecord{42a7bcc8 u0 com.example/.MainActivity t3}}}
|
290
307
|
result = adb.shell('dumpsys window windows')
|
@@ -314,6 +331,7 @@ module Calabash
|
|
314
331
|
raise "Unexpected output from `dumpsys window windows`"
|
315
332
|
end
|
316
333
|
|
334
|
+
# @!visibility private
|
317
335
|
def evaluate_javascript_in(query, javascript)
|
318
336
|
parameters =
|
319
337
|
{
|
Binary file
|
@@ -7,35 +7,43 @@ module Calabash
|
|
7
7
|
# @!visibility private
|
8
8
|
module PhysicalButtons
|
9
9
|
|
10
|
+
# @!visibility private
|
10
11
|
def press_button(key)
|
11
12
|
Device.default.perform_action('press_key', key)
|
12
13
|
true
|
13
14
|
end
|
14
15
|
|
16
|
+
# @!visibility private
|
15
17
|
def press_back_button
|
16
18
|
press_button('KEYCODE_BACK')
|
17
19
|
end
|
18
20
|
|
21
|
+
# @!visibility private
|
19
22
|
def press_menu_button
|
20
23
|
press_button('KEYCODE_MENU')
|
21
24
|
end
|
22
25
|
|
26
|
+
# @!visibility private
|
23
27
|
def press_down_button
|
24
28
|
press_button('KEYCODE_DPAD_DOWN')
|
25
29
|
end
|
26
30
|
|
31
|
+
# @!visibility private
|
27
32
|
def press_up_button
|
28
33
|
press_button('KEYCODE_DPAD_UP')
|
29
34
|
end
|
30
35
|
|
36
|
+
# @!visibility private
|
31
37
|
def press_left_button
|
32
38
|
press_button('KEYCODE_DPAD_LEFT')
|
33
39
|
end
|
34
40
|
|
41
|
+
# @!visibility private
|
35
42
|
def press_right_button
|
36
43
|
press_button('KEYCODE_DPAD_RIGHT')
|
37
44
|
end
|
38
45
|
|
46
|
+
# @!visibility private
|
39
47
|
def press_enter_button
|
40
48
|
press_button('KEYCODE_ENTER')
|
41
49
|
end
|
data/lib/calabash/cli/build.rb
CHANGED
data/lib/calabash/cli/console.rb
CHANGED
@@ -3,6 +3,7 @@ module Calabash
|
|
3
3
|
module CLI
|
4
4
|
# @!visibility private
|
5
5
|
module Console
|
6
|
+
# @!visibility private
|
6
7
|
def parse_console_arguments!
|
7
8
|
application = @arguments.shift
|
8
9
|
|
@@ -45,6 +46,7 @@ module Calabash
|
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
49
|
+
# @!visibility private
|
48
50
|
def enter_console(application_path)
|
49
51
|
irbrc_path = Environment::IRBRC
|
50
52
|
|
@@ -5,6 +5,7 @@ module Calabash
|
|
5
5
|
module CLI
|
6
6
|
# @!visibility private
|
7
7
|
module Generate
|
8
|
+
# @!visibility private
|
8
9
|
def parse_generate_arguments!
|
9
10
|
if File.exist?('features')
|
10
11
|
puts "A features directory already exists. Please remove this to continue."
|
@@ -70,10 +71,12 @@ module Calabash
|
|
70
71
|
end
|
71
72
|
end
|
72
73
|
|
74
|
+
# @!visibility private
|
73
75
|
def file(file)
|
74
76
|
File.join(Calabash::Environment::SKELETON_DIR_PATH, file)
|
75
77
|
end
|
76
78
|
|
79
|
+
# @!visibility private
|
77
80
|
def msg(title, &block)
|
78
81
|
puts "\n" + "-"*10 + title + "-"*10
|
79
82
|
block.call
|
data/lib/calabash/cli/helpers.rb
CHANGED
@@ -3,6 +3,7 @@ module Calabash
|
|
3
3
|
module CLI
|
4
4
|
# @!visibility private
|
5
5
|
module Helpers
|
6
|
+
# @!visibility private
|
6
7
|
HELP = {
|
7
8
|
help: 'help',
|
8
9
|
generate: 'generate',
|
@@ -14,6 +15,7 @@ module Calabash
|
|
14
15
|
build: 'build <apk>'
|
15
16
|
}
|
16
17
|
|
18
|
+
# @!visibility private
|
17
19
|
def key_for_command(command)
|
18
20
|
HELP.each do |key, value|
|
19
21
|
if value.split(' ').first == command
|
@@ -24,6 +26,7 @@ module Calabash
|
|
24
26
|
nil
|
25
27
|
end
|
26
28
|
|
29
|
+
# @!visibility private
|
27
30
|
def print_usage_for(key, output=STDOUT)
|
28
31
|
if key.nil? || HELP[key].nil?
|
29
32
|
output.write <<EOF
|
@@ -37,6 +40,7 @@ EOF
|
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
43
|
+
# @!visibility private
|
40
44
|
def print_usage(output=STDOUT)
|
41
45
|
output.write <<EOF
|
42
46
|
Usage: calabash [options] <command-name> [command specific options]
|
@@ -101,11 +105,13 @@ EOF
|
|
101
105
|
EOF
|
102
106
|
end
|
103
107
|
|
108
|
+
# @!visibility private
|
104
109
|
def help
|
105
110
|
file_name = File.join(File.dirname(__FILE__), '..', 'doc', 'calabash_help.txt')
|
106
111
|
system("less \"#{file_name}\"")
|
107
112
|
end
|
108
113
|
|
114
|
+
# @!visibility private
|
109
115
|
def fail(reason, command=nil)
|
110
116
|
STDERR.write("#{reason}\n")
|
111
117
|
|
data/lib/calabash/cli/resign.rb
CHANGED
data/lib/calabash/cli/run.rb
CHANGED
@@ -3,6 +3,7 @@ module Calabash
|
|
3
3
|
module CLI
|
4
4
|
# @!visibility private
|
5
5
|
module Run
|
6
|
+
# @!visibility private
|
6
7
|
def parse_run_arguments!
|
7
8
|
first_argument = @arguments.first # Do not remove the entry from the arguments yet - it might be a cucumber arg
|
8
9
|
|
@@ -54,6 +55,7 @@ module Calabash
|
|
54
55
|
end
|
55
56
|
end
|
56
57
|
|
58
|
+
# @!visibility private
|
57
59
|
def run(application_path, cucumber_arguments)
|
58
60
|
cucumber_environment = {}
|
59
61
|
cucumber_environment['CAL_DEBUG'] = Environment::DEBUG ? '1' : '0'
|
@@ -6,6 +6,7 @@ module Calabash
|
|
6
6
|
module CLI
|
7
7
|
# @!visibility private
|
8
8
|
module SetupKeystore
|
9
|
+
# @!visibility private
|
9
10
|
def parse_setup_keystore_arguments!
|
10
11
|
set_platform!(:android)
|
11
12
|
|
@@ -25,6 +26,7 @@ module Calabash
|
|
25
26
|
puts "Saved your settings to '#{Android::Build::JavaKeystore::CALABASH_KEYSTORE_SETTINGS_FILENAME}'. You can edit the settings manually or run this setup script again"
|
26
27
|
end
|
27
28
|
|
29
|
+
# @!visibility private
|
28
30
|
def prompt(message, secure = false)
|
29
31
|
puts message
|
30
32
|
|
data/lib/calabash/color.rb
CHANGED
@@ -1,30 +1,37 @@
|
|
1
1
|
module Calabash
|
2
2
|
# @!visibility private
|
3
3
|
module Color
|
4
|
+
# @!visibility private
|
4
5
|
def self.colorize(string, color)
|
5
6
|
"\e[#{color}m#{string}\e[0m"
|
6
7
|
end
|
7
8
|
|
9
|
+
# @!visibility private
|
8
10
|
def self.red(string)
|
9
11
|
colorize(string, 31)
|
10
12
|
end
|
11
13
|
|
14
|
+
# @!visibility private
|
12
15
|
def self.green(string)
|
13
16
|
colorize(string, 32)
|
14
17
|
end
|
15
18
|
|
19
|
+
# @!visibility private
|
16
20
|
def self.yellow(string)
|
17
21
|
colorize(string, 33)
|
18
22
|
end
|
19
23
|
|
24
|
+
# @!visibility private
|
20
25
|
def self.blue(string)
|
21
26
|
colorize(string, 34)
|
22
27
|
end
|
23
28
|
|
29
|
+
# @!visibility private
|
24
30
|
def self.magenta(string)
|
25
31
|
colorize(string, 35)
|
26
32
|
end
|
27
33
|
|
34
|
+
# @!visibility private
|
28
35
|
def self.cyan(string)
|
29
36
|
colorize(string, 36)
|
30
37
|
end
|
data/lib/calabash/defaults.rb
CHANGED
data/lib/calabash/device.rb
CHANGED
data/lib/calabash/environment.rb
CHANGED