simplecov-summary 0.0.1
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.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +63 -0
- data/Rakefile +1 -0
- data/lib/simplecov-summary.rb +29 -0
- data/lib/simplecov-summary/version.rb +5 -0
- data/simplecov-summary.gemspec +22 -0
- metadata +78 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Boris Staal
|
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,63 @@
|
|
1
|
+
# Simplecov::Summary
|
2
|
+
|
3
|
+
SimpleCov formatter that prints nice colored summary for your coverage straight into your console.
|
4
|
+
|
5
|
+

|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'simplecov-summary'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install simplecov-summary
|
20
|
+
|
21
|
+
## Example
|
22
|
+
|
23
|
+
Below you can find the example for a typical Rails RSpec configuration. The following setup will silently generate HTML output and show you colored summary on each run.
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require 'simplecov'
|
27
|
+
|
28
|
+
SimpleCov.start do
|
29
|
+
add_filter '/spec/'
|
30
|
+
add_filter '/config/'
|
31
|
+
add_filter '/db/'
|
32
|
+
add_filter '/vendor/'
|
33
|
+
|
34
|
+
add_group 'Controllers', 'app/controllers'
|
35
|
+
add_group 'Models', 'app/models'
|
36
|
+
add_group 'Decorators', 'app/decorators'
|
37
|
+
add_group 'Helpers', 'app/helpers'
|
38
|
+
add_group 'Libraries', 'lib'
|
39
|
+
|
40
|
+
at_exit do
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
RSpec.configure do |config|
|
45
|
+
config.after(:suite) do
|
46
|
+
if SimpleCov.running
|
47
|
+
silence_stream(STDOUT) do
|
48
|
+
SimpleCov::Formatter::HTMLFormatter.new.format(SimpleCov.result)
|
49
|
+
end
|
50
|
+
|
51
|
+
SimpleCov::Formatter::SummaryFormatter.new.format(SimpleCov.result)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
```
|
56
|
+
|
57
|
+
## Contributing
|
58
|
+
|
59
|
+
1. Fork it
|
60
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
61
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
62
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
63
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'simplecov-summary/version'
|
2
|
+
require 'simplecov'
|
3
|
+
|
4
|
+
class SimpleCov::Formatter::SummaryFormatter
|
5
|
+
def format(result)
|
6
|
+
puts "\n\n"
|
7
|
+
print "SimpleCov stats:"
|
8
|
+
|
9
|
+
name_length = result.groups.keys.map{|x| x.length}.max
|
10
|
+
|
11
|
+
result.groups.each do |name, files|
|
12
|
+
puts "\n"
|
13
|
+
|
14
|
+
percentage = files.map{|x| x.covered_percent.round(2)}
|
15
|
+
percentage = (percentage.sum / percentage.count).round(2)
|
16
|
+
|
17
|
+
color = case percentage
|
18
|
+
when 90..100
|
19
|
+
:green
|
20
|
+
when 80..90
|
21
|
+
:yellow
|
22
|
+
else
|
23
|
+
:red
|
24
|
+
end
|
25
|
+
|
26
|
+
print " #{name.rjust(name_length)}: #{percentage}".send(color)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'simplecov-summary/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "simplecov-summary"
|
8
|
+
gem.version = Simplecov::Summary::VERSION
|
9
|
+
gem.authors = ["Boris Staal"]
|
10
|
+
gem.email = ["boris@roundlake.ru"]
|
11
|
+
gem.description = %q{SimpleCov formatter that prints nice colored summary for your coverage straight into your console.}
|
12
|
+
gem.summary = gem.description
|
13
|
+
gem.homepage = "https://github.com/inossidabile/simplecov-summary"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency 'simplecov'
|
21
|
+
gem.add_dependency 'colored'
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: simplecov-summary
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Boris Staal
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: simplecov
|
16
|
+
requirement: &70319102385800 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70319102385800
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: colored
|
27
|
+
requirement: &70319102401740 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70319102401740
|
36
|
+
description: SimpleCov formatter that prints nice colored summary for your coverage
|
37
|
+
straight into your console.
|
38
|
+
email:
|
39
|
+
- boris@roundlake.ru
|
40
|
+
executables: []
|
41
|
+
extensions: []
|
42
|
+
extra_rdoc_files: []
|
43
|
+
files:
|
44
|
+
- .gitignore
|
45
|
+
- Gemfile
|
46
|
+
- LICENSE.txt
|
47
|
+
- README.md
|
48
|
+
- Rakefile
|
49
|
+
- lib/simplecov-summary.rb
|
50
|
+
- lib/simplecov-summary/version.rb
|
51
|
+
- simplecov-summary.gemspec
|
52
|
+
homepage: https://github.com/inossidabile/simplecov-summary
|
53
|
+
licenses: []
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options: []
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
requirements: []
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 1.8.15
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: SimpleCov formatter that prints nice colored summary for your coverage straight
|
76
|
+
into your console.
|
77
|
+
test_files: []
|
78
|
+
has_rdoc:
|