ashtonw-slather 1.8.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +7 -0
  2. data/.coveralls.yml +1 -0
  3. data/.gitignore +45 -0
  4. data/.travis.yml +19 -0
  5. data/CHANGELOG.md +132 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +22 -0
  8. data/README.md +206 -0
  9. data/Rakefile +1 -0
  10. data/assets/highlight.pack.js +1 -0
  11. data/assets/list.min.js +1 -0
  12. data/assets/slather.css +316 -0
  13. data/bin/slather +117 -0
  14. data/docs/logo.jpg +0 -0
  15. data/lib/cocoapods_plugin.rb +10 -0
  16. data/lib/slather.rb +20 -0
  17. data/lib/slather/coverage_file.rb +195 -0
  18. data/lib/slather/coverage_service/cobertura_xml_output.rb +183 -0
  19. data/lib/slather/coverage_service/coveralls.rb +186 -0
  20. data/lib/slather/coverage_service/gutter_json_output.rb +50 -0
  21. data/lib/slather/coverage_service/hardcover.rb +61 -0
  22. data/lib/slather/coverage_service/html_output.rb +244 -0
  23. data/lib/slather/coverage_service/simple_output.rb +31 -0
  24. data/lib/slather/coveralls_coverage_file.rb +13 -0
  25. data/lib/slather/project.rb +132 -0
  26. data/lib/slather/version.rb +3 -0
  27. data/slather.gemspec +32 -0
  28. data/spec/fixtures/fixtures.xcodeproj/project.pbxproj +496 -0
  29. data/spec/fixtures/fixtures.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  30. data/spec/fixtures/fixtures.xcodeproj/xcshareddata/xcschemes/fixtures.xcscheme +69 -0
  31. data/spec/fixtures/fixtures/Supporting Files/fixtures-Prefix.pch +9 -0
  32. data/spec/fixtures/fixtures/fixtures.h +16 -0
  33. data/spec/fixtures/fixtures/fixtures.m +23 -0
  34. data/spec/fixtures/fixtures/fixtures_cpp.cpp +9 -0
  35. data/spec/fixtures/fixtures/fixtures_cpp.h +6 -0
  36. data/spec/fixtures/fixtures/fixtures_m.h +5 -0
  37. data/spec/fixtures/fixtures/fixtures_m.m +5 -0
  38. data/spec/fixtures/fixtures/fixtures_mm.h +5 -0
  39. data/spec/fixtures/fixtures/fixtures_mm.mm +5 -0
  40. data/spec/fixtures/fixtures/more_files/Branches.h +15 -0
  41. data/spec/fixtures/fixtures/more_files/Branches.m +45 -0
  42. data/spec/fixtures/fixtures/more_files/Empty.h +13 -0
  43. data/spec/fixtures/fixtures/more_files/Empty.m +13 -0
  44. data/spec/fixtures/fixtures/more_files/peekaview.h +13 -0
  45. data/spec/fixtures/fixtures/more_files/peekaview.m +31 -0
  46. data/spec/fixtures/fixturesTests/BranchesTests.m +38 -0
  47. data/spec/fixtures/fixturesTests/Supporting Files/en.lproj/InfoPlist.strings +2 -0
  48. data/spec/fixtures/fixturesTests/Supporting Files/fixturesTests-Info.plist +22 -0
  49. data/spec/fixtures/fixturesTests/fixturesTests.m +36 -0
  50. data/spec/fixtures/fixturesTests/peekaviewTests.m +34 -0
  51. data/spec/fixtures/fixtures_html/Branches.m.html +261 -0
  52. data/spec/fixtures/fixtures_html/BranchesTests.m.html +228 -0
  53. data/spec/fixtures/fixtures_html/Empty.m.html +30 -0
  54. data/spec/fixtures/fixtures_html/fixtures.m.html +151 -0
  55. data/spec/fixtures/fixtures_html/fixturesTests.m.html +216 -0
  56. data/spec/fixtures/fixtures_html/fixtures_cpp.cpp.html +30 -0
  57. data/spec/fixtures/fixtures_html/fixtures_m.m.html +30 -0
  58. data/spec/fixtures/fixtures_html/fixtures_mm.mm.html +30 -0
  59. data/spec/fixtures/fixtures_html/index.html +134 -0
  60. data/spec/fixtures/fixtures_html/peekaview.m.html +190 -0
  61. data/spec/fixtures/fixtures_html/peekaviewTests.m.html +206 -0
  62. data/spec/fixtures/gutter.json +1 -0
  63. data/spec/slather/cocoapods_plugin_spec.rb +21 -0
  64. data/spec/slather/coverage_file_spec.rb +337 -0
  65. data/spec/slather/coverage_service/cobertura_xml_spec.rb +49 -0
  66. data/spec/slather/coverage_service/coveralls_spec.rb +122 -0
  67. data/spec/slather/coverage_service/gutter_json_spec.rb +28 -0
  68. data/spec/slather/coverage_service/hardcover_spec.rb +87 -0
  69. data/spec/slather/coverage_service/html_output_spec.rb +179 -0
  70. data/spec/slather/coverage_service/simple_output_spec.rb +35 -0
  71. data/spec/slather/fixtures.gcno +0 -0
  72. data/spec/slather/project_spec.rb +288 -0
  73. data/spec/spec_helper.rb +27 -0
  74. metadata +319 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0873ead117f224da1656279b22b182fec9de56e5
