xamarin-test-cloud 0.9.1 → 0.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb0063f60324d962136569cbb02a120355c4a9b3
4
- data.tar.gz: c3f3a4eafe87aa4ee3a2e750cdd92144ac50b86c
3
+ metadata.gz: bcc1d67245cc734b67086c96703d069549c48dbd
4
+ data.tar.gz: 33c280e29f37595c5870117c32ff4d2870641898
5
5
  SHA512:
6
- metadata.gz: 94064d3747ab099c6f042106f6bb93ad69d4bb1bba70cdef9223be64539d48334bf1a66aac47d4457963823d09990e36e6b04df7d38c1ea4c0a4d1652d20fa7f
7
- data.tar.gz: f0c598d9d96dc52303cb2b3e52425aa3bc1cf3b794fd7f3abbf5ee9a89c022ee143da830abef93711eb3b85b27bacad34976419a9221de3bda3fa17310712e7a
6
+ metadata.gz: 4002ded8bd75b5658ddf220a76b34446bf0771f5c6b342481d3f01a99f45ddeee2eab4089bacd2ca493cef9d8f90126f022f3a613c87cf460cbdf4e16acbeb16
7
+ data.tar.gz: b27466f586ce31d407819af816551441be698111fd761a1a221b8671862c16df12d36dd7a9cd7d0275efa1fe82aaa4531ced3c8365ef2637acc97ad34b5cdd98
@@ -17,7 +17,8 @@ module XamarinTestCloud
17
17
  class CLI < Thor
18
18
  include Thor::Actions
19
19
 
20
- attr_accessor :host, :app, :api_key, :appname, :workspace, :config, :profile, :features_zip, :skip_check, :dry_run, :device_selection
20
+ attr_accessor :host, :app, :api_key, :appname, :app_explorer, :test_parameters,
21
+ :workspace, :config, :profile, :features_zip, :skip_check, :dry_run, :device_selection
21
22
  attr_accessor :pretty
22
23
  attr_accessor :endpoint_path
23
24
 
@@ -37,6 +38,7 @@ module XamarinTestCloud
37
38
 
38
39
  desc 'submit <APP> <API_KEY>', 'Submits your app and test suite to Xamarin Test Cloud'
39
40
 
41
+
40
42
  method_option :host,
41
43
  :desc => 'Test Cloud host to submit to',
42
44
  :aliases => '-h', :type => :string,
@@ -45,7 +47,7 @@ module XamarinTestCloud
45
47
  method_option 'app-name',
46
48
  :desc => 'App name to create or add test to',
47
49
  :aliases => '-a',
48
- :required => true,
50
+ :required => false,
49
51
  :type => :string
50
52
 
51
53
  method_option 'device-selection',
@@ -54,11 +56,17 @@ module XamarinTestCloud
54
56
  :required => true,
55
57
  :type => :string
56
58
 
57
- method_option :workspace,
58
- :desc => 'Workspace containing Gemfile and features',
59
- :aliases => '-w',
60
- :type => :string,
61
- :default => File.expand_path('.')
59
+ method_option 'app-explorer',
60
+ :desc => 'Explore using AppExplorer only (no Calabash)',
61
+ :aliases => '-e',
62
+ :type => :boolean,
63
+ :default => false
64
+
65
+ method_option 'test-parameters',
66
+ :desc => 'Test parameters (e.g., --params username:nat@xamarin.com password:xamarin)',
67
+ :aliases => 'params',
68
+ :type => :hash
69
+
62
70
 
63
71
  method_option :features,
64
72
  :desc => 'Zip file with features, step definitions, etc...',
@@ -86,7 +94,7 @@ module XamarinTestCloud
86
94
 
87
95
  method_option 'dry-run',
88
96
  :desc => "Sanity check only, don't upload",
89
- :aliases => '-d',
97
+ :aliases => '-s',
90
98
  :type => :boolean,
91
99
  :default => false #do upload by default
92
100
 
@@ -107,16 +115,22 @@ module XamarinTestCloud
107
115
 
108
116
  self.api_key = api_key
109
117
 
110
- self.appname = options['app-name']
118
+ self.test_parameters = options['test-parameters'] || {}
119
+
120
+ self.appname = options['app-name'] || File.basename(app, File.extname(app))
111
121
 
112
122
  self.device_selection = options['device-selection']
113
- unless File.exist?(device_selection)
114
- raise ValidationError, "Device selection is not a file: #{device_selection}"
115
- end
123
+
124
+ device_selection_data = validate_device_selection
125
+
126
+ self.app_explorer = options['app-explorer']
116
127
 
117
128
  self.skip_check = options['skip-check']
118
129
 
119
- parse_and_set_config_and_profile
130
+ unless app_explorer
131
+ parse_and_set_config_and_profile
132
+ end
133
+
120
134
 
121
135
  workspace_path = options[:workspace] || File.expand_path('.')
122
136
 
@@ -127,7 +141,7 @@ module XamarinTestCloud
127
141
 
128
142
  features_path = options[:features]
129
143
 
130
- unless features_path.nil?
144
+ unless features_path.nil? || self.app_explorer
131
145
  if File.exist?(features_path)
132
146
  self.features_zip = File.expand_path(features_path)
133
147
  else
@@ -139,6 +153,8 @@ module XamarinTestCloud
139
153
  puts "Host = #{self.host}"
140
154
  puts "App = #{self.app}"
141
155
  puts "App Name = #{self.app}"
156
+ puts "AppExplorer = #{self.app_explorer}"
157
+ puts "TestParams = #{self.test_parameters}"
142
158
  puts "API Key = #{self.api_key}"
