calabash-android 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/.DS_Store +0 -0
- data/bin/calabash-android +1 -1
- data/bin/calabash-android-build.rb +2 -0
- data/bin/calabash-android-generate.rb +1 -3
- data/bin/calabash-android-helpers.rb +35 -5
- data/bin/calabash-android-run.rb +3 -5
- data/bin/calabash-android-setup.rb +2 -344
- data/doc/calabash-android-help.txt +1 -2
- data/lib/calabash-android/version.rb +2 -2
- metadata +3 -2
data/bin/.DS_Store
ADDED
Binary file
|
data/bin/calabash-android
CHANGED
@@ -17,10 +17,8 @@ def calabash_scaffold
|
|
17
17
|
FileUtils.mv "#{@features_dir}/irb_android.sh", "."
|
18
18
|
|
19
19
|
msg("Info") do
|
20
|
-
#TODO Jonas
|
21
20
|
puts "features subdirectory created. \n"
|
22
|
-
puts "Try executing \n\
|
23
|
-
puts "\n (replace ios5 with ios4 if running iOS 4.x simulator.\nReplace iphone with ipad if running iPad simulator.).\n"
|
21
|
+
puts "Try executing \n\ncalabash-android run"
|
24
22
|
end
|
25
23
|
|
26
24
|
end
|
@@ -9,7 +9,6 @@ def msg(title, &block)
|
|
9
9
|
puts "-"*10 + "-------" + "-"*10 + "\n"
|
10
10
|
end
|
11
11
|
|
12
|
-
#TODO Jonas
|
13
12
|
def print_usage
|
14
13
|
puts <<EOF
|
15
14
|
Usage: calabash-android <command-name> [parameters]
|
@@ -18,10 +17,13 @@ def print_usage
|
|
18
17
|
prints more detailed help information.
|
19
18
|
gen
|
20
19
|
generate a features folder structure.
|
21
|
-
setup
|
22
|
-
|
23
|
-
|
24
|
-
|
20
|
+
setup will ask you some questions about you application, development
|
21
|
+
environment and key store to user for signing.
|
22
|
+
|
23
|
+
build builds the test server that will be used when testing the app.
|
24
|
+
You need to run this command everytime you make changes to app.
|
25
|
+
|
26
|
+
run runs Cucumber in the current folder with the enviroment needed.
|
25
27
|
EOF
|
26
28
|
end
|
27
29
|
|
@@ -66,6 +68,34 @@ def calabash_submit(args)
|
|
66
68
|
else
|
67
69
|
puts result
|
68
70
|
end
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
def run_build_if_test_server_does_not_exist
|
75
|
+
unless File.exists?(File.join(@support_dir, "Test.apk"))
|
76
|
+
puts "Could not find the test server"
|
77
|
+
puts "Should I run calabash-android build for you?"
|
78
|
+
puts "Please answer yes (y) or no (n)"
|
79
|
+
if ['yes', 'y'].include? STDIN.gets.chomp
|
80
|
+
calabash_build([])
|
81
|
+
else
|
82
|
+
puts "Please run: calabash-android build"
|
83
|
+
exit 1
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
69
87
|
|
88
|
+
def run_setup_if_settings_does_not_exist
|
89
|
+
unless File.exists?(".calabash_settings")
|
90
|
+
puts "Could not find .calabash_settings."
|
91
|
+
puts "Should I run calabash-android setup for you?"
|
92
|
+
puts "Please answer yes (y) or no (n)"
|
93
|
+
if ['yes', 'y'].include? STDIN.gets.chomp
|
94
|
+
calabash_setup
|
95
|
+
else
|
96
|
+
puts "Please run: calabash-android setup"
|
97
|
+
exit 1
|
98
|
+
end
|
99
|
+
end
|
70
100
|
end
|
71
101
|
|
data/bin/calabash-android-run.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
def calabash_run(args)
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
exit 1
|
6
|
-
end
|
2
|
+
run_build_if_test_server_does_not_exist
|
3
|
+
|
4
|
+
|
7
5
|
settings = JSON.parse(IO.read(".calabash_settings"))
|
8
6
|
|
9
7
|
env ={"PACKAGE_NAME" => settings["package_name"],
|
@@ -1,30 +1,6 @@
|
|
1
1
|
require "calabash-android/version"
|
2
2
|
|
3
|
-
|
4
|
-
#require 'rexml/rexml'
|
5
|
-
#require "rexml/document"
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#def detect_accessibility_support
|
9
|
-
# dirs = Dir.glob(File.join(File.expand_path("~/Library"),"Application Support","iPhone Simulator","*.*","Library","Preferences"))
|
10
|
-
# dirs.each do |sim_pref_dir|
|
11
|
-
# fp = File.expand_path("#{sim_pref_dir}/com.apple.Accessibility.plist")
|
12
|
-
# out = `defaults read "#{fp}" ApplicationAccessibilityEnabled`
|
13
|
-
#
|
14
|
-
# if not(File.exists?(fp)) || out.split("\n")[0] == "0"
|
15
|
-
# msg("Warn") do
|
16
|
-
# puts "Accessibility is not enabled for simulator: #{sim_pref_dir}"
|
17
|
-
# puts "Enabled accessibility as described here:"
|
18
|
-
# puts "https://github.com/calabash/calabash-android/wiki/01-Getting-started-guide"
|
19
|
-
# puts "Alternatively run command:"
|
20
|
-
# puts "calabash-android sim acc"
|
21
|
-
# end
|
22
|
-
# end
|
23
|
-
#
|
24
|
-
# end
|
25
|
-
#end
|
26
|
-
#
|
27
|
-
def calabash_setup(args)
|
3
|
+
def calabash_setup
|
28
4
|
unless File.exists?(ENV["ANDROID_HOME"] || "")
|
29
5
|
puts "Please set ANDROID_HOME to point to the Android SDK"
|
30
6
|
exit 1
|
@@ -62,51 +38,6 @@ def calabash_setup(args)
|
|
62
38
|
f.puts @settings.to_json
|
63
39
|
end
|
64
40
|
puts "Saved your settings to .calabash_settings. You can edit the settings manually or run this setup script again"
|
65
|
-
|
66
|
-
#TODO Jonas
|
67
|
-
# puts "Checking if Xcode is running..."
|
68
|
-
# res = `ps x -o pid,command | grep -v grep | grep Xcode.app/Contents/MacOS/Xcode`
|
69
|
-
# if res==""
|
70
|
-
# puts "Xcode not running."
|
71
|
-
# project_name, project_path, xpath = find_project_files(args)
|
72
|
-
# setup_project(project_name, project_path, xpath)
|
73
|
-
#
|
74
|
-
# detect_accessibility_support
|
75
|
-
#
|
76
|
-
# msg("Setup done") do
|
77
|
-
#
|
78
|
-
# puts "Please validate by running the -cal target"
|
79
|
-
# puts "from Xcode."
|
80
|
-
# puts "When starting the iOS Simulator using the"
|
81
|
-
# puts "new -cal target, you should see:\n\n"
|
82
|
-
# puts ' "Started LPHTTP server on port 37265"'
|
83
|
-
# puts "\nin the application log in Xcode."
|
84
|
-
# puts "\n\n"
|
85
|
-
# puts "After validating, you can generate a features folder:"
|
86
|
-
# puts "Go to your project (the dir containing the .xcodeproj file)."
|
87
|
-
# puts "Then run calabash-android gen"
|
88
|
-
# puts "(if you don't already have a features folder)."
|
89
|
-
# end
|
90
|
-
#
|
91
|
-
# else
|
92
|
-
# puts "Xcode is running. We'll be changing the project file so we'd better stop it."
|
93
|
-
# puts "Shall I stop Xcode? Please answer yes (y) or no (n)"
|
94
|
-
# answer = STDIN.gets.chomp
|
95
|
-
# if (answer == 'yes' or answer == 'y')
|
96
|
-
# res.split("\n").each do |line|
|
97
|
-
# pid = line.split(" ")[0]
|
98
|
-
# if system("kill #{pid}")
|
99
|
-
# puts "Stopped XCode. Retrying... "
|
100
|
-
# calabash_setup(args)
|
101
|
-
# else
|
102
|
-
# puts "Killing Xcode seemed to fail :( Aborting..."
|
103
|
-
# end
|
104
|
-
# end
|
105
|
-
# else
|
106
|
-
# puts "Please stop Xcode and try again."
|
107
|
-
# exit(0)
|
108
|
-
# end
|
109
|
-
# end
|
110
41
|
end
|
111
42
|
|
112
43
|
def ask_for_setting(key, msg)
|
@@ -116,277 +47,4 @@ end
|
|
116
47
|
|
117
48
|
def platform_versions
|
118
49
|
Dir["#{ENV["ANDROID_HOME"]}/platforms/android-*"].collect{|platform| platform.split("-").last.to_i}.sort
|
119
|
-
end
|
120
|
-
|
121
|
-
|
122
|
-
#
|
123
|
-
#def find_project_files(args)
|
124
|
-
# dir_to_search, project_files = ensure_correct_path(args)
|
125
|
-
#
|
126
|
-
# xc_project_file = project_files[0]
|
127
|
-
# project_name = xc_project_file.split(".xcodeproj")[0]
|
128
|
-
# puts "Found Project: #{project_name}"
|
129
|
-
# pbx_dir = "#{dir_to_search}/#{xc_project_file}"
|
130
|
-
# pbx_files = Dir.foreach(pbx_dir).find_all { |x| /\.pbxproj$/.match(x) }
|
131
|
-
# if pbx_files.empty?
|
132
|
-
# puts "Found no *.pbxproj files in dir #{xc_project_file}."
|
133
|
-
# puts "Please setup calabash manually."
|
134
|
-
# exit 1
|
135
|
-
# elsif pbx_files.count > 1
|
136
|
-
# puts "Found several *.pbxproj files in dir #{xc_project_file}."
|
137
|
-
# puts "Found: #{pbx_files.join("\n")}"
|
138
|
-
# puts "We don't yet support this. Please setup calabash manually."
|
139
|
-
# exit 1
|
140
|
-
# end
|
141
|
-
#
|
142
|
-
# return project_name, dir_to_search, File.expand_path("#{dir_to_search}/#{xc_project_file}")
|
143
|
-
#end
|
144
|
-
#
|
145
|
-
#def calabash_download(args)
|
146
|
-
# download_calabash(File.expand_path("."))
|
147
|
-
#end
|
148
|
-
#
|
149
|
-
#def has_proxy?
|
150
|
-
# ENV['http_proxy'] ? true : false
|
151
|
-
#end
|
152
|
-
#
|
153
|
-
#def proxy
|
154
|
-
# url_parts = URI.split(ENV['http_proxy'])
|
155
|
-
# [url_parts[2], url_parts[3]]
|
156
|
-
#end
|
157
|
-
#
|
158
|
-
#def download_calabash(project_path)
|
159
|
-
# file = 'calabash.framework'
|
160
|
-
# ##Download calabash.framework
|
161
|
-
# if not File.directory?(File.join(project_path, file))
|
162
|
-
# msg("Info") do
|
163
|
-
# zip_file = "calabash.framework-#{ENV['FRAMEWORK_VERSION']||Calabash::Android::FRAMEWORK_VERSION}.zip"
|
164
|
-
# puts "Did not find calabash.framework. I'll download it...'"
|
165
|
-
# puts "http://cloud.github.com/downloads/calabash/calabash-android/#{zip_file}"
|
166
|
-
# require 'uri'
|
167
|
-
#
|
168
|
-
# uri = URI.parse "http://cloud.github.com/downloads/calabash/calabash-android/#{zip_file}"
|
169
|
-
# success = false
|
170
|
-
# if has_proxy?
|
171
|
-
# proxy_url = proxy
|
172
|
-
# connection = Net::HTTP::Proxy(proxy_url[0], proxy_url[1])
|
173
|
-
# else
|
174
|
-
# connection = Net::HTTP
|
175
|
-
# end
|
176
|
-
# connection.start(uri.host, uri.port) do |http|
|
177
|
-
# request = Net::HTTP::Get.new uri.request_uri
|
178
|
-
#
|
179
|
-
# http.request request do |response|
|
180
|
-
# if response.code == '200'
|
181
|
-
# open zip_file, 'wb' do |io|
|
182
|
-
# response.read_body do |chunk|
|
183
|
-
# print "."
|
184
|
-
# io.write chunk
|
185
|
-
# end
|
186
|
-
# end
|
187
|
-
# success = true
|
188
|
-
# else
|
189
|
-
# puts "Got bad response code #{response.code}."
|
190
|
-
# puts "Aborting..."
|
191
|
-
# end
|
192
|
-
# end
|
193
|
-
# end
|
194
|
-
# if success
|
195
|
-
# puts "\nDownload done: #{file}. Unzipping..."
|
196
|
-
# if not system("unzip -C -K -o -q -d #{project_path} #{zip_file}")
|
197
|
-
# msg("Error") do
|
198
|
-
# puts "Unable to unzip file: #{zip_file}"
|
199
|
-
# puts "You must install manually."
|
200
|
-
# end
|
201
|
-
# exit 1
|
202
|
-
# end
|
203
|
-
# FileUtils.rm(zip_file)
|
204
|
-
# else
|
205
|
-
# exit 0
|
206
|
-
# end
|
207
|
-
# end
|
208
|
-
# else
|
209
|
-
# msg("Info") do
|
210
|
-
# puts "Found calabash.framework in #{File.expand_path(project_path)}."
|
211
|
-
# puts "Shall I delete it and download the latest matching version?"
|
212
|
-
# puts "Please answer yes (y) or no (n)"
|
213
|
-
# answer = STDIN.gets.chomp
|
214
|
-
# if (answer == 'yes' or answer == 'y')
|
215
|
-
# FileUtils.rm_r File.join(project_path, file)
|
216
|
-
# return download_calabash(project_path)
|
217
|
-
# else
|
218
|
-
# puts "Not downloading..."
|
219
|
-
# end
|
220
|
-
# end
|
221
|
-
# end
|
222
|
-
# file
|
223
|
-
#end
|
224
|
-
#
|
225
|
-
#def setup_project(project_name, project_path, path)
|
226
|
-
# ##Ensure exists and parse
|
227
|
-
# proj_file = "#{path}/project.pbxproj"
|
228
|
-
# if not File.exists?(proj_file)
|
229
|
-
# msg("Error") do
|
230
|
-
# puts "Directory #{path} doesn't contain #{proj_file}"
|
231
|
-
# end
|
232
|
-
# exit 1
|
233
|
-
# end
|
234
|
-
#
|
235
|
-
# pwd = FileUtils.pwd
|
236
|
-
# FileUtils.cd project_path
|
237
|
-
# ##Backup
|
238
|
-
# if File.exists? "#{proj_file}.bak"
|
239
|
-
# msg("Error") do
|
240
|
-
# puts "Backup file already exists. #{proj_file}.bak"
|
241
|
-
# puts "For safety, I won't overwrite this file."
|
242
|
-
# puts "You must manually move this file, if you want to"
|
243
|
-
# puts "Run calabash-android setup again."
|
244
|
-
# end
|
245
|
-
# exit 1
|
246
|
-
# end
|
247
|
-
#
|
248
|
-
# file = download_calabash(project_path)
|
249
|
-
#
|
250
|
-
# msg("Info") do
|
251
|
-
# puts "Setting up project file for calabash-android."
|
252
|
-
# end
|
253
|
-
#
|
254
|
-
#
|
255
|
-
# FileUtils.cd pwd
|
256
|
-
#
|
257
|
-
# ##Backup
|
258
|
-
# msg("Info") do
|
259
|
-
# puts "Making backup of project file: #{proj_file}"
|
260
|
-
# FileUtils.cp(proj_file, "#{proj_file}.bak")
|
261
|
-
# puts "Saved as #{proj_file}.bak"
|
262
|
-
# end
|
263
|
-
#
|
264
|
-
# path_to_setup = File.join(File.dirname(__FILE__), 'CalabashSetup')
|
265
|
-
# setup_cmd = %Q[#{path_to_setup} "#{path}" "#{project_name}"]
|
266
|
-
# system(setup_cmd)
|
267
|
-
#
|
268
|
-
#end
|
269
|
-
#
|
270
|
-
#
|
271
|
-
#
|
272
|
-
#require 'calabash-android/launch/simulator_helper'
|
273
|
-
#def validate_setup(args)
|
274
|
-
# if args.length > 0
|
275
|
-
# if args[0].end_with?(".ipa")
|
276
|
-
# validate_ipa(args[0])
|
277
|
-
# elsif args[0].end_with?(".app")
|
278
|
-
# validate_app(args[0])
|
279
|
-
# else
|
280
|
-
# msg("Error") do
|
281
|
-
# puts "File should end with .app or .ipa"
|
282
|
-
# end
|
283
|
-
# exit 1
|
284
|
-
# end
|
285
|
-
# else
|
286
|
-
# dd_dir = Calabash::Android::SimulatorHelper.derived_data_dir_for_project
|
287
|
-
# if not dd_dir
|
288
|
-
# puts "Unable to find iOS project."
|
289
|
-
# puts "You should run this command from an iOS project directory."
|
290
|
-
# exit 1
|
291
|
-
# end
|
292
|
-
# app_bundles = Dir.glob(File.join(dd_dir, "Build", "Products", "*", "*.app"))
|
293
|
-
# sim_dirs = Dir.glob(File.join(dd_dir, "Build", "Products", "Debug-iphonesimulator", "*.app"))
|
294
|
-
# sim_dirs = sim_dirs.concat(Dir.glob(File.join(dd_dir, "Build", "Products", "Calabash-iphonesimulator", "*.app")))
|
295
|
-
# if sim_dirs.empty?
|
296
|
-
# msg = ["Have you built your app for simulator?"]
|
297
|
-
# msg << "You should build the -cal target and your normal target"
|
298
|
-
# msg << "(with configuration Debug)."
|
299
|
-
# msg << "Searched dir: #{dd_dir}/Build/Products"
|
300
|
-
# msg("Error") do
|
301
|
-
# puts msg.join("\n")
|
302
|
-
# end
|
303
|
-
# exit 1
|
304
|
-
# elsif sim_dirs.count != 2
|
305
|
-
# msg = ["Have you built your app for simulator?"]
|
306
|
-
# msg << "You should build the -cal target and your normal target"
|
307
|
-
# msg << "(with configuration Debug)."
|
308
|
-
# msg << "Searched dir: #{dd_dir}/Build/Products"
|
309
|
-
# msg("Error") do
|
310
|
-
# puts msg.join("\n")
|
311
|
-
# end
|
312
|
-
# exit 1
|
313
|
-
# end
|
314
|
-
# out_debug = `otool "#{sim_dirs[0]}"/* -o 2> /dev/null | grep CalabashServer`
|
315
|
-
# out_cal = `otool "#{sim_dirs[1]}"/* -o 2> /dev/null | grep CalabashServer 2> /dev/null`
|
316
|
-
# ok = (not /CalabashServer/.match(out_debug)) and /CalabashServer/.match(out_cal)
|
317
|
-
# if ok
|
318
|
-
# msg("OK") do
|
319
|
-
# puts "Your configuration seems ok."
|
320
|
-
# puts "app in directory:"
|
321
|
-
# puts sim_dirs[0]
|
322
|
-
# puts "does not have calabash.framework linked in."
|
323
|
-
# puts "directory:"
|
324
|
-
# puts sim_dirs[1]
|
325
|
-
# puts "does."
|
326
|
-
# end
|
327
|
-
# else
|
328
|
-
# msg("Fail") do
|
329
|
-
# puts "Your configuration looks bad."
|
330
|
-
# if (not /CalabashServer/.match(out_debug))
|
331
|
-
# puts "WARNING: You Debug build seems to be linking with Calabash."
|
332
|
-
# puts "You should restore your xcodeproject file from backup."
|
333
|
-
# else
|
334
|
-
# puts "app in directory"
|
335
|
-
# puts sim_dirs[1]
|
336
|
-
# puts "does not have calabash.framework linked in."
|
337
|
-
# end
|
338
|
-
# end
|
339
|
-
# end
|
340
|
-
# end
|
341
|
-
#
|
342
|
-
#
|
343
|
-
#end
|
344
|
-
#
|
345
|
-
#def validate_ipa(ipa)
|
346
|
-
# require 'tmpdir'
|
347
|
-
# fail = false
|
348
|
-
# Dir.mktmpdir do |dir|
|
349
|
-
# if not system("unzip -C -K -o -q -d #{dir} #{ipa}")
|
350
|
-
# msg("Error") do
|
351
|
-
# puts "Unable to unzip ipa: #{ipa}"
|
352
|
-
# end
|
353
|
-
# Dir
|
354
|
-
# fail = true
|
355
|
-
# end
|
356
|
-
#
|
357
|
-
# app_dir = Dir.foreach("#{dir}/Payload").find {|d| /\.app$/.match(d)}
|
358
|
-
# app = app_dir.split(".")[0]
|
359
|
-
# res = `otool "#{File.expand_path(dir)}/Payload/#{app_dir}/#{app}" -o 2> /dev/null | grep CalabashServer`
|
360
|
-
# msg("Info") do
|
361
|
-
# if /CalabashServer/.match(res)
|
362
|
-
# puts "Ipa: #{ipa} *contains* calabash.framework"
|
363
|
-
# else
|
364
|
-
# puts "Ipa: #{ipa} *does not contain* calabash.framework"
|
365
|
-
# end
|
366
|
-
# end
|
367
|
-
#
|
368
|
-
# end
|
369
|
-
# if fail
|
370
|
-
# exit(1)
|
371
|
-
# end
|
372
|
-
#
|
373
|
-
#end
|
374
|
-
#
|
375
|
-
#def validate_app(app)
|
376
|
-
# if not File.directory?app
|
377
|
-
# msg("Error") do
|
378
|
-
# puts "Path: #{app} is not a directory."
|
379
|
-
# end
|
380
|
-
# exit 1
|
381
|
-
# end
|
382
|
-
# out = `otool "#{File.expand_path(app)}"/* -o 2> /dev/null | grep CalabashServer`
|
383
|
-
#
|
384
|
-
# msg("Info") do
|
385
|
-
# if /CalabashServer/.match(out)
|
386
|
-
# puts "App: #{app} *contains* calabash.framework"
|
387
|
-
# else
|
388
|
-
# puts "App: #{app} *does not contain* calabash.framework"
|
389
|
-
# end
|
390
|
-
# end
|
391
|
-
#
|
392
|
-
#end
|
50
|
+
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
#TODO Jonas
|
2
1
|
Usage: calabash-android <command-name> [parameters]
|
3
2
|
<command-name> can be one of
|
4
3
|
help
|
@@ -18,4 +17,4 @@ Usage: calabash-android <command-name> [parameters]
|
|
18
17
|
build builds the test server that will be used when testing the app.
|
19
18
|
You need to run this command everytime you make changes to app.
|
20
19
|
|
21
|
-
run runs
|
20
|
+
run runs Cucumber in the current folder with the enviroment needed.
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: calabash-android
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jonas Maturana Larsen
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-04-
|
13
|
+
date: 2012-04-30 00:00:00 -03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- Gemfile
|
62
62
|
- LICENSE
|
63
63
|
- Rakefile
|
64
|
+
- bin/.DS_Store
|
64
65
|
- bin/calabash-android
|
65
66
|
- bin/calabash-android-build.rb
|
66
67
|
- bin/calabash-android-generate.rb
|