simplecov-markdown 0.1.0

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/.coveralls.yml ADDED
@@ -0,0 +1 @@
1
+ service_name: travis-ci
data/.gitignore ADDED
@@ -0,0 +1,34 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ # Gemfile.lock
30
+ # .ruby-version
31
+ # .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --require spec_helper
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
5
+ - 2.1
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in simplecov-markdown.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,56 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ simplecov-markdown (0.1.0)
5
+ simplecov
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ coveralls (0.7.2)
11
+ multi_json (~> 1.3)
12
+ rest-client (= 1.6.7)
13
+ simplecov (>= 0.7)
14
+ term-ansicolor (= 1.2.2)
15
+ thor (= 0.18.1)
16
+ diff-lcs (1.2.5)
17
+ docile (1.1.5)
18
+ mime-types (2.4.3)
19
+ multi_json (1.10.1)
20
+ rake (10.4.2)
21
+ rest-client (1.6.7)
22
+ mime-types (>= 1.16)
23
+ rspec (3.1.0)
24
+ rspec-core (~> 3.1.0)
25
+ rspec-expectations (~> 3.1.0)
26
+ rspec-mocks (~> 3.1.0)
27
+ rspec-core (3.1.7)
28
+ rspec-support (~> 3.1.0)
29
+ rspec-expectations (3.1.2)
30
+ diff-lcs (>= 1.2.0, < 2.0)
31
+ rspec-support (~> 3.1.0)
32
+ rspec-mocks (3.1.3)
33
+ rspec-support (~> 3.1.0)
34
+ rspec-support (3.1.2)
35
+ rspec-temp_dir (0.0.3)
36
+ rspec
37
+ simplecov (0.9.1)
38
+ docile (~> 1.1.0)
39
+ multi_json (~> 1.0)
40
+ simplecov-html (~> 0.8.0)
41
+ simplecov-html (0.8.0)
42
+ term-ansicolor (1.2.2)
43
+ tins (~> 0.8)
44
+ thor (0.18.1)
45
+ tins (0.13.2)
46
+
47
+ PLATFORMS
48
+ ruby
49
+
50
+ DEPENDENCIES
51
+ bundler (~> 1.0)
52
+ coveralls
53
+ rake (~> 10.0)
54
+ rspec
55
+ rspec-temp_dir (~> 0.0.3)
56
+ simplecov-markdown!
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Noritaka Horio
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ SimpleCov Markdown Formatter
2
+ ==================================
3
+
4
+ [![Build Status](https://travis-ci.org/holyshared/simplecov-markdown.svg?branch=master)](https://travis-ci.org/holyshared/simplecov-markdown)
5
+ [![Coverage Status](https://coveralls.io/repos/holyshared/simplecov-markdown/badge.png)](https://coveralls.io/r/holyshared/simplecov-markdown)
6
+
7
+ Install
8
+ ----------------------------
9
+
10
+ gem install simplecov-markdown
11
+
12
+ Usage
13
+ ----------------------------
14
+
15
+ ```ruby
16
+ require 'simplecov-csv'
17
+ SimpleCov.formatter = SimpleCov::Formatter::MarkdownFormatter
18
+ ```
data/Rakefile ADDED
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
7
+
@@ -0,0 +1,8 @@
1
+ module SimpleCov
2
+ module Formatter
3
+ class MarkdownFormatter
4
+ VERSION = "0.1.0"
5
+ end
6
+ end
7
+ end
8
+
@@ -0,0 +1,18 @@
1
+ require "simplecov-markdown/version"
2
+
3
+ class SimpleCov::Formatter::MarkdownFormatter
4
+ def format(result)
5
+ @report = File.open(SimpleCov::Formatter::MarkdownFormatter.output_path, 'w')
6
+ @report.puts "Code Coverage Report"
7
+ @report.puts "======================\n\n"
8
+ @report.puts "|File|Coverage|"
9
+ @report.puts "|:--|--:|"
10
+ result.files.each do |file|
11
+ @report.puts "|#{file.filename}|#{file.covered_percent}%|"
12
+ end
13
+ @report.close
14
+ end
15
+ def self.output_path
16
+ File.join(SimpleCov.coverage_path, 'report.md')
17
+ end
18
+ end
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'simplecov-markdown/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "simplecov-markdown"
8
+ spec.version = SimpleCov::Formatter::MarkdownFormatter::VERSION
9
+ spec.authors = ["Noritaka Horio"]
10
+ spec.email = ["holy.shared.design@gmail.com"]
11
+ spec.summary = "Markdown formatter for simplecov"
12
+ spec.description = "Markdown 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_dependency 'simplecov'
22
+
23
+ spec.add_development_dependency "rspec-temp_dir", "~> 0.0.3"
24
+ spec.add_development_dependency "bundler", "~> 1.0"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ spec.add_development_dependency "rspec"
27
+ spec.add_development_dependency "coveralls"
28
+ end
@@ -0,0 +1,7 @@
1
+ Code Coverage Report
2
+ ======================
3
+
4
+ |File|Coverage|
5
+ |:--|--:|
6
+ |<%= root_directory %>/fixtures/sample1.rb|100.0%|
7
+ |<%= root_directory %>/fixtures/sample2.rb|80.0%|
@@ -0,0 +1,10 @@
1
+ # Sample1 class
2
+ class Sample1
3
+ def initialize
4
+ @foo = 'baz'
5
+ end
6
+
7
+ def bar
8
+ @foo
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ # Sample2 class
2
+ class Sample2
3
+ def initialize
4
+ @foo = 'baz'
5
+ end
6
+
7
+ def bar
8
+ @foo
9
+ end
10
+ end
@@ -0,0 +1,36 @@
1
+ require 'simplecov'
2
+ require 'erb'
3
+ require 'rspec/temp_dir'
4
+
5
+ describe 'MarkdownFormatter' do
6
+ include_context "uses temp dir"
7
+
8
+ let(:formatter) do
9
+ SimpleCov::Formatter::MarkdownFormatter.stub(:output_path).and_return(report_path)
10
+ SimpleCov::Formatter::MarkdownFormatter.new
11
+ end
12
+ let(:report_path) { File.join(temp_dir_path, 'report.md') }
13
+ let(:expect_report) do
14
+ root_directory = File.dirname(__FILE__)
15
+ erb_script = File.open(File.join(File.dirname(__FILE__), 'fixtures/report.md.erb')).read
16
+ ERB.new(erb_script).result(binding)
17
+ end
18
+ let(:result) do
19
+ sample1 = File.join(File.dirname(__FILE__), 'fixtures', 'sample1.rb')
20
+ sample2 = File.join(File.dirname(__FILE__), 'fixtures', 'sample2.rb')
21
+
22
+ original_result = {
23
+ sample1 => [nil, 1, 1, 1, nil, nil, 1, 1, nil, nil],
24
+ sample2 => [nil, 1, 1, 1, nil, nil, 1, 0, nil, nil]
25
+ }
26
+ SimpleCov::Result.new(original_result)
27
+ end
28
+
29
+ describe '#result' do
30
+ it 'format by markdown' do
31
+ formatter.format(result)
32
+ actual_report = File.open(report_path).read
33
+ expect(actual_report).to be_eql(expect_report)
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,15 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'simplecov'
3
+
4
+ if ENV["COVERALLS_REPO_TOKEN"]
5
+ require 'coveralls'
6
+ Coveralls.wear!
7
+ end
8
+
9
+ SimpleCov.start do
10
+ add_filter do |source_file|
11
+ source_file.filename =~ /spec/ && !(source_file.filename =~ /fixtures/)
12
+ end
13
+ end
14
+
15
+ require 'simplecov-markdown'
metadata ADDED
@@ -0,0 +1,170 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simplecov-markdown
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Noritaka Horio
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-01-06 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: rspec-temp_dir
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.0.3
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.0.3
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '10.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: '10.0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rspec
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: coveralls
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
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: '0'
110
+ description: Markdown formatter for simplecov
111
+ email:
112
+ - holy.shared.design@gmail.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - .coveralls.yml
118
+ - .gitignore
119
+ - .rspec
120
+ - .travis.yml
121
+ - Gemfile
122
+ - Gemfile.lock
123
+ - LICENSE
124
+ - README.md
125
+ - Rakefile
126
+ - lib/simplecov-markdown.rb
127
+ - lib/simplecov-markdown/version.rb
128
+ - simplecov-markdown.gemspec
129
+ - spec/fixtures/report.md.erb
130
+ - spec/fixtures/sample1.rb
131
+ - spec/fixtures/sample2.rb
132
+ - spec/simplecov-markdown_spec.rb
133
+ - spec/spec_helper.rb
134
+ homepage: ''
135
+ licenses:
136
+ - MIT
137
+ post_install_message:
138
+ rdoc_options: []
139
+ require_paths:
140
+ - lib
141
+ required_ruby_version: !ruby/object:Gem::Requirement
142
+ none: false
143
+ requirements:
144
+ - - ! '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ segments:
148
+ - 0
149
+ hash: -4304802998839078227
150
+ required_rubygems_version: !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ! '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ segments:
157
+ - 0
158
+ hash: -4304802998839078227
159
+ requirements: []
160
+ rubyforge_project:
161
+ rubygems_version: 1.8.25
162
+ signing_key:
163
+ specification_version: 3
164
+ summary: Markdown formatter for simplecov
165
+ test_files:
166
+ - spec/fixtures/report.md.erb
167
+ - spec/fixtures/sample1.rb
168
+ - spec/fixtures/sample2.rb
169
+ - spec/simplecov-markdown_spec.rb
170
+ - spec/spec_helper.rb