143
159
  puts "Device Selection = #{self.device_selection}"
144
160
  puts "Workspace = #{self.workspace}"
@@ -148,8 +164,15 @@ module XamarinTestCloud
148
164
  puts "Skip Check = #{self.skip_check}"
149
165
  end
150
166
 
167
+
151
168
  #Argument parsing done
152
- json = submit_test_job[:body]
169
+
170
+ test_jon_data = submit_test_job(device_selection_data)
171
+ if self.dry_run
172
+ return
173
+ end
174
+ json = test_jon_data[:body]
175
+
153
176
  log_header("Test enqueued")
154
177
  puts "User: #{json["user_email"]}"
155
178
 
@@ -190,29 +213,38 @@ module XamarinTestCloud
190
213
  end
191
214
  end
192
215
 
216
+ def validate_device_selection
217
+ unless /^\h{8,12}$/ =~ device_selection
218
+ raise ValidationError, 'Device selection is not in the proper format. Please generate a new one on the Xamarin Test Cloud website.'
219
+ end
220
+ device_selection
221
+ end
193
222
 
194
- def submit_test_job
195
- start_at = Time.now
196
223
 
197
- server = verify_app_and_extract_test_server
198
224
 
225
+ def submit_test_job(device_selection_data)
226
+ start_at = Time.now
199
227
 
200
- log_header('Checking for Gemfile')
201
- gemfile_path = File.join(self.workspace, 'Gemfile')
202
- unless File.exist?(gemfile_path)
203
- copy_default_gemfile(gemfile_path, server)
204
- end
228
+ unless self.app_explorer
229
+ server = verify_app_and_extract_test_server
205
230
 
206
- log_header('Packaging')
207
- FileUtils.cd(self.workspace) do
208
- unless system('bundle package --all')
209
- log_and_abort 'Bundler failed. Please check command: bundle package'
231
+ log_header('Checking for Gemfile')
232
+ gemfile_path = File.join(self.workspace, 'Gemfile')
233
+ unless File.exist?(gemfile_path)
234
+ copy_default_gemfile(gemfile_path, server)
235
+ end
236
+
237
+ log_header('Packaging')
238
+ FileUtils.cd(self.workspace) do
239
+ unless system('bundle package --all')
240
+ log_and_abort 'Bundler failed. Please check command: bundle package'
241
+ end
210
242
  end
211
- end
212
243
 
213
244
 
214
- log_header('Verifying dependencies')
215
- verify_dependencies
245
+ log_header('Verifying dependencies')
246
+ verify_dependencies
247
+ end
216
248
 
217
249
 
218
250
  if dry_run
@@ -229,8 +261,10 @@ module XamarinTestCloud
229
261
  upload_data = {'files' => files,
230
262
  'paths' => paths,
231
263
  'app_file' => app_file,
232
- 'device_selection' => IO.read(device_selection),
264
+ 'device_selection' => device_selection_data,
233
265
  'app' => self.appname,
266
+ 'test_parameters' => self.test_parameters,
267
+ 'app_explorer' => self.app_explorer,
234
268
  'api_key' => api_key,
235
269
  'app_filename' => File.basename(app)}
236
270
 
@@ -262,6 +296,7 @@ module XamarinTestCloud
262
296
  if ENV['DEBUG']
263
297
  puts "Request url: #{request.url}"
264
298
  puts "Response code: #{response.code}"
299
+ puts "Response body: #{response.body}"
265
300
  end
266
301
  case response.code
267
302
  when 200..202
@@ -409,27 +444,31 @@ module XamarinTestCloud
409
444
  dir = File.join(dir, File::Separator)
410
445
  end
411
446
 
447
+ if self.app_explorer
448
+ files = []
449
+ else
450
+ files = Dir.glob(File.join("#{dir}features", '**', '*'))
412
451
 
413
- files = Dir.glob(File.join("#{dir}features", '**', '*'))
452
+ if File.directory?("#{dir}playback")
453
+ files += Dir.glob(File.join("#{dir}playback", '*'))
454
+ end
414
455
 
415
- if File.directory?("#{dir}playback")
416
- files += Dir.glob(File.join("#{dir}playback", '*'))
417
- end
456
+ if config
457
+ files << config
458
+ end
418
459
 
419
- if config
420
- files << config
421
- end
422
460
 
461
+ files += Dir.glob(File.join("#{workspace}vendor", 'cache', '*'))
423
462
 
424
- files += Dir.glob(File.join("#{workspace}vendor", 'cache', '*'))
463
+ if workspace and workspace.strip != ''
464
+ files += Dir.glob("#{workspace}Gemfile")
465
+ files += Dir.glob("#{workspace}Gemfile.lock")
466
+ end
425
467
 
426
- if workspace and workspace.strip != ''
427
- files += Dir.glob("#{workspace}Gemfile")
428
- files += Dir.glob("#{workspace}Gemfile.lock")
429
- end
468
+ if is_android?
469
+ files << test_server_path
470
+ end
430
471
 
431
- if is_android?
432
- files << test_server_path
433
472
  end
434
473
 
435
474
  {:feature_prefix => dir, :workspace_prefix => workspace, :files => files.find_all { |file_or_dir| File.file? file_or_dir }}
@@ -1,3 +1,3 @@
1
1
  module XamarinTestCloud
2
- VERSION = '0.9.1'
2
+ VERSION = '0.9.3'
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.1
4
+ version: 0.9.3
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-07-26 00:00:00.000000000 Z
12
+ date: 2013-07-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor