Ruby_AppThwack 0.0.2 → 0.0.4

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: b71be676e1f46000b889e928f63334a86931a4b6
4
- data.tar.gz: 67209b02a475f881edb3766ed9188e415a05e2e3
3
+ metadata.gz: 3b934375bc2139e16fe1f90f40f74b6e3ce34f13
4
+ data.tar.gz: b8fef144661bf07adc8862d87efc9abcc22f4e9f
5
5
  SHA512:
6
- metadata.gz: 4ba2f44d203b363d38d2da96a33b3673164aa458c2f4258488656b11bdc69f2fa91a56f56afb8ba12237539e3af5b5743c2c998480049758407684c5b69e8fa1
7
- data.tar.gz: 974e65fcf9d4e4ebc49f54cb90b849d9e396d49ae2fbc8532a7d87a53a547a227107c5db3c5c9ae5978df179c5d8925d9156edc8deee160af35b0eb462099c12
6
+ metadata.gz: 2821928c3c41364faefb55c5eef8824aad539d89b6f13e11efc2bbc40c625b120b8bce7f52ecd66f4494dcc7fad76d39e025e9737c8a4cac4c06c4a254fa4ba2
7
+ data.tar.gz: b9c9daae0c9ce609ed82ba4a9156abbb5f85afb0623bf1ca1f89c0b95cceaa27df6d3b8902d40b4d900d716ac539a328efacff803333916c34d0881d2c0d22d7
Binary file
data/bin/appthwack CHANGED
@@ -1,12 +1,12 @@
1
- #!/usr/bin/env ruby
1
+ #!/usr/bin/env ruby
2
2
 
3
3
  require 'dotenv'
4
4
  Dotenv.load
5
5
 
6
- say_error 'Must set environment variable APPTHWACK_API_KEY' if ENV['APPTHWACK_API_KEY'].nil?
7
-
8
6
  require 'commander/import'
9
7
 
8
+ say_error 'Must set environment variable APPTHWACK_API_KEY' if ENV['APPTHWACK_API_KEY'].nil?
9
+
10
10
  $:.push File.expand_path("../../lib", __FILE__)
11
11
  require 'ruby_appthwack'
12
12
 
@@ -1,6 +1,7 @@
1
1
  module AppThwack
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.4'
3
3
  end
4
4
 
5
- require 'ruby_appthwack/appthwack_api.rb'
6
- require 'ruby_appthwack/packaging.rb'
5
+ require_relative 'ruby_appthwack/reports.rb'
6
+ require_relative 'ruby_appthwack/appthwack_api.rb'
7
+ require_relative 'ruby_appthwack/packaging.rb'
@@ -12,6 +12,7 @@ command :run do |c|
12
12
  c.option '--test TEST', 'Path of the test package'
13
13
  c.option '--wait', 'Wait for the tests to complete'
14
14
  c.option '--scheme SCHEME', 'XCode scheme for packaging the IPA'
15
+ c.option '--downloadresults', 'Decide whether or not to wait and download results'
15
16
 
16
17
  c.action do |args, options|
17
18
 
@@ -66,16 +67,23 @@ command :run do |c|
66
67
 
67
68
  sleep 5
68
69
 
70
+ print "\n"
71
+
69
72
  # wait for test to terminate
70
73
  until not AppThwack::API.test_running? options.proj_id, options.run_id or not options.wait
71
74
  print "."
72
75
  sleep 30
73
76
  end
74
77
 
75
- # download the results
76
- if options.download_results
77
- zip = AppThwack::API.download_results proj_id, run_id
78
+ # download the results and we should have waited
79
+ if options.downloadresults and options.wait
80
+ zip = AppThwack::API.download_results options.proj_id, options.run_id
81
+
78
82
  say_ok "Results zip #{zip}"
83
+
84
+ dst = AppThwack::Reports.convert_reports zip, options.platform
85
+
86
+ say_ok "Converted reports to #{dst}"
79
87
  end
80
88
 
81
89
  say_ok "Tests started successfully"
@@ -0,0 +1,69 @@
1
+ require 'json'
2
+ require 'pp'
3
+
4
+ module AppThwack::Reports
5
+ class << self
6
+
7
+ def extract_reports(reports)
8
+
9
+ 'unzipped_reports' if system "rm -rf unzipped_reports && unzip -qq #{reports} -d unzipped_reports"
10
+ end
11
+
12
+ # Converts Android reports into results readable by Cucumber plugin
13
+ def convert_reports(reports, platform='android')
14
+ # default to android folder
15
+ intermediate_folders = 'calabash_tests_from_features.zip'
16
+
17
+ dst = 'cucumber-html-reports'
18
+
19
+ # unless platform is explicitly ios
20
+ if platform.eql? 'ios'
21
+ intermediate_folders = 'calabash'
22
+ end
23
+
24
+ reports = extract_reports(reports)
25
+ folders = Dir.entries(reports).select {|f| not f.eql? '.' and not f.eql? '..' }
26
+
27
+ # extract for each of the devices
28
+ folders.each do |f|
29
+
30
+ # capitalize every word
31
+ device = f.gsub('_', ' ').split.map(&:capitalize).join(' ')
32
+
33
+ # original folder name
34
+ folder_name = f
35
+
36
+ puts device
37
+
38
+ f = File.join(reports, f, intermediate_folders, 'raw_calabash_json_output.instrtxt')
39
+
40
+ features = []
41
+
42
+ # now we just add the device prefix to each feature name to make it unique
43
+ File.open(f, 'r') do |io|
44
+
45
+ features = JSON.load(io)
46
+
47
+ if not features.nil?
48
+
49
+ features.each_index do |i|
50
+ # append the device name to the feature name
51
+ features[i]['name'] = "#{features[i]['name']} on #{device}"
52
+ end
53
+ end
54
+
55
+ Dir.mkdir dst if not Dir.exists? dst
56
+
57
+ # now write out the new file
58
+ File.open(File.join(dst, "#{Time.now.to_i}_#{folder_name}.json"), 'w') do |io|
59
+ JSON.dump(features, io) unless features.nil?
60
+ end
61
+ end
62
+ end
63
+
64
+ dst
65
+ end
66
+
67
+
68
+ end
69
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Ruby_AppThwack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Stewart
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-20 00:00:00.000000000 Z
11
+ date: 2013-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -134,10 +134,11 @@ files:
134
134
  - ./lib/ruby_appthwack/commands/status.rb
135
135
  - ./lib/ruby_appthwack/commands.rb
136
136
  - ./lib/ruby_appthwack/packaging.rb
137
+ - ./lib/ruby_appthwack/reports.rb
137
138
  - ./lib/ruby_appthwack.rb
138
139
  - ./LICENSE
139
140
  - ./README.md
140
- - ./Ruby_AppThwack-0.0.1.gem
141
+ - ./Ruby_AppThwack-0.0.2.gem
141
142
  - ./ruby_appthwack.gemspec
142
143
  - bin/appthwack
143
144
  homepage: https://github.com/samstewart/ruby_appthwack
Binary file