xamarin-test-cloud 0.9.10 → 0.9.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 063dc6c1f0f6aae197be5187d21083ad0cad1326
4
- data.tar.gz: 85b2d5b0c2618dfe973ec3801e5af7b18b85f9d4
3
+ metadata.gz: ac895fdc1e30ab3e7b0654ef0e3a1cd88de1e49a
4
+ data.tar.gz: 923a14dfacafa421f4aab1b0e2f723e4a17c261d
5
5
  SHA512:
6
- metadata.gz: 51d3e40e7e1c527a3ab552236ddc1d8b4fec70a194efc91acdc35aef6b28f5ac688e24939b95e28c711418350228271b0aac374e4ba061a0295588a488d18ba6
7
- data.tar.gz: 6dcb219503ba03c14b02fd4f736e5b5e51fdbd6d215ea49549f1820420aca49e1645cdf1e69a587b6d499a64c45a486a6d9391a5a1c4496ae66c72ab9aef687d
6
+ metadata.gz: 549d55352e0184cebe5eb00d565abeddb43623cbf92adc0eef394d2e100e8a1bb071718c5ad8718f2b9bbfa5c9a5ee782e4df8c19adca7254269e95863c61b8b
7
+ data.tar.gz: 0f8b68eaae72c5a6a41c2e510edd16528e542ed4326d702b8fb41a13f2c9993303fc2a6f2359742d8aeb996a6f77e5f98b4fb450203182705a989b2a870e41da
@@ -114,6 +114,14 @@ module XamarinTestCloud
114
114
  raise ValidationError, "App is not a file: #{app_path}"
115
115
  end
116
116
 
117
+ if shared_runtime?(app_path)
118
+ puts "Xamarin Test Cloud doesn't yet support shared runtime apps."
119
+ puts "To test your app it needs to be compiled for release."
120
+ puts "You can learn how to compile you app for release here:"
121
+ puts "http://docs.xamarin.com/guides/android/deployment%2C_testing%2C_and_metrics/publishing_an_application/part_1_-_preparing_an_application_for_release"
122
+ raise ValidationError, "Aborting"
123
+ end
124
+
117
125
  app_extension = File.extname(app_path)
118
126
  unless /ipa/i.match(app_extension) || /apk/i.match(app_extension)
119
127
  raise ValidationError, "App #{app_path} must be an .ipa or .apk file"
@@ -216,8 +224,10 @@ module XamarinTestCloud
216
224
  end
217
225
 
218
226
  def wait_for_job(id)
219
- while(true)
220
- status_json = JSON.parse(http_post("status", {'id' => id, 'api_key' => api_key}))
227
+ while(true)
228
+ status_json = retriable :tries => 60, :interval => 10 do
229
+ JSON.parse(http_post("status", {'id' => id, 'api_key' => api_key}))
230
+ end
221
231
 
222
232
  log "Status: #{status_json["status_description"]}"
223
233
  if status_json["status"] == "finished"
@@ -231,10 +241,8 @@ module XamarinTestCloud
231
241
 
232
242
  if calabash_data
233
243
  puts "Total scenarios: #{calabash_data["scenarios"]["total"]}"
234
-
235
244
  puts "#{calabash_data["scenarios"]["passed"]} passed"
236
245
  puts "#{calabash_data["scenarios"]["failed"]} failed"
237
-
238
246
  puts "Total steps: #{calabash_data["steps"]["total"]}"
239
247
  end
240
248
  exit 0
@@ -267,27 +275,32 @@ module XamarinTestCloud
267
275
 
268
276
 
269
277
  def submit_test_job(device_selection_data)
278
+ tmpdir = Dir.mktmpdir
279
+ if ENV['DEBUG']
280
+ log "Packaging gems in: #{tmpdir}"
281
+ end
270
282
  start_at = Time.now
271
283
 
272
284
  unless self.app_explorer
273
285
  server = verify_app_and_extract_test_server
274
286
 
275
287
  log_header('Checking for Gemfile')
276
- gemfile_path = File.join(self.workspace, 'Gemfile')
277
- unless File.exist?(gemfile_path)
278
- copy_default_gemfile(gemfile_path, server)
288
+ if File.exist?("Gemfile")
289
+ FileUtils.cp "Gemfile", tmpdir
290
+ FileUtils.cp "Gemfile.lock", tmpdir if File.exist?("Gemfile.lock")
291
+ else
292
+ copy_default_gemfile(File.join(tmpdir, "Gemfile"), server)
279
293
  end
280
294
 
281
295
  log_header('Packaging')
296
+
282
297
  FileUtils.cd(self.workspace) do
283
- unless system('bundle package --all')
298
+ unless system("BUNDLE_GEMFILE=#{File.join(tmpdir, "Gemfile")} bundle package --all")
284
299
  log_and_abort 'Bundler failed. Please check command: bundle package'
285
300
  end
286
301
  end
287
-
288
-
289
302
  log_header('Verifying dependencies')
290
- verify_dependencies
303
+ verify_dependencies(tmpdir)
291
304
  end
292
305
 
293
306
 
@@ -297,7 +310,7 @@ module XamarinTestCloud
297
310
  return
298
311
  end
299
312
 
300
- app_file, files, paths = gather_files_and_paths_to_upload(all_files)
313
+ app_file, files, paths = gather_files_and_paths_to_upload(all_files(tmpdir), tmpdir)
301
314
 
302
315
 
303
316
  log_header('Uploading negotiated files')
@@ -361,6 +374,7 @@ module XamarinTestCloud
361
374
  end
362
375
 
363
376
  return :status => response.code, :body => JSON.parse(response)
377
+
364
378
  end
365
379
 
366
380
 
@@ -373,32 +387,25 @@ module XamarinTestCloud
373
387
  log('')
374
388
  log('Warning proceeding with default Gemfile.')
375
389
  log('It is strongly recommended that you create a custom Gemfile.')
376
- tgt = nil
377
- if is_android?
378
- log('Creating Gemfile for Android')
379
- tgt = File.join(CLI.source_root, 'GemfileAndroid')
380
- elsif is_ios?
381
- log('Creating Gemfile for iOS')
382
- gemfile = 'GemfileIOS'
383
- if server == :frank
384
- raise ValidationError, 'Frank not supported just yet'
390
+
391
+ File.open(gemfile_path, "w") do |f|
392
+ f.puts "source 'http://rubygems.org'"
393
+ if is_android?
394
+ f.puts "gem 'calabash-android', '#{calabash_android_version}'"
395
+ elsif is_ios?
396
+ f.puts "gem 'calabash-cucumber', '#{calabash_ios_version}'"
397
+ else
398
+ raise ValidationError, 'Your app must be an ipa or apk file.'
385
399
  end
386
- tgt = File.join(CLI.source_root, gemfile)
387
- else
388
- raise ValidationError, 'Your app must be an ipa or apk file.'
389
400
  end
390
401
  log("Proceeding with Gemfile: #{gemfile_path}")
391
402
 
392
-
393
- FileUtils.cp(File.expand_path(tgt), gemfile_path)
394
-
395
403
  puts(File.read(gemfile_path))
396
404
 
397
405
  log('')
398
-
399
406
  end
400
407
 
401
- def gather_files_and_paths_to_upload(collected_files)
408
+ def gather_files_and_paths_to_upload(collected_files, tmpdir)
402
409
 
403
410
  log_header('Calculating digests')
404
411
 
@@ -434,7 +441,7 @@ module XamarinTestCloud
434
441
  else
435
442
  prefix = workspace_prefix
436
443
  end
437
- paths << file.sub(prefix, '')
444
+ paths << file.sub(prefix, '').sub("#{tmpdir}/", '')
438
445
  end
439
446
 
440
447
  if config
@@ -466,12 +473,18 @@ module XamarinTestCloud
466
473
  app.end_with? '.apk'
467
474
  end
468
475
 
476
+ def is_ios?
477
+ app.end_with? '.ipa'
478
+ end
479
+
469
480
  def calabash_android_version
470
- `bundle exec calabash-android version`.strip
481
+ require 'calabash-android'
482
+ Calabash::Android::VERSION
471
483
  end
472
484
 
473
- def is_ios?
474
- app.end_with? '.ipa'
485
+ def calabash_ios_version
486
+ require 'calabash-cucumber'
487
+ Calabash::Cucumber::VERSION
475
488
  end
476
489
 
477
490
  def test_server_path
@@ -480,7 +493,7 @@ module XamarinTestCloud
480
493
  File.join('test_servers', "#{digest}_#{calabash_android_version}.apk")
481
494
  end
482
495
 
483
- def all_files
496
+ def all_files(tmpdir)
484
497
  dir = workspace
