xcresult 0.1.1 → 0.2.0

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
  SHA256:
3
- metadata.gz: b8b059189c741bbaf7e5f4a5c23ef524dcf57a012001a138ca975564718846d6
4
- data.tar.gz: 34c8ba16f96f43e0672289e99f910367fb06fed72f550c8aae2ffaa04bc8d78a
3
+ metadata.gz: 719d1f64f463138bc78b23e18d124c07f815af7c7b052560d426feced0fbad64
4
+ data.tar.gz: 2ac8faad5109f78cde5a7c3bdd56aea980fdb5d9bdd80b2b38568034a627ae65
5
5
  SHA512:
6
- metadata.gz: 11cdf9db657dafb8fa579cdbf3a7359abe3026cdfaf23dda45c8271e6d6678c675360b0c3cb27d30d1985890e4c23099f06ba56ed85f61a7b069115efa34c36b
7
- data.tar.gz: 9bc16d6b395414bbac5c8da3a48e82974c59222a9bfa5f4bfc12df83eaa048293a3440d451c1da9432e878f4c3f3cc0929c017eeccc8cbb3a9caa44d14ab9bcf
6
+ metadata.gz: 576989a630f4abdd1550ab25dfdfe8034df9349ebe17784061bc2468c52026509dd9d02e669225101436510127ddd27088ad56f51a2589d070e462740e775679
7
+ data.tar.gz: 1a97becb5676f1f2c08ed4ef685785d008be4055c80c01d109fe0405387dbb3ed5fc34182d8cc619432e925cc0c492b257bce70ca1c5f53ccafcf0191a4bedbe
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- xcresult (0.1.0)
4
+ xcresult (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -1,8 +1,10 @@
1
- # Xcresult
1
+ # XCResult
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/xcresult`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Twitter: @joshdholtz](https://img.shields.io/badge/contact-@joshdholtz-blue.svg?style=flat)](https://twitter.com/KrauseFx)
4
+ [![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/KrauseFx/trainer/blob/master/LICENSE)
5
+ [![Gem](https://img.shields.io/gem/v/xcresult.svg?style=flat)](http://rubygems.org/gems/trainer)
4
6
 
5
- TODO: Delete this and the text above, and describe your gem
7
+ Ruby interface for inspecting data and exporting data from Xcode 11 `.xcresult` files
6
8
 
7
9
  ## Installation
8
10
 
@@ -20,9 +22,30 @@ Or install it yourself as:
20
22
 
21
23
  $ gem install xcresult
22
24
 
25
+ ## Roadmap
26
+
27
+ - [x] Allow for easy querying of test plan summaires
28
+ - [x] Allow for easy exporting of `.xccovreport` files
29
+ - [ ] Allow for exporting of screenshots
30
+ - [ ] Add full documentation on all classes and methods
31
+ - [ ] Add more and better explain examples
32
+ - [ ] Add tests and improved code coverage
33
+
23
34
  ## Usage
24
35
 
25
- TODO: Write usage instructions here
36
+ ### Export .xccovreport files from .xcresult
37
+
38
+ ```rb
39
+ parser = XCResult::Parser.new(path: 'YourProject.xcresult')
40
+ export_xccovreport_paths = parser.export_xccovreports(destination: './outputs')
41
+ ```
42
+
43
+ ### Get test plan summaries from .xcresult
44
+
45
+ ```rb
46
+ parser = XCResult::Parser.new(path: 'YourProject.xcresult')
47
+ summaries = parser.action_test_plan_summaries
48
+ ```
26
49
 
27
50
  ## Development
28
51
 
@@ -39,11 +39,13 @@ module XCResult
39
39
  def export_xccovreports(destination: nil)
40
40
  destination ||= Dir.pwd
41
41
 
42
- coverages = actions_invocation_record.actions.map do |action|
42
+ # Collects report references
43
+ report_refs = actions_invocation_record.actions.map do |action|
43
44
  action.action_result.coverage.report_ref
44
45
  end.compact
45
- ids = coverages.map(&:id)
46
+ ids = report_refs.map(&:id)
46
47
 
48
+ # Exports all xccovreport files from the report references
47
49
  ids.each_with_index.map do |id, i|
48
50
  output_path = File.join(destination, "action_#{i}.xccovreport")
49
51
  cmd = "xcrun xcresulttool export --path #{path} --id '#{id}' --output-path #{output_path} --type file"
@@ -53,6 +55,25 @@ module XCResult
53
55
  end
54
56
  end
55
57
 
58
+ def export_xccovarchives(destination: nil)
59
+ destination ||= Dir.pwd
60
+
61
+ # Collects archive references
62
+ archive_refs = actions_invocation_record.actions.map do |action|
63
+ action.action_result.coverage.archive_ref
64
+ end.compact
65
+ ids = archive_refs.map(&:id)
66
+
67
+ # Exports all xcovarchive directories from the archive references
68
+ ids.each_with_index.map do |id, i|
69
+ output_path = File.join(destination, "action_#{i}.xccovarchive")
70
+ cmd = "xcrun xcresulttool export --path #{path} --id '#{id}' --output-path #{output_path} --type directory"
71
+ execute_cmd(cmd)
72
+
73
+ output_path
74
+ end
75
+ end
76
+
56
77
  private
57
78
 
58
79
  def get_result_bundle_json(id: nil)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module XCResult
4
- VERSION = '0.1.1'
4
+ VERSION = '0.2.0'
5
5
  end
data/xcresult.gemspec CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
18
18
  spec.files = Dir.chdir(File.expand_path(__dir__)) do
19
19
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
20
  end
21
+ spec.bindir = "exe"
22
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
23
  spec.require_paths = ['lib']
22
24
 
23
25
  spec.add_development_dependency 'bundler', '~> 2.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcresult
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Holtz
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-17 00:00:00.000000000 Z
11
+ date: 2019-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler