xcov 0.2 → 0.3

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: 9b893029cc3b696de5790c5f14b29bee1c9c4442
4
- data.tar.gz: 13712b22f14c1460d21ba80c873a635cdd746cf2
3
+ metadata.gz: 4f3c93472805e77a126f13edef348e6862457049
4
+ data.tar.gz: ba57207729613ff18a08d20af97c47e2cbbe920b
5
5
  SHA512:
6
- metadata.gz: ba729410cedf50a75000e4a42010dea49d338327232ddc2db663ea1a927d4479807533f87330562b1077fa94c0b79ff4c2901b23463975a577f0cf93f61107dd
7
- data.tar.gz: d2dc61db9a3cf662f3ef8f544df36b809f0192ec5dfafd652bd357d75213618aa6d3b08709a5efe8e9d06d2bcc6de404313466f1ca44edd78355fe4fb0fdc079
6
+ metadata.gz: beb17cd46cdd0a5eb086bebd392fe4cfba64dfac72ff13f8cd8db5d1675b38d72c58be60434f943682f5f41a0fa25d56353e53cfca37959fa0edc2e64bdb2f04
7
+ data.tar.gz: 088c9a5e60bbe3e32f969350a215df7c90b3e14c0ef316344a79d421a7cf8de063a5135a95d67f951aa7bd3c5fbcf5d043f50df1b790028a3f8627b8a55dc9ee
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  ![/assets_readme/gather_coverage.png](/assets_readme/logo.png)
2
2
  -------
3
- [![Twitter: @FastlaneTools](https://img.shields.io/badge/contact-@carlostify-blue.svg?style=flat)](https://twitter.com/carlostify)
3
+ [![Twitter: @carlostify](https://img.shields.io/badge/contact-@carlostify-blue.svg?style=flat)](https://twitter.com/carlostify)
4
4
  [![License](https://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/nakiostudio/xcov/blob/master/LICENSE)
5
5
  [![Gem](https://img.shields.io/gem/v/xcov.svg?style=flat)](http://rubygems.org/gems/xcov)
6
+ [![Gem Downloads](https://img.shields.io/gem/dt/xcov.svg?style=flat)](http://rubygems.org/gems/xcov)
6
7
 
7
8
  **xCov** is a friendly visualizer for Xcode's code coverage files.
8
9
 
@@ -31,7 +32,7 @@ In order to make *xCov* run you must:
31
32
  ![/assets_readme/gather_coverage.png](/assets_readme/gather_coverage.png)
32
33
 
33
34
  ## Usage
34
- *xCov* analyzes the `.xccoverage` files created after running your tests therefore, prior to execute xCov, you need to run your tests with either `Xcode`, `xcodebuild` or [scan](https://github.com/fastlane/scan). Once completed, obtain your coverage report by providing a few parameters:
35
+ *xCov* analyzes the `.xccoverage` files created after running your tests therefore, before executing xCov, you need to run your tests with either `Xcode`, `xcodebuild` or [scan](https://github.com/fastlane/scan). Once completed, obtain your coverage report by providing a few parameters:
35
36
  ```
36
37
  xcov -w LystSDK.xcworkspace -s LystSDK -o xcov_output
37
38
  ```
@@ -42,6 +43,7 @@ xcov -w LystSDK.xcworkspace -s LystSDK -o xcov_output
42
43
  * `scheme` `-s`: Scheme of the project to analyze.
43
44
  * `output_directory` `-o`: Path for the output folder where the report files will be saved.
44
45
  * `derived_data_path` `-j`: Path of your project `Derived Data` folder (optional).
46
+ * `minimum_coverage_percentage` `-m`: Raise exception if overall coverage percentage is under this value (ie. 75)
45
47
  * `slack_url` `-i`: Incoming WebHook for your Slack group to post results (optional).
46
48
  * `slack_channel` `-e`: Slack channel where the results will be posted (optional).
47
49
  * `skip_slack`: Add this flag to avoid publishing results on Slack (optional).
@@ -56,5 +58,19 @@ xcov(
56
58
  )
57
59
  ```
58
60
 
59
- # License
61
+ ## Changelog
62
+
63
+ ### v.0.3
64
+ * Raised exception when the minimum coverage threshold is not reached (by **opfeffer**)
65
+
66
+ ### v.0.2
67
+ * Fixed bug expanding/collapsing rows with same filename
68
+ * Added Fastlane integration to README
69
+
70
+ ## Contributors
71
+
72
+ * [nakiostudio](https://github.com/nakiostudio)
73
+ * [opfeffer](https://github.com/opfeffer)
74
+
75
+ ## License
60
76
  This project is licensed under the terms of the MIT license. See the LICENSE file.
@@ -45,6 +45,12 @@ module Xcov
45
45
  env_name: "XCOV_OUTPUT_DIRECTORY",
46
46
  description: "The directory in which all reports will be stored",
47
47
  default_value: File.join(containing, "xcov_report")),
48
+ FastlaneCore::ConfigItem.new(key: :minimum_coverage_percentage,
49
+ short_option: "-m",
50
+ env_name: "XCOV_MINIMUM_COVERAGE_PERCENTAGE",
51
+ description: "Raise exception if overall coverage percentage is under this value (ie. 75)",
52
+ type: Float,
53
+ default_value: 0),
48
54
  FastlaneCore::ConfigItem.new(key: :slack_url,
49
55
  short_option: "-i",
50
56
  env_name: "SLACK_URL",
@@ -11,7 +11,8 @@ module Xcov
11
11
 
12
12
  def run
13
13
  report_json = parse_xccoverage
14
- generate_xcov_report(report_json)
14
+ report = generate_xcov_report(report_json)
15
+ validate_report(report)
15
16
  end
16
17
 
17
18
  def parse_xccoverage
@@ -73,6 +74,22 @@ module Xcov
73
74
 
74
75
  # Raise exception in case of failure
75
76
  raise "Unable to create coverage report" if report.nil?
77
+
78
+ report
79
+ end
80
+
81
+ def validate_report report
82
+ exit_status = 0
83
+
84
+ # Raise exception if overall coverage
85
+ minimumPercentage = Xcov.config[:minimum_coverage_percentage] / 100
86
+ if minimumPercentage > report.coverage
87
+ exit_status = 1
88
+
89
+ UI.user_error!("Actual Code Coverage (#{"%.2f%" % (report.coverage*100)}) below threshold of #{"%.2f%" % (minimumPercentage*100)}")
90
+ end
91
+
92
+ exit_status
76
93
  end
77
94
 
78
95
  end
@@ -1,6 +1,6 @@
1
1
  module Xcov
2
2
 
3
- VERSION = "0.2"
3
+ VERSION = "0.3"
4
4
  DESCRIPTION = "xCov is a friendly visualizer for Xcode's code coverage files"
5
5
 
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xcov
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: '0.3'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carlos Vidal
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-20 00:00:00.000000000 Z
11
+ date: 2016-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastlane_core