485
498
  if features_zip
486
499
  dir = Dir.mktmpdir
@@ -502,7 +515,7 @@ module XamarinTestCloud
502
515
  end
503
516
 
504
517
 
505
- files += Dir.glob(File.join("#{workspace}vendor", 'cache', '*'))
518
+ files += Dir.glob(File.join(tmpdir,"vendor", 'cache', '*'))
506
519
 
507
520
  if workspace and workspace.strip != ''
508
521
  files += Dir.glob("#{workspace}Gemfile")
@@ -570,7 +583,7 @@ module XamarinTestCloud
570
583
  res = `otool "#{File.expand_path(dir)}/Payload/#{app_dir}/#{app}" -o 2> /dev/null | grep FrankServer`
571
584
  if /FrankServer/.match(res)
572
585
  puts "ipa: #{ipa} *contains* FrankServer"
573
- result = :frank
586
+ raise ValidationError, 'Frank not supported just yet'
574
587
  else
575
588
  puts "ipa: #{ipa} *does not contain* calabash.framework"
576
589
  result = false
@@ -635,14 +648,30 @@ module XamarinTestCloud
635
648
  end
636
649
 
637
650
 
638
- def verify_dependencies
651
+ def shared_runtime?(app_path)
652
+ files(app_path).any? do |file|
653
+ file[:filename].end_with?("libmonodroid.so") && file[:size] < 120 * 1024
654
+ end
655
+ end
656
+
657
+ def files(app)
658
+ require 'zip/zipfilesystem'
659
+ Zip::ZipFile.open(app) do |zip_file|
660
+ zip_file.collect do |entry|
661
+ {filename: entry.to_s, size: entry.size }
662
+ end
663
+ end
664
+ end
665
+
666
+
667
+
668
+ def verify_dependencies(path)
639
669
  if is_android?
640
670
  abort_unless(File.exist?(test_server_path)) do
641
671
  puts 'No test server found. Please run:'
642
672
  puts " calabash-android build #{app}"
643
673
  end
644
-
645
- calabash_gem = Dir.glob('vendor/cache/calabash-android-*').first
674
+ calabash_gem = Dir.glob("#{path}/vendor/cache/calabash-android-*").first
646
675
  abort_unless(calabash_gem) do
647
676
  puts 'calabash-android was not packaged correct.'
648
677
  puts 'Please tell testcloud@xamarin.com about this bug.'
@@ -1,3 +1,3 @@
1
1
  module XamarinTestCloud
2
- VERSION = '0.9.10'
2
+ VERSION = '0.9.11'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xamarin-test-cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.10
4
+ version: 0.9.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-07 00:00:00.000000000 Z
12
+ date: 2013-08-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -87,6 +87,20 @@ dependencies:
87
87
  - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: 1.6.7
90
+ - !ruby/object:Gem::Dependency
91
+ name: retriable
92
+ requirement: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 1.3.3.1
97
+ type: :runtime
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 1.3.3.1
90
104
  description: Xamarin Test Cloud let's you automatically test your app on hundreds
91
105
  of mobile devices
92
106
  email:
@@ -98,8 +112,6 @@ extensions: []
98
112
  extra_rdoc_files: []
99
113
  files:
100
114
  - bin/test-cloud
101
- - lib/GemfileAndroid
102
- - lib/GemfileIOS
103
115
  - lib/xamarin-test-cloud/cli.rb
104
116
  - lib/xamarin-test-cloud/version.rb
105
117
  - README.md
@@ -129,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
141
  version: '0'
130
142
  requirements: []
131
143
  rubyforge_project:
132
- rubygems_version: 2.0.2
144
+ rubygems_version: 2.0.5
133
145
  signing_key:
134
146
  specification_version: 4
135
147
  summary: Command-line interface to Xamarin Test Cloud
@@ -140,4 +152,3 @@ test_files:
140
152
  - test/ipa/features/support/hooks.rb
141
153
  - test/ipa/features/support/launch.rb
142
154
  - test/test_parser.rb
143
- has_rdoc:
data/lib/GemfileAndroid DELETED
@@ -1,3 +0,0 @@
1
- source 'http://rubygems.org'
2
- gem 'calabash-android'
3
-
data/lib/GemfileIOS DELETED
@@ -1,3 +0,0 @@
1
- source 'http://rubygems.org'
2
- gem 'calabash-cucumber'
3
-