4
+ data.tar.gz: b2863fa7fe2daaca3bd105d2bcd4640e7572ff16
5
+ SHA512:
6
+ metadata.gz: c8d7dd0341538f6a80b090bf25cbe19542daa6cbe6b230c3cc3598f35419908bf0390016be8df58ef7c862a8d4bf0a60dedc6f689d47a61e14b658379d739e71
7
+ data.tar.gz: e2922091480df1f1bfbaec3a96229cdffc24d4b74e78b5437cbddf383f80bccbdca5e79bfe97a3899f33b7862e492fcc9cdcc98b8d0e401e8aef42ecf7567ece
@@ -0,0 +1 @@
1
+ service_name: travis-ci
@@ -0,0 +1,45 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
23
+
24
+ # Xcode
25
+ #
26
+ build/
27
+ *.pbxuser
28
+ !default.pbxuser
29
+ *.mode1v3
30
+ !default.mode1v3
31
+ *.mode2v3
32
+ !default.mode2v3
33
+ *.perspectivev3
34
+ !default.perspectivev3
35
+ xcuserdata
36
+ *.xccheckout
37
+ *.moved-aside
38
+ DerivedData
39
+ *.hmap
40
+ *.ipa
41
+ *.xcuserstate
42
+ *.DS_Store
43
+ cobertura.xml
44
+ .gutter.json
45
+ html
@@ -0,0 +1,19 @@
1
+ language: objective-c
2
+ script: bundle exec rspec
3
+
4
+ # Sets Travis to run the Ruby specs on OS X machines which are required to
5
+ # build the native extensions of Xcodeproj.
6
+
7
+ env:
8
+ - RVM_RUBY_VERSION=system
9
+
10
+ before_install:
11
+ - curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem
12
+ - source ~/.rvm/scripts/rvm
13
+ - if [[ $RVM_RUBY_VERSION != 'system' ]]; then rvm install $RVM_RUBY_VERSION; fi
14
+ - rvm use $RVM_RUBY_VERSION
15
+ - if [[ $RVM_RUBY_VERSION == 'system' ]]; then export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future; fi
16
+ - if [[ $RVM_RUBY_VERSION == 'system' ]]; then sudo gem install bundler --no-ri --no-rdoc; else gem install bundler --no-ri --no-rdoc; fi
17
+
18
+ install:
19
+ - bundle install --without=documentation --path ./travis_bundle_dir
@@ -0,0 +1,132 @@
1
+ # CHANGELOG
2
+
3
+ ## master
4
+
5
+ ## v1.8.2
6
+ * Add buildkite support to coveralls
7
+ [David Hardiman](https://github.com/dhardiman)
8
+ [#98](https://github.com/venmo/slather/pull/98)
9
+
10
+
11
+ ## v1.8.1
12
+ * Fixed dependency conflict with CocoaPods v0.38
13
+ * Updated usage of cocoapods plugin API since it has changed in v0.38
14
+ [Julian Krumow](https://github.com/tarbrain)
15
+ [#95](https://github.com/venmo/slather/pull/95)
16
+
17
+ ## v1.7.0
18
+ * Objective-C++ support
19
+ [ben-ng](https://github.com/ben-ng)
20
+ [#63](https://github.com/venmo/slather/pull/63)
21
+
22
+ ## v1.6.0
23
+ * Add CircleCI support
24
+ [Jonathan Hersh](https://github.com/jhersh)
25
+ [#55](https://github.com/venmo/slather/pull/55)
26
+
27
+ ## v1.5.4
28
+
29
+ * Fix calculation of branch coverage when a class has no branches
30
+ [Julian Krumow](https://github.com/tarbrain)
31
+ [#40](https://github.com/venmo/slather/pull/40)
32
+
33
+ * Always consider empty files as 100% tested
34
+ [Boris Bügling](https://github.com/neonichu)
35
+ [#45](https://github.com/venmo/slather/pull/45)
36
+
37
+ ## v1.5.2
38
+
39
+ * Add an option to define the output directory for cobertura xml reports
40
+ [Julian Krumow](https://github.com/tarbrain)
41
+ [#37](https://github.com/venmo/slather/pull/37)
42
+
43
+ ## v1.5.1
44
+
45
+ * Avoid crashes when coverage data is empty
46
+ * Fix bug which prevented source files without coverage data to be included in Cobertura xml report
47
+ [Julian Krumow](https://github.com/tarbrain)
48
+ [#34](https://github.com/venmo/slather/pull/34)
49
+
50
+ ## v1.5.0
51
+
52
+ * Add support for Cobertura
53
+ [Julian Krumow](https://github.com/tarbrain)
54
+ [#30](https://github.com/venmo/slather/pull/30)
55
+
56
+ ## v1.4.0
57
+
58
+ * Implement a CocoaPods plugin
59
+ [Kyle Fuller](https://github.com/kylef)
60
+ [#25](https://github.com/venmo/slather/pull/25)
61
+
62
+ * Avoid getting 'Infinity' or 'NaN' when dividing by 0.0
63
+ [Mark Larsen](https://github.com/marklarr)
64
+
65
+ * Ignore exceptions about files not existing by using 'force'
66
+ [Mark Larsen](https://github.com/marklarr)
67
+
68
+ ## v1.3.0
69
+
70
+ * Add Gutter JSON output
71
+ [Boris Bügling](https://github.com/neonichu)
72
+ [#24](https://github.com/venmo/slather/pull/24)
73
+
74
+ ## v1.2.1
75
+
76
+ * Fix typo --simple-output description
77
+ [Ayaka Nonaka](https://github.com/ayanonagon)
78
+ [#19](https://github.com/venmo/slather/pull/19)
79
+
80
+ * Remove broken travis pro support
81
+ [Mark Larsen](https://github.com/marklarr)
82
+ [#22](https://github.com/venmo/slather/pull/22)
83
+
84
+ * Fix exception for files without `@interface` or `@implementation`
85
+ [Piet Brauer](https://github.com/pietbrauer)
86
+ [#23](https://github.com/venmo/slather/pull/23)
87
+
88
+ ## v1.2.0
89
+
90
+ * Remove duplicate coverage files, favoring the file with higher coverage.
91
+ [Ayaka Nonaka](https://github.com/ayanonagon)
92
+ [#16](https://github.com/venmo/slather/pull/16)
93
+
94
+ * Add support for access token and Travis Pro
95
+ [Chris Maddern](https://github.com/chrismaddern)
96
+ [#17](https://github.com/venmo/slather/pull/17)
97
+
98
+ ## v1.1.0
99
+
100
+ * Support for code coverage of pods
101
+ [Mark Larsen](https://github.com/marklarr)
102
+
103
+ ## v1.0.1
104
+
105
+ * Fix coverage search for files that contain spaces
106
+ [Mark Larsen](https://github.com/marklarr)
107
+
108
+ ## v1.0.0
109
+
110
+ * beautified README
111
+ [Ayaka Nonaka](https://github.com/ayanonagon)
112
+ [#4](https://github.com/venmo/slather/pull/4)
113
+ [Kyle Fuller](https://github.com/kylef)
114
+ [#5](https://github.com/venmo/slather/pull/5)
115
+
116
+ * Add Travis automated builds
117
+ [Mark Larsen](https://github.com/marklarr)
118
+ [#6](https://github.com/venmo/slather/pull/6)
119
+
120
+ * Use `||=` instead of `unless`
121
+ [Ayaka Nonaka](https://github.com/ayanonagon)
122
+ [#7](https://github.com/venmo/slather/pull/7)
123
+
124
+ ## v0.0.31
125
+
126
+ * find source files via pbx proj rather than file system
127
+ [Mark Larsen](https://github.com/marklarr)
128
+
129
+ ## v0.0.3
130
+
131
+ * Initial Release
132
+ [Mark Larsen](https://github.com/marklarr)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in slather.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Mark Larsen
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,206 @@
1
+
2
+
3
+ ![Slather Logo](https://raw.githubusercontent.com/venmo/slather/master/docs/logo.jpg)
4
+
5
+ [![Gem Version](https://badge.fury.io/rb/slather.svg)](http://badge.fury.io/rb/slather)
6
+ [![Build Status](https://travis-ci.org/venmo/slather.svg?branch=master)](https://travis-ci.org/venmo/slather)
7
+ [![Coverage Status](https://coveralls.io/repos/venmo/slather/badge.svg?branch=ayanonagon%2Fcoveralls)](https://coveralls.io/r/venmo/slather?branch=ayanonagon%2Fcoveralls)
8
+
9
+ Generate test coverage reports for Xcode projects & hook it into CI.
10
+
11
+ ### Projects that use Slather
12
+
13
+ | Project | Coverage |
14
+ | ------- |:--------:|
15
+ | [Parsimmon](https://github.com/ayanonagon/Parsimmon) | [![Parsimmon Coverage](https://coveralls.io/repos/ayanonagon/Parsimmon/badge.svg?branch=master)](https://coveralls.io/r/ayanonagon/Parsimmon?branch=master) |
16
+ | [VENCore](https://github.com/venmo/VENCore) | [![VENCore Coverage](https://coveralls.io/repos/venmo/VENCore/badge.svg?branch=master)](https://coveralls.io/r/venmo/VENCore?branch=master) |
17
+ | [DAZABTest](https://github.com/dasmer/DAZABTest) | [![DAZABTest Coverage](https://coveralls.io/repos/dasmer/DAZABTest/badge.svg?branch=master)](https://coveralls.io/r/dasmer/DAZABTest?branch=master) |
18
+ | [TBStateMachine](https://github.com/tarbrain/TBStateMachine) | [![TBStateMachine Coverage](https://coveralls.io/repos/tarbrain/TBStateMachine/badge.svg?branch=master)](https://coveralls.io/r/tarbrain/TBStateMachine?branch=master) |
19
+
20
+ ## Installation
21
+
22
+ Add this line to your application's Gemfile:
23
+
24
+ ```ruby
25
+ gem 'slather'
26
+ ```
27
+
28
+ And then execute:
29
+
30
+ ```sh
31
+ $ bundle
32
+ ```
33
+
34
+ ## Usage
35
+
36
+ Set up your project for test coverage:
37
+
38
+ ```sh
39
+ $ slather setup path/to/project.xcodeproj
40
+ ```
41
+
42
+ This will enable the `Generate Test Coverage` and `Instrument Program Flow` flags for your project.
43
+
44
+
45
+ To verify you're ready to generate test coverage, run your test suite on your project, and then run:
46
+
47
+ ```sh
48
+ $ slather coverage -s path/to/project.xcodeproj
49
+ ```
50
+
51
+ ### Usage with Codecov
52
+
53
+ Login to [Codecov](https://codecov.io/) (no need to activate a repository, this happens automatically). Right now, `slather` supports Codecov via **all** supported CI providers [listed here](https://github.com/codecov/codecov-bash#ci-providers).
54
+
55
+ Make a `.slather.yml` file:
56
+
57
+ ```yml
58
+ # .slather.yml
59
+
60
+ coverage_service: cobertura_xml
61
+ xcodeproj: path/to/project.xcodeproj
62
+ source_directory: path/to/sources/to/include
63
+ output_directory: path/to/xml_report
64
+ ignore:
65
+ - ExamplePodCode/*
66
+ - ProjectTestsGroup/*
67
+ ```
68
+
69
+ And then in your `.travis.yml`, `circle.yml` (or after test commands in other CI providers), call `slather` after a successful build:
70
+
71
+ ```yml
72
+ # .travis.yml
73
+
74
+ before_install: rvm use $RVM_RUBY_VERSION
75
+ install: bundle install --without=documentation --path ../travis_bundle_dir
76
+ after_success:
77
+ - slather
78
+ - bash <(curl -s https://codecov.io/bash) -f path/to/xml_report/cobertura.xml
79
+ ```
80
+
81
+ ```yml
82
+ # circle.yml
83
+
84
+ test:
85
+ post:
86
+ - bundle exec slather
87
+ - bash <(curl -s https://codecov.io/bash)
88
+ ```
89
+
90
+ > Private repo? Add `-t :uuid-repo-token` to the codecov uploader. Read more about uploading report to Codecov [here](https://github.com/codecov/codecov-bash)
91
+
92
+ ### Usage with Coveralls
93
+
94
+ Login to [Coveralls](https://coveralls.io/) and enable your repository. Right now, `slather` supports Coveralls via [Travis CI](https://travis-ci.org) and [CircleCI](https://circleci.com).
95
+
96
+ Make a `.slather.yml` file:
97
+
98
+ ```yml
99
+ # .slather.yml
100
+
101
+ coverage_service: coveralls
102
+ xcodeproj: path/to/project.xcodeproj
103
+ ignore:
104
+ - ExamplePodCode/*
105
+ - ProjectTestsGroup/*
106
+ ```
107
+
108
+ And then in your `.travis.yml` or `circle.yml`, call `slather` after a successful build:
109
+
110
+ ```yml
111
+ # .travis.yml
112
+
113
+ before_install: rvm use $RVM_RUBY_VERSION
114
+ install: bundle install --without=documentation --path ../travis_bundle_dir
115
+ after_success: slather
116
+ ```
117
+
118
+ ```yml
119
+ # circle.yml
120
+
121
+ test:
122
+ post:
123
+ - bundle exec slather
124
+
125
+ ```
126
+
127
+ #### Usage with Travis CI Pro
128
+
129
+ To use Coveralls with Travis CI Pro (for private repos), add following lines along with other settings to `.slather.yml`:
130
+
131
+ ```yml
132
+ # .slather.yml
133
+
134
+ ci_service: travis_pro
135
+ coverage_access_token: <YOUR ACCESS TOKEN>
136
+ ```
137
+
138
+ The coverage token can be found at [Coveralls](https://coveralls.io/) repo page. Or it can be passed in via the `COVERAGE_ACCESS_TOKEN` environment var.
139
+
140
+ ### Cobertura
141
+
142
+ To create a Cobertura XML report set `cobertura_xml` as coverage service inside your `.slather.yml`. Optionally you can define an output directory for the XML report:
143
+
144
+ ```yml
145
+ # .slather.yml
146
+
147
+ coverage_service: cobertura_xml
148
+ xcodeproj: path/to/project.xcodeproj
149
+ source_directory: path/to/sources/to/include
150
+ output_directory: path/to/xml_report
151
+ ignore:
152
+ - ExamplePodCode/*
153
+ - ProjectTestsGroup/*
154
+ ```
155
+
156
+ Or use the command line options `--cobertura-xml` or `-x` and `--output-directory`:
157
+
158
+ ```sh
159
+ $ slather coverage -x --output-directory path/to/xml_report
160
+ ```
161
+
162
+ ### Static HTML
163
+
164
+ To create a report as static html pages, use the command line options `--html`:
165
+
166
+ ```sh
167
+ $ slather coverage --html path/to/project.xcodeproj
168
+ ```
169
+
170
+ This will make a directory named `html` in your root directory (unless `--output-directory` is specified) and will generate all the reports as static html pages inside the directory. It will print out the report's path by default, but you can also specify `--show` flag to open it in your browser automatically.
171
+
172
+ ### Coverage for code included via CocoaPods
173
+
174
+ If you're trying to compute the coverage of code that has been included via
175
+ CocoaPods, you will need to tell CocoaPods to use the Slather plugin by
176
+ adding the following to your `Podfile`.
177
+
178
+ ```ruby
179
+ plugin 'slather'
180
+ ```
181
+
182
+ You will also need to tell Slather where to find the source files for your Pod.
183
+
184
+ ```yml
185
+ # .slather.yml
186
+
187
+ source_directory: Pods/AFNetworking
188
+ ```
189
+
190
+ ### Custom Build Directory
191
+
192
+ Slather will look for the test coverage files in `DerivedData` by default. If you send build output to a custom location, like [this](https://github.com/erikdoe/ocmock/blob/7f4d22b38eedf1bb9a12ab1591ac0a5d436db61a/Tools/travis.sh#L12), then you should also set the `build_directory` property in `.slather.yml`
193
+
194
+ ## Contributing
195
+
196
+ We’d love to see your ideas for improving this library! The best way to contribute is by submitting a pull request. We’ll do our best to respond to your patch as soon as possible. You can also submit a [new GitHub issue](https://github.com/venmo/slather/issues/new) if you find bugs or have questions. :octocat:
197
+
198
+ Please make sure to follow our general coding style and add test coverage for new features!
199
+
200
+ ## Contributors
201
+
202
+ * [@tpoulos](https://github.com/tpoulos), the perfect logo.
203
+ * [@ayanonagon](https://github.com/ayanonagon) and [@kylef](https://github.com/kylef), feedback and testing.
204
+ * [@jhersh](https://github.com/jhersh), CircleCI support.
205
+ * [@tarbrain](https://github.com/tarbrain), Cobertura support and bugfixing.
206
+ * [@ikhsan](https://github.com/ikhsan), html support.
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"