simplecov_compact_json 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f719f501f3e6b7a8225aa32df4274b8cf1ee9750
4
+ data.tar.gz: 32d8722134bfeedc6a20b1845940e6b35553c976
5
+ SHA512:
6
+ metadata.gz: 7c475c9cee8db28c99ac9e5446676342f5792288e9bde0c634cb358f57f00473b3d483b8f2cc4d709754d85fbb00f53ee9dc961d0fe0412f441729790ccd7521
7
+ data.tar.gz: 67db74a6e0342aaabd6b7a138f5c35e88534b1519003045ca01d0410e00ad216a4f01f236699b0cbb7db30a02e891c4aa1eb133531e4d54f4e9532e514e332cd
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in simplecov-json-lite.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 CoralineAda
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.
data/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # CompactJSON
2
+
3
+ CompactJSON is a summary-only JSON formatter for SimpleCov. For complete JSON
4
+ output you probably want [simplecov-json](https://github.com/vicentllongo/simplecov-json).
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ ```ruby
11
+ gem 'simplecov_compact_json', require: false
12
+ ```
13
+
14
+ And then execute:
15
+ `$ bundle`
16
+
17
+ Now in your spec helper:
18
+
19
+ ```ruby
20
+ SimpleCov.formatters = [
21
+ SimpleCov::Formatter::CompactJSON
22
+ ]
23
+ ```
24
+
25
+ The results will be written to `coverage/results.json`
26
+
27
+ ## Sample Output
28
+
29
+ ```
30
+ {
31
+ "summary": {
32
+ "coverage": 50.00
33
+ },
34
+ "files": [
35
+ {
36
+ "filename": "foo.rb",
37
+ "coverage": 100.00
38
+ },
39
+ {
40
+ "filename": "bar.rb",
41
+ "coverage": 0.00
42
+ }
43
+ ]
44
+ }
45
+ ```
46
+
47
+ ## Contributing
48
+
49
+ Please note that this project is released with a [Contributor Code of Conduct]
50
+ (http://contributor-covenant.org/version/1/0/0/).
51
+ By participating in this project you agree to abide by its terms.
52
+
53
+ 1. Fork it ( https://github.com/[my-github-username]/simplecov-json-lite/fork )
54
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
55
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
56
+ 4. Push to the branch (`git push origin my-new-feature`)
57
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,48 @@
1
+ require "simplecov"
2
+
3
+ module SimpleCov::Formatter::CompactJSON
4
+
5
+ def self.new
6
+ ::CompactJSON::Formatter.new
7
+ end
8
+
9
+ end
10
+
11
+ module CompactJSON
12
+ class Formatter
13
+
14
+ attr_reader :result
15
+
16
+ def format(result)
17
+ @result = result
18
+ File.open("./coverage/results.json", "w") do |file|
19
+ file.print(formatted_result)
20
+ end
21
+ end
22
+
23
+ def formatted_result
24
+ {
25
+ summary: summary_results,
26
+ files: file_results
27
+ }.to_json
28
+ end
29
+
30
+ private
31
+
32
+ def file_results
33
+ self.result.files.map do |file|
34
+ {
35
+ filename: file.filename,
36
+ coverage: file.covered_percent.round(2)
37
+ }
38
+ end
39
+ end
40
+
41
+ def summary_results
42
+ {
43
+ coverage: result.covered_percent.round(2),
44
+ }
45
+ end
46
+
47
+ end
48
+ end
data/lib/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ module CompactJSON
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "simplecov_compact_json"
8
+ spec.version = CompactJSON::VERSION
9
+ spec.authors = ["CoralineAda"]
10
+ spec.email = ["coraline@idolhands.com"]
11
+ spec.summary = %q{Lightweight JSON formatter for SimpleCov}
12
+ spec.description = %q{A lightweight, summary-level JSON formatter for SimpleCov.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "rspec", "~> 3.1.0"
24
+ spec.add_development_dependency "simplecov", "~> 0.9.1"
25
+
26
+ end
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simplecov_compact_json
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - CoralineAda
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.1.0
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.1.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.9.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.9.1
69
+ description: A lightweight, summary-level JSON formatter for SimpleCov.
70
+ email:
71
+ - coraline@idolhands.com
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - ".gitignore"
77
+ - CODE_OF_CONDUCT.md
78
+ - Gemfile
79
+ - LICENSE.txt
80
+ - README.md
81
+ - Rakefile
82
+ - lib/simplecov_compact_json.rb
83
+ - lib/version.rb
84
+ - simplecov_compact_json.gemspec
85
+ homepage: ''
86
+ licenses:
87
+ - MIT
88
+ metadata: {}
89
+ post_install_message:
90
+ rdoc_options: []
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ required_rubygems_version: !ruby/object:Gem::Requirement
99
+ requirements:
100
+ - - ">="
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ requirements: []
104
+ rubyforge_project:
105
+ rubygems_version: 2.2.2
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: Lightweight JSON formatter for SimpleCov
109
+ test_files: []