simplecov-console 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "simplecov"
4
+ gem "hirb"
5
+ gem "colorize"
6
+
7
+ group :development do
8
+ gem "minitest"
9
+ gem "yard"
10
+ gem "bundler", "~> 1.2"
11
+ gem "jeweler", "~> 1.8"
12
+ end
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Chetan Sarva
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,62 @@
1
+ # simplecov-console
2
+
3
+ A simple console output formatter for SimpleCov
4
+
5
+ ### Usage
6
+
7
+ ```bash
8
+ $ gem install simplecov-console
9
+ ```
10
+
11
+ ```ruby
12
+ SimpleCov.formatter = SimpleCov::Formatter::Console
13
+ # or
14
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
15
+ SimpleCov::Formatter::HTMLFormatter,
16
+ SimpleCov::Formatter::Console,
17
+ ]
18
+ ```
19
+
20
+ Example output:
21
+ ```
22
+ COVERAGE: 68.89% -- 910/1321 lines
23
+
24
+ showing bottom (worst) 15 of 65 files
25
+ +----------+----------------------------------------------------+
26
+ | coverage | file |
27
+ +----------+----------------------------------------------------+
28
+ | 16.67% | lib/bixby/modules/metrics/rescan.rb |
29
+ | 20.93% | lib/bixby/modules/repository.rb |
30
+ | 21.43% | app/controllers/monitoring/commands_controller.rb |
31
+ | 22.73% | app/controllers/hosts_controller.rb |
32
+ | 22.73% | app/controllers/monitoring/checks_controller.rb |
33
+ | 25.00% | lib/rails_ext/migration.rb |
34
+ | 25.00% | app/controllers/inventory/hosts_controller.rb |
35
+ | 28.21% | lib/bixby/modules/monitoring.rb |
36
+ | 30.00% | app/controllers/monitoring/metrics_controller.rb |
37
+ | 30.77% | lib/rails_ext/to_api.rb |
38
+ | 36.11% | app/controllers/application_controller.rb |
39
+ | 40.00% | app/controllers/monitoring/resources_controller.rb |
40
+ | 40.00% | app/controllers/monitoring/hosts_controller.rb |
41
+ | 46.15% | lib/bixby/modules/notifier.rb |
42
+ | 47.83% | lib/bixby/hooks.rb |
43
+ +----------+----------------------------------------------------+
44
+
45
+ URL: file:///.../coverage/index.html
46
+ ```
47
+
48
+
49
+ ### Contributing
50
+
51
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
52
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
53
+ * Fork the project.
54
+ * Start a feature/bugfix branch.
55
+ * Commit and push until you are happy with your contribution.
56
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
57
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
58
+
59
+ ### Copyright
60
+
61
+ Copyright (c) 2012 Chetan Sarva. See LICENSE.txt for
62
+ further details.
data/Rakefile ADDED
@@ -0,0 +1,38 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "simplecov-console"
18
+ gem.homepage = "http://github.com/chetan/simplecov-console"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Simple console output formatter}
21
+ gem.description = %Q{Simple console output formatter for SimpleCov}
22
+ gem.email = "chetan@pixelcop.net"
23
+ gem.authors = ["Chetan Sarva"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ task :default => :test
36
+
37
+ require 'yard'
38
+ YARD::Rake::YardocTask.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,64 @@
1
+
2
+ require 'hirb'
3
+ require 'colorize'
4
+
5
+ class SimpleCov::Formatter::Console
6
+
7
+ VERSION = File.new(File.join(File.expand_path(File.dirname(__FILE__)), "../VERSION")).read.strip
8
+
9
+ def format(result)
10
+
11
+ root = nil
12
+ if Module.const_defined? :ROOT then
13
+ root = ROOT
14
+ elsif Module.const_defined? :Rails then
15
+ root = Rails.root.to_s
16
+ end
17
+
18
+ puts
19
+ puts "COVERAGE: #{colorize(pct(result))} -- #{result.covered_lines}/#{result.total_lines} lines"
20
+ puts
21
+
22
+ if root.nil? then
23
+ return
24
+ end
25
+
26
+ files = result.files.sort{ |a,b| a.covered_percent <=> b.covered_percent }
27
+
28
+ if files.nil? or files.empty? then
29
+ return
30
+ end
31
+
32
+ table = files.map{ |f| { :file => f.filename.gsub(root + "/", ''), :coverage => pct(f) } }
33
+
34
+ if table.size > 15 then
35
+ puts "showing bottom (worst) 15 of #{table.size} files"
36
+ table = table.slice(0, 15)
37
+ end
38
+
39
+ s = Hirb::Helpers::Table.render(table).split(/\n/)
40
+ s.pop
41
+ puts s.join("\n").gsub(/\d+\.\d+%/) { |m| colorize(m) }
42
+
43
+ puts
44
+ puts "URL: file://#{root}/coverage/index.html"
45
+
46
+ end
47
+
48
+ def pct(obj)
49
+ sprintf("%6.2f%%", obj.covered_percent)
50
+ end
51
+
52
+ def colorize(s)
53
+ s =~ /([\d.]+)/
54
+ n = $1.to_f
55
+ if n >= 90 then
56
+ s.colorize(:green)
57
+ elsif n >= 80 then
58
+ s.colorize(:yellow)
59
+ else
60
+ s.colorize(:red)
61
+ end
62
+ end
63
+
64
+ end
@@ -0,0 +1,67 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "simplecov-console"
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Chetan Sarva"]
12
+ s.date = "2012-10-25"
13
+ s.description = "Simple console output formatter for SimpleCov"
14
+ s.email = "chetan@pixelcop.net"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "LICENSE.txt",
23
+ "README.md",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "lib/simplecov-console.rb",
27
+ "simplecov-console.gemspec",
28
+ "test/helper.rb",
29
+ "test/test_simplecov-console.rb"
30
+ ]
31
+ s.homepage = "http://github.com/chetan/simplecov-console"
32
+ s.licenses = ["MIT"]
33
+ s.require_paths = ["lib"]
34
+ s.rubygems_version = "1.8.24"
35
+ s.summary = "Simple console output formatter"
36
+
37
+ if s.respond_to? :specification_version then
38
+ s.specification_version = 3
39
+
40
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
41
+ s.add_runtime_dependency(%q<simplecov>, [">= 0"])
42
+ s.add_runtime_dependency(%q<hirb>, [">= 0"])
43
+ s.add_runtime_dependency(%q<colorize>, [">= 0"])
44
+ s.add_development_dependency(%q<minitest>, [">= 0"])
45
+ s.add_development_dependency(%q<yard>, [">= 0"])
46
+ s.add_development_dependency(%q<bundler>, ["~> 1.2"])
47
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8"])
48
+ else
49
+ s.add_dependency(%q<simplecov>, [">= 0"])
50
+ s.add_dependency(%q<hirb>, [">= 0"])
51
+ s.add_dependency(%q<colorize>, [">= 0"])
52
+ s.add_dependency(%q<minitest>, [">= 0"])
53
+ s.add_dependency(%q<yard>, [">= 0"])
54
+ s.add_dependency(%q<bundler>, ["~> 1.2"])
55
+ s.add_dependency(%q<jeweler>, ["~> 1.8"])
56
+ end
57
+ else
58
+ s.add_dependency(%q<simplecov>, [">= 0"])
59
+ s.add_dependency(%q<hirb>, [">= 0"])
60
+ s.add_dependency(%q<colorize>, [">= 0"])
61
+ s.add_dependency(%q<minitest>, [">= 0"])
62
+ s.add_dependency(%q<yard>, [">= 0"])
63
+ s.add_dependency(%q<bundler>, ["~> 1.2"])
64
+ s.add_dependency(%q<jeweler>, ["~> 1.8"])
65
+ end
66
+ end
67
+
data/test/helper.rb ADDED
@@ -0,0 +1,25 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require "simplecov"
11
+ require 'minitest/unit'
12
+
13
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
14
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
+ require 'simplecov-console'
16
+
17
+ class MiniTest::Unit::TestCase
18
+ end
19
+
20
+ SimpleCov.formatter = SimpleCov::Formatter::Console
21
+ SimpleCov.start do
22
+ add_filter "/test/"
23
+ end
24
+
25
+ MiniTest::Unit.autorun
@@ -0,0 +1,8 @@
1
+ require 'helper'
2
+
3
+ class TestSimplecovConsole < MiniTest::Unit::TestCase
4
+ def test_defined
5
+ assert defined?(SimpleCov::Formatter::Console)
6
+ assert defined?(SimpleCov::Formatter::Console::VERSION)
7
+ end
8
+ end
metadata ADDED
@@ -0,0 +1,172 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simplecov-console
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Chetan Sarva
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-10-25 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: simplecov
16
+ requirement: !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: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: hirb
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: colorize
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: minitest
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: yard
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: bundler
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: '1.2'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '1.2'
110
+ - !ruby/object:Gem::Dependency
111
+ name: jeweler
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: '1.8'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '1.8'
126
+ description: Simple console output formatter for SimpleCov
127
+ email: chetan@pixelcop.net
128
+ executables: []
129
+ extensions: []
130
+ extra_rdoc_files:
131
+ - LICENSE.txt
132
+ - README.md
133
+ files:
134
+ - .document
135
+ - Gemfile
136
+ - LICENSE.txt
137
+ - README.md
138
+ - Rakefile
139
+ - VERSION
140
+ - lib/simplecov-console.rb
141
+ - simplecov-console.gemspec
142
+ - test/helper.rb
143
+ - test/test_simplecov-console.rb
144
+ homepage: http://github.com/chetan/simplecov-console
145
+ licenses:
146
+ - MIT
147
+ post_install_message:
148
+ rdoc_options: []
149
+ require_paths:
150
+ - lib
151
+ required_ruby_version: !ruby/object:Gem::Requirement
152
+ none: false
153
+ requirements:
154
+ - - ! '>='
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ segments:
158
+ - 0
159
+ hash: 1002964889080601160
160
+ required_rubygems_version: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ requirements: []
167
+ rubyforge_project:
168
+ rubygems_version: 1.8.24
169
+ signing_key:
170
+ specification_version: 3
171
+ summary: Simple console output formatter
172
+ test_files: []